PageRenderTime 24ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/opensource.apple.com/source/Security/Security-163/Keychain/SecTrust.h

#
C Header | 231 lines | 102 code | 25 blank | 104 comment | 0 complexity | 4990106449892dd29510c3a1da3cf91d MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, GPL-2.0, BSD-3-Clause, GPL-3.0, MPL-2.0, LGPL-2.0, LGPL-2.1, CC-BY-SA-3.0, IPL-1.0, ISC, AGPL-1.0, AGPL-3.0, JSON, Apache-2.0, 0BSD
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <title>SecTrust.h</title>
  6. <style type="text/css">
  7. .enscript-comment { font-style: italic; color: rgb(178,34,34); }
  8. .enscript-function-name { font-weight: bold; color: rgb(0,0,255); }
  9. .enscript-variable-name { font-weight: bold; color: rgb(184,134,11); }
  10. .enscript-keyword { font-weight: bold; color: rgb(160,32,240); }
  11. .enscript-reference { font-weight: bold; color: rgb(95,158,160); }
  12. .enscript-string { font-weight: bold; color: rgb(188,143,143); }
  13. .enscript-builtin { font-weight: bold; color: rgb(218,112,214); }
  14. .enscript-type { font-weight: bold; color: rgb(34,139,34); }
  15. .enscript-highlight { text-decoration: underline; color: 0; }
  16. </style>
  17. </head>
  18. <body id="top">
  19. <h1 style="margin:8px;" id="f1">SecTrust.h&nbsp;&nbsp;&nbsp;<span style="font-weight: normal; font-size: 0.5em;">[<a href="?txt">plain text</a>]</span></h1>
  20. <hr/>
  21. <div></div>
  22. <pre>
  23. <span class="enscript-comment">/*
  24. * Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved.
  25. *
  26. * The contents of this file constitute Original Code as defined in and are
  27. * subject to the Apple Public Source License Version 1.2 (the 'License').
  28. * You may not use this file except in compliance with the License. Please obtain
  29. * a copy of the License at <a href="http://www.apple.com/publicsource">http://www.apple.com/publicsource</a> and read it before
  30. * using this file.
  31. *
  32. * This Original Code and all software distributed under the License are
  33. * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
  34. * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
  35. * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  36. * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
  37. * specific language governing rights and limitations under the License.
  38. */</span>
  39. <span class="enscript-comment">/*!
  40. @header SecTrust
  41. The functions and data types in SecTrust implement trust computation and allows the user to apply trust decisions to the trust configuration.
  42. */</span>
  43. #<span class="enscript-reference">ifndef</span> <span class="enscript-variable-name">_SECURITY_SECTRUST_H_</span>
  44. #<span class="enscript-reference">define</span> <span class="enscript-variable-name">_SECURITY_SECTRUST_H_</span>
  45. #<span class="enscript-reference">include</span> <span class="enscript-string">&lt;Security/SecBase.h&gt;</span>
  46. #<span class="enscript-reference">include</span> <span class="enscript-string">&lt;Security/cssmtype.h&gt;</span>
  47. #<span class="enscript-reference">include</span> <span class="enscript-string">&lt;Security/cssmapple.h&gt;</span>
  48. #<span class="enscript-reference">include</span> <span class="enscript-string">&lt;CoreFoundation/CoreFoundation.h&gt;</span>
  49. #<span class="enscript-reference">if</span> <span class="enscript-reference">defined</span>(<span class="enscript-variable-name">__cplusplus</span>)
  50. <span class="enscript-type">extern</span> <span class="enscript-string">&quot;C&quot;</span> {
  51. #<span class="enscript-reference">endif</span>
  52. <span class="enscript-comment">/*!
  53. @typedef SecTrustResultType
  54. @abstract Specifies the trust result type.
  55. @constant kSecTrustResultInvalid Indicates an invalid setting or result.
  56. @constant kSecTrustResultProceed Indicates you may proceed. This value may be returned by the SecTrustEvaluate function or stored as part of the user trust settings.
  57. @constant kSecTrustResultConfirm Indicates confirmation with the user is required before proceeding. This value may be returned by the SecTrustEvaluate function or stored as part of the user trust settings.
  58. @constant kSecTrustResultDeny Indicates a user-configured deny; do not proceed. This value may be returned by the SecTrustEvaluate function or stored as part of the user trust settings.
  59. @constant kSecTrustResultUnspecified Indicates user intent is unknown. This value may be returned by the SecTrustEvaluate function or stored as part of the user trust settings.
  60. @constant kSecTrustResultRecoverableTrustFailure Indicates a trust framework failure; retry after fixing inputs. This value may be returned by the SecTrustEvaluate function but not stored as part of the user trust settings.
  61. @constant kSecTrustResultFatalTrustFailure Indicates a trust framework failure; no &quot;easy&quot; fix. This value may be returned by the SecTrustEvaluate function but not stored as part of the user trust settings.
  62. @constant kSecTrustResultOtherError Indicates a failure other than that of trust evaluation. This value may be returned by the SecTrustEvaluate function but not stored as part of the user trust settings.
  63. */</span>
  64. <span class="enscript-type">typedef</span> <span class="enscript-type">enum</span> {
  65. kSecTrustResultInvalid,
  66. kSecTrustResultProceed,
  67. kSecTrustResultConfirm,
  68. kSecTrustResultDeny,
  69. kSecTrustResultUnspecified,
  70. kSecTrustResultRecoverableTrustFailure,
  71. kSecTrustResultFatalTrustFailure,
  72. kSecTrustResultOtherError
  73. } SecTrustResultType;
  74. <span class="enscript-comment">/*!
  75. @typedef SecTrustUserSetting
  76. @abstract Specifies user-specified trust settings.
  77. */</span>
  78. <span class="enscript-type">typedef</span> SecTrustResultType SecTrustUserSetting;
  79. <span class="enscript-comment">/*!
  80. @typedef SecTrustRef
  81. @abstract A pointer to an opaque trust management structure.
  82. */</span>
  83. <span class="enscript-type">typedef</span> <span class="enscript-type">struct</span> OpaqueSecTrustRef *SecTrustRef;
  84. <span class="enscript-comment">/*!
  85. @function SecTrustGetTypeID
  86. @abstract Returns the type identifier of SecTrust instances.
  87. @result The CFTypeID of SecTrust instances.
  88. */</span>
  89. CFTypeID <span class="enscript-function-name">SecTrustGetTypeID</span>(<span class="enscript-type">void</span>);
  90. <span class="enscript-comment">/*!
  91. @function SecTrustCreateWithCertificates
  92. @abstract Creates a trust based on the given certificates and policies.
  93. @param certificates The group of certificates to verify.
  94. @param policies An array of one or more policies. You may pass a SecPolicyRef
  95. to represent a single policy.
  96. @param trustRef On return, a pointer to the trust management reference.
  97. @result A result code. See &quot;Security Error Codes&quot; (SecBase.h).
  98. */</span>
  99. OSStatus <span class="enscript-function-name">SecTrustCreateWithCertificates</span>(CFArrayRef certificates, CFTypeRef policies, SecTrustRef *trustRef);
  100. <span class="enscript-comment">/*!
  101. @function SecTrustSetParameters
  102. @abstract Sets the action and action data for a trust.
  103. @param trustRef The reference to the trust to change.
  104. @param action A CSSM trust action.
  105. @param actionData A reference to action data.
  106. @result A result code. See &quot;Security Error Codes&quot; (SecBase.h).
  107. */</span>
  108. OSStatus <span class="enscript-function-name">SecTrustSetParameters</span>(SecTrustRef trustRef, CSSM_TP_ACTION action, CFDataRef actionData);
  109. <span class="enscript-comment">/*!
  110. @function SecTrustSetAnchorCertificates
  111. @abstract Sets the anchor certificates for a given trust.
  112. @param trust A reference to a trust.
  113. @param anchorCertificates An array of anchor certificates.
  114. @result A result code. See &quot;Security Error Codes&quot; (SecBase.h).
  115. */</span>
  116. OSStatus <span class="enscript-function-name">SecTrustSetAnchorCertificates</span>(SecTrustRef trust, CFArrayRef anchorCertificates);
  117. <span class="enscript-comment">/*!
  118. @function SecTrustSetKeychains
  119. @abstract Sets the keychains for a given trust.
  120. @param trust A reference to a trust.
  121. @param keychainOrArray An reference to an array of keychains to search, a single keychain or NULL to search the user's default keychain search list.
  122. @result A result code. See &quot;Security Error Codes&quot; (SecBase.h).
  123. */</span>
  124. OSStatus <span class="enscript-function-name">SecTrustSetKeychains</span>(SecTrustRef trust, CFTypeRef keychainOrArray);
  125. <span class="enscript-comment">/*!
  126. @function SecTrustSetVerifyDate
  127. @abstract Verifies the date of a given trust.
  128. @param trust A reference to the trust to verify.
  129. @param verifyDate The date to verify.
  130. @result A result code. See &quot;Security Error Codes&quot; (SecBase.h).
  131. */</span>
  132. OSStatus <span class="enscript-function-name">SecTrustSetVerifyDate</span>(SecTrustRef trust, CFDateRef verifyDate);
  133. <span class="enscript-comment">/*!
  134. @function SecTrustEvaluate
  135. @abstract Evaluates a trust.
  136. @param trust A reference to the trust to evaluate.
  137. @param result A pointer to a result type.
  138. @result A result code. See &quot;Security Error Codes&quot; (SecBase.h).
  139. */</span>
  140. OSStatus <span class="enscript-function-name">SecTrustEvaluate</span>(SecTrustRef trust, SecTrustResultType *result);
  141. <span class="enscript-comment">/*!
  142. @function SecTrustGetResult
  143. @abstract Returns detail information on the outcome of a call to SecTrustEvaluate.
  144. @param trustRef A reference to a trust.
  145. @param result A pointer to the result from the call to SecTrustEvaluate.
  146. @param certChain On return, a pointer to the certificate chain used to validate the input certificate.
  147. @param statusChain On return, a pointer to the status of the certificate chain. Do not attempt to free this pointer; it remains valid until the trust is destroyed or the next call to SecTrustEvaluate.
  148. @result A result code. See &quot;Security Error Codes&quot; (SecBase.h).
  149. */</span>
  150. OSStatus <span class="enscript-function-name">SecTrustGetResult</span>(SecTrustRef trustRef, SecTrustResultType *result, CFArrayRef *certChain, CSSM_TP_APPLE_EVIDENCE_INFO **statusChain);
  151. <span class="enscript-comment">/*!
  152. @function SecTrustGetCssmResult
  153. @abstract Gets the CSSM trust result.
  154. @param trust A reference to a trust.
  155. @param result On return, a pointer to the CSSM trust result.
  156. @result A result code. See &quot;Security Error Codes&quot; (SecBase.h).
  157. */</span>
  158. OSStatus <span class="enscript-function-name">SecTrustGetCssmResult</span>(SecTrustRef trust, CSSM_TP_VERIFY_CONTEXT_RESULT_PTR *result);
  159. <span class="enscript-comment">/*!
  160. @function SecTrustGetTPHandle
  161. @abstract Gets the CSSM trust handle
  162. @param trust A reference to a trust.
  163. @param handle On return, a pointer to a CSSM trust handle.
  164. @result A result code. See &quot;Security Error Codes&quot; (SecBase.h).
  165. */</span>
  166. OSStatus <span class="enscript-function-name">SecTrustGetTPHandle</span>(SecTrustRef trust, CSSM_TP_HANDLE *handle);
  167. <span class="enscript-comment">/*!
  168. @function SecTrustCopyAnchorCertificates
  169. @abstract Returns the anchor (root) certificates.
  170. @param anchors On return, a pointer to the anchors (roots). This may be used with the function SecCertificateGroupVerify. Call the CFRelease function to release this pointer.
  171. @result A result code. See &quot;Security Error Codes&quot; (SecBase.h).
  172. */</span>
  173. OSStatus <span class="enscript-function-name">SecTrustCopyAnchorCertificates</span>(CFArrayRef* anchors);
  174. <span class="enscript-comment">/*!
  175. @function SecTrustGetCSSMAnchorCertificates
  176. @abstract Retrieves the CSSM anchor certificates.
  177. @param cssmAnchors A pointer to an array of anchor certificates.
  178. @param cssmAnchorCount A pointer to the number of certificates in anchors.
  179. @result A result code. See &quot;Security Error Codes&quot; (SecBase.h).
  180. */</span>
  181. OSStatus <span class="enscript-function-name">SecTrustGetCSSMAnchorCertificates</span>(<span class="enscript-type">const</span> CSSM_DATA **cssmAnchors, uint32 *cssmAnchorCount);
  182. <span class="enscript-comment">/*!
  183. @function SecTrustGetUserTrust
  184. @abstract Gets the user-specified trust settings of a certificate and policy.
  185. @param certificate A reference to a certificate.
  186. @param policy A reference to a policy.
  187. @param trustSetting On return, a pointer to the user specified trust settings.
  188. @result A result code. See &quot;Security Error Codes&quot; (SecBase.h).
  189. */</span>
  190. OSStatus <span class="enscript-function-name">SecTrustGetUserTrust</span>(SecCertificateRef certificate, SecPolicyRef policy, SecTrustUserSetting *trustSetting);
  191. <span class="enscript-comment">/*!
  192. @function SecTrustSetUserTrust
  193. @abstract Sets the user-specified trust settings of a certificate and policy.
  194. @param certificate A reference to a certificate.
  195. @param policy A reference to a policy.
  196. @param trustSetting The user-specified trust settings.
  197. @result A result code. See &quot;Security Error Codes&quot; (SecBase.h).
  198. */</span>
  199. OSStatus <span class="enscript-function-name">SecTrustSetUserTrust</span>(SecCertificateRef certificate, SecPolicyRef policy, SecTrustUserSetting trustSetting);
  200. #<span class="enscript-reference">if</span> <span class="enscript-reference">defined</span>(<span class="enscript-variable-name">__cplusplus</span>)
  201. }
  202. #<span class="enscript-reference">endif</span>
  203. #<span class="enscript-reference">endif</span> <span class="enscript-comment">/* !_SECURITY_SECTRUST_H_ */</span>
  204. </pre>
  205. <hr />
  206. </body></html>