peachsim 0.1.1692 → 0.1.1700

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/cli/bridge-flow-runner.ts +61 -39
  2. package/cli/commands/agent-wrapper.ts +21 -10
  3. package/cli/commands/control.ts +27 -7
  4. package/cli/commands/coverage.ts +1 -1
  5. package/cli/commands/detect.ts +17 -4
  6. package/cli/commands/maestro-compare.ts +25 -99
  7. package/cli/help-core.ts +3 -4
  8. package/cli/maestro-compare.ts +172 -4
  9. package/cli/outbound-endpoints.ts +2 -10
  10. package/detox/index.ts +15 -0
  11. package/detox/launch-permissions.ts +169 -0
  12. package/dist-lib/agent-daemon-client.cjs +2 -2
  13. package/dist-lib/agent-events.cjs +2 -2
  14. package/dist-lib/attached-projects.cjs +2 -2
  15. package/dist-lib/auth/shared-session.cjs +2 -2
  16. package/dist-lib/backend-origin.cjs +2 -2
  17. package/dist-lib/beta.cjs +2 -2
  18. package/dist-lib/beta.mjs +1 -1
  19. package/dist-lib/bridge-constants.cjs +2 -2
  20. package/dist-lib/bridge-contract-input.cjs +2 -2
  21. package/dist-lib/bridge-contract-input.mjs +1 -1
  22. package/dist-lib/bridge-contract.cjs +2 -2
  23. package/dist-lib/bridge-contract.mjs +1 -1
  24. package/dist-lib/bundle-channel.cjs +18273 -15925
  25. package/dist-lib/capture-contract.cjs +2 -2
  26. package/dist-lib/capture-contract.mjs +1 -1
  27. package/dist-lib/cloud-contract.cjs +2 -2
  28. package/dist-lib/cloud-contract.mjs +1 -1
  29. package/dist-lib/cloud-test-args.cjs +2 -2
  30. package/dist-lib/cloud-test-args.mjs +1 -1
  31. package/dist-lib/cloud.cjs +2 -2
  32. package/dist-lib/cloud.mjs +1 -1
  33. package/dist-lib/config.cjs +2 -2
  34. package/dist-lib/config.mjs +1 -1
  35. package/dist-lib/detox/index.cjs +104 -3
  36. package/dist-lib/dev-bundle-resolution.cjs +208 -44
  37. package/dist-lib/expo-swift-bundle.cjs +2349 -1778
  38. package/dist-lib/expo-swift-metadata.cjs +2 -2
  39. package/dist-lib/expo-swift-metadata.mjs +1 -1
  40. package/dist-lib/home-paths.cjs +2 -2
  41. package/dist-lib/host/bridge-host.cjs +7885 -3334
  42. package/dist-lib/host/fetch-proxy-handler.cjs +331 -39
  43. package/dist-lib/host/fetch-proxy-overrides.cjs +2 -2
  44. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  45. package/dist-lib/host/replacement-module-handler.cjs +2 -2
  46. package/dist-lib/host/websocket-proxy.cjs +2 -2
  47. package/dist-lib/index.cjs +297 -77
  48. package/dist-lib/jump-to-source-babel.cjs +2 -2
  49. package/dist-lib/jump-to-source-native.cjs +2 -2
  50. package/dist-lib/kotlin-host.cjs +2 -2
  51. package/dist-lib/menu.cjs +2 -2
  52. package/dist-lib/menu.mjs +1 -1
  53. package/dist-lib/metro-fingerprint-registry.cjs +2 -2
  54. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  55. package/dist-lib/metro-production-bundle.cjs +2 -2
  56. package/dist-lib/metro-production-bundle.mjs +1 -1
  57. package/dist-lib/metro.cjs +294 -74
  58. package/dist-lib/native-app-identity-project.cjs +48 -37
  59. package/dist-lib/native-app-identity-project.mjs +47 -36
  60. package/dist-lib/native-app-identity.cjs +2 -2
  61. package/dist-lib/native-app-identity.mjs +1 -1
  62. package/dist-lib/native-firebase-metadata.cjs +2 -2
  63. package/dist-lib/native-firebase-metadata.mjs +1 -1
  64. package/dist-lib/plist.cjs +2 -2
  65. package/dist-lib/plist.mjs +1 -1
  66. package/dist-lib/profiles.cjs +2 -2
  67. package/dist-lib/public-brand.cjs +2 -2
  68. package/dist-lib/public-origins-lib-esm.json +24 -23
  69. package/dist-lib/public-origins-lib.json +199 -79
  70. package/dist-lib/react-native-host-modules.cjs +2 -2
  71. package/dist-lib/react-native-host-modules.mjs +1 -1
  72. package/dist-lib/reap-browser.cjs +2 -2
  73. package/dist-lib/scripts/dev-server-scanner.cjs +206 -31
  74. package/dist-lib/sdk.cjs +2 -2
  75. package/dist-lib/sdk.mjs +1 -1
  76. package/dist-lib/skills.cjs +19600 -15992
  77. package/dist-lib/swift-compile.cjs +640 -402
  78. package/dist-lib/swift-compile.mjs +595 -357
  79. package/dist-lib/swift-package.cjs +24 -20
  80. package/dist-lib/swift-package.mjs +23 -19
  81. package/dist-lib/swift-submit.cjs +2 -2
  82. package/dist-lib/swift-submit.mjs +1 -1
  83. package/dist-lib/swift-toolchain.cjs +31 -4
  84. package/dist-lib/swift.cjs +2 -2
  85. package/dist-lib/vite-swift.cjs +1559 -1208
  86. package/dist-lib/vite.cjs +251 -42
  87. package/dist-lib/worklet-executable.cjs +2 -2
  88. package/dist-lib/worklet-executable.mjs +1 -1
  89. package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -1
  90. package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
  91. package/dist-types/packages/peach-engine/src/engine/scroll-pan-contacts.d.ts +3 -1
  92. package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +7 -0
  93. package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -1
  94. package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
  95. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
  96. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +1 -0
  97. package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +17 -0
  98. package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +2 -1
  99. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +3 -0
  100. package/dist-types/packages/peach-globals/src/cameraBridgeContract.d.ts +1 -0
  101. package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +1 -0
  102. package/dist-types/packages/peach-globals/src/shellHostBridgeContract.d.ts +3 -0
  103. package/dist-types/packages/peach-kit/src/materials/types.d.ts +1 -0
  104. package/package.json +1 -1
  105. package/runtime-companion.json +1 -1
  106. package/scripts/dev-server-scanner.ts +4 -0
  107. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h +2282 -0
  108. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/BasicImageTypes.h +55 -0
  109. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h +10551 -6
  110. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h +4236 -3
  111. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h +827 -8
  112. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Histogram.h +1369 -0
  113. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Morphology.h +1243 -0
  114. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Transform.h +1747 -0
  115. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h +291 -2
  116. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_CVUtilities.h +1283 -0
  117. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h +811 -91
  118. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h +1342 -25
  119. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns.h +2738 -0
  120. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_constants.h +1685 -0
  121. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_graph.h +913 -0
  122. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_structures.h +1917 -0
  123. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/LinearAlgebra.h +23 -0
  124. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/arithmetic.h +209 -0
  125. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/base.h +104 -0
  126. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/linear_systems.h +77 -0
  127. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/matrix.h +554 -0
  128. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/norms.h +58 -0
  129. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/object.h +186 -0
  130. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/splat.h +86 -0
  131. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/vector.h +364 -0
  132. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Integration.h +195 -0
  133. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Quadrature.h +44 -0
  134. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/BLAS.h +2330 -0
  135. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/Types.h +123 -0
  136. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Solve.h +8339 -0
  137. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementation.h +520 -0
  138. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementationTyped.h +1893 -0
  139. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Sparse.h +10 -0
  140. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/blas_new.h +1098 -0
  141. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h +859 -0
  142. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas_new.h +1134 -0
  143. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/clapack.h +10555 -0
  144. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/fortran_blas.h +695 -0
  145. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack.h +38526 -0
  146. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_types.h +60 -0
  147. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_version.h +20 -0
  148. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/thread_api.h +50 -0
  149. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBasicOps.h +1218 -0
  150. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBigNum.h +1458 -0
  151. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP.h +10377 -0
  152. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP_translate.h +167 -0
  153. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vForce.h +1243 -0
  154. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLib.h +114 -0
  155. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLibTypes.h +146 -0
  156. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vectorOps.h +1106 -0
  157. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vfp.h +294 -0
  158. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h +25 -1
  159. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h +673 -0
  160. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h +232 -0
  161. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h +827 -0
  162. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h +121 -0
  163. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCharacterSet.h +387 -0
  164. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFData.h +79 -0
  165. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDate.h +122 -0
  166. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h +674 -0
  167. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFError.h +182 -0
  168. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFLocale.h +213 -0
  169. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNotificationCenter.h +82 -0
  170. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNumber.h +129 -0
  171. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSet.h +491 -0
  172. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +883 -2
  173. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFTimeZone.h +98 -0
  174. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +11 -229
  175. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +2 -6
  176. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +2 -1
  177. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +1 -0
  178. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecBase.h +906 -3
  179. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h +613 -0
  180. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecItem.h +1284 -29
  181. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecPolicy.h +441 -0
  182. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecTrust.h +845 -0
  183. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/Security.h +4 -0
  184. package/sdk/ios/usr/include/AvailabilityMacros.h +3985 -0
  185. package/sdk/ios/usr/include/copyfile.h +143 -0
  186. package/sdk/ios/usr/include/malloc/_malloc.h +143 -0
  187. package/sdk/ios/usr/include/malloc/_malloc_type.h +153 -0
  188. package/sdk/ios/usr/include/malloc/_platform.h +80 -0
  189. package/sdk/ios/usr/include/malloc/_ptrcheck.h +43 -0
  190. package/sdk/ios/usr/include/malloc/malloc.h +768 -0
  191. package/sdk/ios/usr/include/os/availability.h +168 -6
  192. package/sdk/ios/usr/include/os/base.h +351 -0
  193. package/sdk/ios/usr/include/os/clock.h +18 -0
  194. package/sdk/ios/usr/include/os/lock.h +232 -10
  195. package/sdk/ios/usr/include/os/log.h +521 -38
  196. package/sdk/ios/usr/include/os/object.h +320 -3
  197. package/sdk/ios/usr/include/os/trace.h +492 -0
  198. package/sdk/ios/usr/include/os/trace_base.h +167 -0
  199. package/sdk/ios/usr/include/os/workgroup.h +37 -0
  200. package/sdk/ios/usr/include/os/workgroup_base.h +91 -0
  201. package/sdk/ios/usr/include/os/workgroup_interval.h +156 -0
  202. package/sdk/ios/usr/include/os/workgroup_object.h +359 -0
  203. package/sdk/ios/usr/include/os/workgroup_parallel.h +76 -0
  204. package/sdk/ios/usr/include/sys/cdefs.h +38 -0
  205. package/sdk/ios/wasm/include/unistd.h +3 -0
  206. package/skills/contrast/SKILL.md +3 -0
  207. package/src/codex-client.ts +11 -6
  208. package/src/dev-bundle-resolution.ts +124 -48
  209. package/src/expo-native-workspace.ts +176 -0
  210. package/src/expo-swift-host.ts +161 -26
  211. package/src/expo-swift-ready.ts +14 -28
  212. package/src/expoSwiftContract.ts +4 -1
  213. package/src/generated/swift-c-predefines.json +68 -12
  214. package/src/host/bridge-host.ts +5 -0
  215. package/src/installed-package-versions.ts +14 -1
  216. package/src/metro-project-root.ts +44 -33
  217. package/src/native-app-identity-project.ts +1 -0
  218. package/src/nitro-adapter.lock.json +916 -10
  219. package/src/nitro-adapter.ts +33 -24
  220. package/src/nitro-bundle.ts +108 -22
  221. package/src/nitro-compile.ts +32 -5
  222. package/src/nitro-source.ts +13 -3
  223. package/src/nitroAdapterContract.ts +100 -20
  224. package/src/node-http-fetch.ts +116 -0
  225. package/src/packageVersionsContract.ts +46 -0
  226. package/src/serverDiscoveryContract.ts +1 -0
  227. package/src/settingsContract.ts +0 -30
  228. package/src/swift-binary-modules.ts +20 -5
  229. package/src/swift-compile.ts +168 -48
  230. package/src/swift-coverage/xcode-assets.ts +4 -3
  231. package/src/swift-host.ts +14 -3
  232. package/src/swift-objc-compile.ts +32 -5
  233. package/src/swift-objc-metadata.ts +2 -2
  234. package/src/swift-objc-platform.ts +2 -2
  235. package/src/swift-objc-standin.ts +43 -13
  236. package/src/swift-package.ts +33 -26
  237. package/src/swift-source-pods.ts +126 -41
  238. package/src/swift-standin-digest.ts +77 -0
  239. package/src/swift-standin-emit.ts +40 -4
  240. package/src/swift-standins.ts +68 -19
  241. package/src/swift-toolchain.ts +38 -0
  242. package/src/swiftContract.ts +8 -0
  243. package/src/vite-plugin.ts +0 -10
  244. package/src/xcode-project.ts +62 -42
  245. package/src/settings-flags.ts +0 -107
@@ -0,0 +1,845 @@
1
+ /*
2
+ * Copyright (c) 2002-2021 Apple Inc. All Rights Reserved.
3
+ *
4
+ * @APPLE_LICENSE_HEADER_START@
5
+ *
6
+ * This file contains Original Code and/or Modifications of Original Code
7
+ * as defined in and that are subject to the Apple Public Source License
8
+ * Version 2.0 (the 'License'). You may not use this file except in
9
+ * compliance with the License. Please obtain a copy of the License at
10
+ * http://www.opensource.apple.com/apsl/ and read it before using this
11
+ * file.
12
+ *
13
+ * The Original Code and all software distributed under the License are
14
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18
+ * Please see the License for the specific language governing rights and
19
+ * limitations under the License.
20
+ *
21
+ * @APPLE_LICENSE_HEADER_END@
22
+ */
23
+
24
+ /*!
25
+ @header SecTrust
26
+ The functions and data types in SecTrust implement trust computation
27
+ and allow the caller to apply trust decisions to the evaluation.
28
+ */
29
+
30
+ #ifndef _SECURITY_SECTRUST_H_
31
+ #define _SECURITY_SECTRUST_H_
32
+
33
+ #include <Security/SecBase.h>
34
+ #include <CoreFoundation/CoreFoundation.h>
35
+ #include <AvailabilityMacros.h>
36
+ #include <Availability.h>
37
+
38
+ #if TARGET_OS_OSX
39
+ #include <Security/cssmtype.h>
40
+ #include <Security/cssmapple.h>
41
+ #endif
42
+
43
+ __BEGIN_DECLS
44
+
45
+ CF_ASSUME_NONNULL_BEGIN
46
+ CF_IMPLICIT_BRIDGING_ENABLED
47
+
48
+ /*!
49
+ @typedef SecTrustResultType
50
+ @abstract Specifies the trust result type.
51
+ @discussion SecTrustResultType results have two dimensions. They specify
52
+ both whether evaluation succeeded and whether this is because of a user
53
+ decision. The commonly expected result is kSecTrustResultUnspecified,
54
+ which indicates a positive result that wasn't decided by the user. The
55
+ common failure is kSecTrustResultRecoverableTrustFailure, which means a
56
+ negative result. kSecTrustResultProceed and kSecTrustResultDeny are the
57
+ positive and negative result respectively when decided by the user. User
58
+ decisions are persisted through the use of SecTrustCopyExceptions() and
59
+ SecTrustSetExceptions(). Finally, kSecTrustResultFatalTrustFailure is a
60
+ negative result that must not be circumvented.
61
+ @constant kSecTrustResultInvalid Indicates an invalid setting or result.
62
+ This result usually means that SecTrustEvaluate has not yet been called.
63
+ @constant kSecTrustResultProceed Indicates you may proceed. This value
64
+ may be returned by the SecTrustEvaluate function or stored as part of
65
+ the user trust settings.
66
+ @constant kSecTrustResultConfirm Indicates confirmation with the user
67
+ is required before proceeding. Important: this value is no longer returned
68
+ or supported by SecTrustEvaluate or the SecTrustSettings API starting in
69
+ OS X 10.5; its use is deprecated in OS X 10.9 and later, as well as in iOS.
70
+ @constant kSecTrustResultDeny Indicates a user-configured deny; do not
71
+ proceed. This value may be returned by the SecTrustEvaluate function
72
+ or stored as part of the user trust settings.
73
+ @constant kSecTrustResultUnspecified Indicates the evaluation succeeded
74
+ and the certificate is implicitly trusted, but user intent was not
75
+ explicitly specified. This value may be returned by the SecTrustEvaluate
76
+ function or stored as part of the user trust settings.
77
+ @constant kSecTrustResultRecoverableTrustFailure Indicates a trust policy
78
+ failure which can be overridden by the user. This value may be returned
79
+ by the SecTrustEvaluate function but not stored as part of the user
80
+ trust settings.
81
+ @constant kSecTrustResultFatalTrustFailure Indicates a trust failure
82
+ which cannot be overridden by the user. This value may be returned by the
83
+ SecTrustEvaluate function but not stored as part of the user trust
84
+ settings.
85
+ @constant kSecTrustResultOtherError Indicates a failure other than that
86
+ of trust evaluation. This value may be returned by the SecTrustEvaluate
87
+ function but not stored as part of the user trust settings.
88
+ */
89
+ typedef CF_ENUM(uint32_t, SecTrustResultType) {
90
+ kSecTrustResultInvalid CF_ENUM_AVAILABLE(10_3, 2_0) = 0,
91
+ kSecTrustResultProceed CF_ENUM_AVAILABLE(10_3, 2_0) = 1,
92
+ kSecTrustResultConfirm CF_ENUM_DEPRECATED(10_3, 10_9, 2_0, 7_0) = 2,
93
+ kSecTrustResultDeny CF_ENUM_AVAILABLE(10_3, 2_0) = 3,
94
+ kSecTrustResultUnspecified CF_ENUM_AVAILABLE(10_3, 2_0) = 4,
95
+ kSecTrustResultRecoverableTrustFailure CF_ENUM_AVAILABLE(10_3, 2_0) = 5,
96
+ kSecTrustResultFatalTrustFailure CF_ENUM_AVAILABLE(10_3, 2_0) = 6,
97
+ kSecTrustResultOtherError CF_ENUM_AVAILABLE(10_3, 2_0) = 7
98
+ };
99
+
100
+ /*!
101
+ @typedef SecTrustRef
102
+ @abstract CFType used for performing X.509 certificate trust evaluations.
103
+ */
104
+ typedef struct CF_BRIDGED_TYPE(id) __SecTrust *SecTrustRef;
105
+
106
+ /*!
107
+ @enum Trust Property Constants
108
+ @discussion Predefined key constants used to obtain values in a
109
+ per-certificate dictionary of trust evaluation results,
110
+ as retrieved from a call to SecTrustCopyProperties.
111
+ @constant kSecPropertyTypeTitle Specifies a key whose value is a
112
+ CFStringRef containing the title (display name) of this certificate.
113
+ @constant kSecPropertyTypeError Specifies a key whose value is a
114
+ CFStringRef containing the reason for a trust evaluation failure.
115
+ */
116
+ extern const CFStringRef kSecPropertyTypeTitle
117
+ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_7_0);
118
+ extern const CFStringRef kSecPropertyTypeError
119
+ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_7_0);
120
+
121
+ /*!
122
+ @enum Trust Result Constants
123
+ @discussion Predefined key constants used to obtain values in a
124
+ dictionary of trust evaluation results for a certificate chain,
125
+ as retrieved from a call to SecTrustCopyResult.
126
+ @constant kSecTrustEvaluationDate
127
+ This key will be present if a trust evaluation has been performed
128
+ and results are available. Its value is a CFDateRef representing
129
+ when the evaluation for this trust object took place.
130
+ @constant kSecTrustExtendedValidation
131
+ This key will be present and have a value of kCFBooleanTrue
132
+ if this chain was validated for EV.
133
+ @constant kSecTrustOrganizationName
134
+ Organization name field of subject of leaf certificate. This
135
+ field is meant to be displayed to the user as the validated
136
+ name of the company or entity that owns the certificate if the
137
+ kSecTrustExtendedValidation key is present.
138
+ @constant kSecTrustQCStatements
139
+ This key will be present and have a value of CFStringRef if
140
+ the leaf certificate contains qualified certificate statements.
141
+ The string can be displayed to the user as a representation
142
+ of a qualified certificate's purpose.
143
+ @constant kSecTrustQWACValidation
144
+ This key will be present and have a value of kCFBooleanTrue
145
+ if this chain was successfully validated as a Qualified Website
146
+ Authentication Certificate.
147
+ @constant kSecTrustResultValue
148
+ This key will be present if a trust evaluation has been performed.
149
+ Its value is a CFNumberRef representing the SecTrustResultType result
150
+ for the evaluation.
151
+ @constant kSecTrustRevocationChecked
152
+ This key will be present iff this chain had its revocation checked.
153
+ The value will be a kCFBooleanTrue if revocation checking was
154
+ successful and none of the certificates in the chain were revoked.
155
+ The value will be kCFBooleanFalse if no current revocation status
156
+ could be obtained for one or more certificates in the chain due
157
+ to connection problems or timeouts. This is a hint to a client
158
+ to retry revocation checking at a later time.
159
+ @constant kSecTrustRevocationValidUntilDate
160
+ This key will be present iff kSecTrustRevocationChecked has a
161
+ value of kCFBooleanTrue. The value will be a CFDateRef representing
162
+ the earliest date at which the revocation info for one of the
163
+ certificates in this chain might change.
164
+ @constant kSecTrustCertificateTransparency
165
+ This key will be present and have a value of kCFBooleanTrue
166
+ if this chain is CT qualified.
167
+ @constant kSecTrustCertificateTransparencyWhiteList
168
+ This key will be present and have a value of kCFBooleanTrue
169
+ if this chain is EV, but not CT qualified, and is permitted
170
+ as an exception to CT policy requirements.
171
+ Note: in macOS 10.12 and iOS 10, previously-issued EV certificates
172
+ were considered exempt from the CT requirement. As those certificates
173
+ expired, exempting them was no longer needed. This key is deprecated
174
+ in macOS 10.13 and iOS 11, and is no longer returned in the trust
175
+ results dictionary as of those releases.
176
+ */
177
+ extern const CFStringRef kSecTrustEvaluationDate
178
+ __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
179
+ extern const CFStringRef kSecTrustExtendedValidation
180
+ __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
181
+ extern const CFStringRef kSecTrustOrganizationName
182
+ __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
183
+ extern const CFStringRef kSecTrustResultValue
184
+ __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
185
+ extern const CFStringRef kSecTrustRevocationChecked
186
+ __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
187
+ extern const CFStringRef kSecTrustRevocationValidUntilDate
188
+ __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
189
+ extern const CFStringRef kSecTrustCertificateTransparency
190
+ __OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0);
191
+ extern const CFStringRef kSecTrustCertificateTransparencyWhiteList
192
+ __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_12, __MAC_10_13, __IPHONE_10_0, __IPHONE_11_0);
193
+ extern const CFStringRef kSecTrustQCStatements
194
+ API_AVAILABLE(macos(15.4), ios(18.4), tvos(18.4), watchos(11.4));
195
+ extern const CFStringRef kSecTrustQWACValidation
196
+ API_AVAILABLE(macos(15.4), ios(18.4), tvos(18.4), watchos(11.4));
197
+
198
+ #ifdef __BLOCKS__
199
+ /*!
200
+ @typedef SecTrustCallback
201
+ @abstract Delivers the result from an asynchronous trust evaluation.
202
+ @param trustRef A reference to the trust object which has been evaluated.
203
+ @param trustResult The trust result of the evaluation. Additional status
204
+ information can be obtained by calling SecTrustCopyProperties().
205
+ */
206
+ typedef void (^SecTrustCallback)(SecTrustRef trustRef, SecTrustResultType trustResult);
207
+ #endif /* __BLOCKS__ */
208
+
209
+
210
+ /*!
211
+ @function SecTrustGetTypeID
212
+ @abstract Returns the type identifier of SecTrust instances.
213
+ @result The CFTypeID of SecTrust instances.
214
+ */
215
+ CFTypeID SecTrustGetTypeID(void)
216
+ __OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0);
217
+
218
+ /*!
219
+ @function SecTrustCreateWithCertificates
220
+ @abstract Creates a trust object based on the given certificates and
221
+ policies.
222
+ @param certificates The group of certificates to verify. This can either
223
+ be a CFArrayRef of SecCertificateRef objects or a single SecCertificateRef
224
+ @param policies An array of one or more policies. You may pass a
225
+ SecPolicyRef to represent a single policy.
226
+ @param trust On return, a pointer to the trust management reference.
227
+ @result A result code. See "Security Error Codes" (SecBase.h).
228
+ @discussion If multiple policies are passed in, all policies must verify
229
+ for the chain to be considered valid.
230
+ */
231
+ OSStatus SecTrustCreateWithCertificates(CFTypeRef certificates,
232
+ CFTypeRef __nullable policies, SecTrustRef * __nonnull CF_RETURNS_RETAINED trust)
233
+ __OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0);
234
+
235
+ /*!
236
+ @function SecTrustSetPolicies
237
+ @abstract Set the policies for which trust should be verified.
238
+ @param trust A trust reference.
239
+ @param policies An array of one or more policies. You may pass a
240
+ SecPolicyRef to represent a single policy.
241
+ @result A result code. See "Security Error Codes" (SecBase.h).
242
+ @discussion This function will invalidate the existing trust result,
243
+ requiring a fresh evaluation for the newly-set policies.
244
+ */
245
+ OSStatus SecTrustSetPolicies(SecTrustRef trust, CFTypeRef policies)
246
+ __OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_6_0);
247
+
248
+ /*!
249
+ @function SecTrustCopyPolicies
250
+ @abstract Returns an array of policies used for this evaluation.
251
+ @param trust A reference to a trust object.
252
+ @param policies On return, an array of policies used by this trust.
253
+ Call the CFRelease function to release this reference.
254
+ @result A result code. See "Security Error Codes" (SecBase.h).
255
+ */
256
+ OSStatus SecTrustCopyPolicies(SecTrustRef trust, CFArrayRef * __nonnull CF_RETURNS_RETAINED policies)
257
+ __OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_7_0);
258
+
259
+ /*!
260
+ @function SecTrustSetNetworkFetchAllowed
261
+ @abstract Specifies whether a trust evaluation is permitted to fetch missing
262
+ intermediate certificates from the network.
263
+ @param trust A trust reference.
264
+ @param allowFetch If true, and a certificate's issuer is not present in the
265
+ trust reference but its network location is known, the evaluation is permitted
266
+ to attempt to download it automatically. Pass false to disable network fetch
267
+ for this trust evaluation.
268
+ @result A result code. See "Security Error Codes" (SecBase.h).
269
+ @discussion By default, network fetch of missing certificates is enabled if
270
+ the trust evaluation includes the SSL policy, otherwise it is disabled.
271
+ */
272
+ OSStatus SecTrustSetNetworkFetchAllowed(SecTrustRef trust,
273
+ Boolean allowFetch)
274
+ __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
275
+
276
+ /*!
277
+ @function SecTrustGetNetworkFetchAllowed
278
+ @abstract Returns whether a trust evaluation is permitted to fetch missing
279
+ intermediate certificates from the network.
280
+ @param trust A trust reference.
281
+ @param allowFetch On return, the boolean pointed to by this parameter is
282
+ set to true if the evaluation is permitted to download missing certificates.
283
+ @result A result code. See "Security Error Codes" (SecBase.h).
284
+ @discussion By default, network fetch of missing certificates is enabled if
285
+ the trust evaluation includes the SSL policy, otherwise it is disabled.
286
+ */
287
+ OSStatus SecTrustGetNetworkFetchAllowed(SecTrustRef trust,
288
+ Boolean *allowFetch)
289
+ __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
290
+
291
+ /*!
292
+ @function SecTrustSetAnchorCertificates
293
+ @abstract Sets the anchor certificates for a given trust.
294
+ @param trust A reference to a trust object.
295
+ @param anchorCertificates An array of anchor certificates.
296
+ Pass NULL to restore the default set of anchor certificates.
297
+ @result A result code. See "Security Error Codes" (SecBase.h).
298
+ @discussion Calling this function without also calling
299
+ SecTrustSetAnchorCertificatesOnly() will disable trusting any
300
+ anchors other than the ones in anchorCertificates.
301
+ */
302
+ OSStatus SecTrustSetAnchorCertificates(SecTrustRef trust,
303
+ CFArrayRef __nullable anchorCertificates)
304
+ __OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0);
305
+
306
+ /*!
307
+ @function SecTrustSetAnchorCertificatesOnly
308
+ @abstract Reenables trusting anchor certificates in addition to those
309
+ passed in via the SecTrustSetAnchorCertificates API.
310
+ @param trust A reference to a trust object.
311
+ @param anchorCertificatesOnly If true, disables trusting any anchors other
312
+ than the ones passed in via SecTrustSetAnchorCertificates(). If false,
313
+ the built in anchor certificates are also trusted.
314
+ @result A result code. See "Security Error Codes" (SecBase.h).
315
+ */
316
+ OSStatus SecTrustSetAnchorCertificatesOnly(SecTrustRef trust,
317
+ Boolean anchorCertificatesOnly)
318
+ __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_2_0);
319
+
320
+ /*!
321
+ @function SecTrustCopyCustomAnchorCertificates
322
+ @abstract Returns an array of custom anchor certificates used by a given
323
+ trust, as set by a prior call to SecTrustSetAnchorCertificates, or NULL if
324
+ no custom anchors have been specified.
325
+ @param trust A reference to a trust object.
326
+ @param anchors On return, an array of custom anchor certificates (roots)
327
+ used by this trust, or NULL if no custom anchors have been specified. Call
328
+ the CFRelease function to release this reference.
329
+ @result A result code. See "Security Error Codes" (SecBase.h).
330
+ */
331
+ OSStatus SecTrustCopyCustomAnchorCertificates(SecTrustRef trust,
332
+ CFArrayRef * __nonnull CF_RETURNS_RETAINED anchors)
333
+ __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_7_0);
334
+
335
+ /*!
336
+ @function SecTrustSetVerifyDate
337
+ @abstract Set the date for which the trust should be verified.
338
+ @param trust A reference to a trust object.
339
+ @param verifyDate The date for which to verify trust.
340
+ @result A result code. See "Security Error Codes" (SecBase.h).
341
+ @discussion This function lets you evaluate certificate validity for a
342
+ given date (for example, to determine if a signature was valid on the date
343
+ it was signed, even if the certificate has since expired.) If this function
344
+ is not called, the time at which SecTrustEvaluate() is called is used
345
+ implicitly as the verification time.
346
+ */
347
+ OSStatus SecTrustSetVerifyDate(SecTrustRef trust, CFDateRef verifyDate)
348
+ __OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0);
349
+
350
+ /*!
351
+ @function SecTrustGetVerifyTime
352
+ @abstract Returns the verify time.
353
+ @param trust A reference to the trust object being verified.
354
+ @result A CFAbsoluteTime value representing the time at which certificates
355
+ should be checked for validity.
356
+ @discussion This function retrieves the verification time for the given
357
+ trust reference, as set by a prior call to SecTrustSetVerifyDate(). If the
358
+ verification time has not been set, this function returns a value of 0,
359
+ indicating that the current date/time is implicitly used for verification.
360
+ */
361
+ CFAbsoluteTime SecTrustGetVerifyTime(SecTrustRef trust)
362
+ __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_2_0);
363
+
364
+ /*!
365
+ @function SecTrustEvaluate
366
+ @abstract Evaluates a trust reference synchronously.
367
+ @param trust A reference to the trust object to evaluate.
368
+ @param result A pointer to a result type.
369
+ @result A result code. See "Security Error Codes" (SecBase.h).
370
+ @discussion This function will completely evaluate trust before returning,
371
+ possibly including network access to fetch intermediate certificates or to
372
+ perform revocation checking. Since this function can block during those
373
+ operations, you should call it from within a function that is placed on a
374
+ dispatch queue, or in a separate thread from your application's main
375
+ run loop. Alternatively, you can use the SecTrustEvaluateAsync function.
376
+ */
377
+ OSStatus SecTrustEvaluate(SecTrustRef trust, SecTrustResultType *result)
378
+ API_DEPRECATED_WITH_REPLACEMENT("SecTrustEvaluateWithError",
379
+ macos(10.3, 10.15),
380
+ ios(2.0, 13.0),
381
+ watchos(1.0, 6.0),
382
+ tvos(2.0, 13.0));
383
+
384
+ #ifdef __BLOCKS__
385
+ /*!
386
+ @function SecTrustEvaluateAsync
387
+ @abstract Evaluates a trust reference asynchronously.
388
+ @param trust A reference to the trust object to evaluate.
389
+ @param queue A dispatch queue on which the result callback should be
390
+ executed. Pass NULL to use the current dispatch queue.
391
+ @param result A SecTrustCallback block which will be executed when the
392
+ trust evaluation is complete.
393
+ @result A result code. See "Security Error Codes" (SecBase.h).
394
+ */
395
+ OSStatus SecTrustEvaluateAsync(SecTrustRef trust,
396
+ dispatch_queue_t __nullable queue, SecTrustCallback result)
397
+ API_DEPRECATED_WITH_REPLACEMENT("SecTrustEvaluateAsyncWithError",
398
+ macos(10.7, 10.15),
399
+ ios(7.0, 13.0),
400
+ watchos(1.0, 6.0),
401
+ tvos(7.0, 13.0));
402
+ #endif
403
+
404
+ /*!
405
+ @function SecTrustEvaluateWithError
406
+ @abstract Evaluates a trust reference synchronously.
407
+ @param trust A reference to the trust object to evaluate.
408
+ @param error A pointer to an error object
409
+ @result A boolean value indicating whether the certificate is trusted
410
+ @discussion This function will completely evaluate trust before returning,
411
+ possibly including network access to fetch intermediate certificates or to
412
+ perform revocation checking. Since this function can block during those
413
+ operations, you should call it from within a function that is placed on a
414
+ dispatch queue, or in a separate thread from your application's main
415
+ run loop.
416
+ If the certificate is trusted and the result is true, the error will be set to NULL.
417
+ If the certificate is not trusted or the evaluation was unable to complete, the result
418
+ will be false and the error will be set with a description of the failure.
419
+ The error contains a code for the most serious error encountered (if multiple trust
420
+ failures occurred). The localized description indicates the certificate with the most
421
+ serious problem and the type of error. The underlying error contains a localized
422
+ description of each certificate in the chain that had an error and all errors found
423
+ with that certificate.
424
+ */
425
+ __attribute__((warn_unused_result)) bool
426
+ SecTrustEvaluateWithError(SecTrustRef trust, CFErrorRef _Nullable * _Nullable CF_RETURNS_RETAINED error)
427
+ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0));
428
+
429
+ #ifdef __BLOCKS__
430
+ /*!
431
+ @typedef SecTrustWithErrorCallback
432
+ @abstract Delivers the result from an asynchronous trust evaluation.
433
+ @param trustRef A reference to the trust object which has been evaluated.
434
+ @param result A boolean value indicating whether the certificate is trusted.
435
+ @param error An error if the trust evaluation failed.
436
+ */
437
+ typedef void (^SecTrustWithErrorCallback)(SecTrustRef trustRef, bool result, CFErrorRef _Nullable error);
438
+
439
+ /*!
440
+ @function SecTrustEvaluateAsyncWithError
441
+ @abstract Evaluates a trust reference asynchronously.
442
+ @param trust A reference to the trust object to evaluate.
443
+ @param queue A dispatch queue on which the result callback will be executed. Note that this
444
+ function MUST be called from that queue.
445
+ @param result A SecTrustWithErrorCallback block which will be executed when the trust evaluation
446
+ is complete.
447
+ The block is guaranteed to be called exactly once when the result code is errSecSuccess, and not
448
+ called otherwise. Note that this block may be called synchronously inline if no asynchronous
449
+ operations are required.
450
+ @result A result code. See "Security Error Codes" (SecBase.h).
451
+ @discussion If the certificate is trusted, the callback will return a result parameter of true
452
+ and the error will be set to NULL.
453
+ If the certificate is not trusted or the evaluation was unable to complete, the result parameter
454
+ will be false and the error will be set with a description of the failure. The error contains a
455
+ code for the most serious error encountered (if multiple trust failures occurred). The localized
456
+ description indicates the certificate with the most serious problem and the type of error. The
457
+ underlying error contains a localized description of each certificate in the chain that had an
458
+ error and all errors found with that certificate.
459
+ */
460
+ OSStatus SecTrustEvaluateAsyncWithError(SecTrustRef trust, dispatch_queue_t queue, SecTrustWithErrorCallback result)
461
+ API_AVAILABLE(macos(10.15), ios(13.0), tvos(13.0), watchos(6.0));
462
+ #endif /* __BLOCKS__ */
463
+
464
+ /*!
465
+ @function SecTrustGetTrustResult
466
+ @param trust A reference to a trust object.
467
+ @param result A pointer to the result from the most recent call to
468
+ SecTrustEvaluate for this trust reference. If SecTrustEvaluate has not been
469
+ called or trust parameters have changed, the result is kSecTrustResultInvalid.
470
+ @result A result code. See "Security Error Codes" (SecBase.h).
471
+ @discussion This function replaces SecTrustGetResult for the purpose of
472
+ obtaining the current evaluation result of a given trust reference.
473
+ */
474
+ OSStatus SecTrustGetTrustResult(SecTrustRef trust,
475
+ SecTrustResultType *result)
476
+ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_7_0);
477
+
478
+ /*!
479
+ @function SecTrustCopyPublicKey
480
+ @abstract Return the public key for a leaf certificate after it has
481
+ been evaluated.
482
+ @param trust A reference to the trust object which has been evaluated.
483
+ @result The certificate's public key, or NULL if it the public key could
484
+ not be extracted (this can happen if the public key algorithm is not
485
+ supported). The caller is responsible for calling CFRelease on the
486
+ returned key when it is no longer needed.
487
+ */
488
+ __nullable
489
+ SecKeyRef SecTrustCopyPublicKey(SecTrustRef trust)
490
+ API_DEPRECATED_WITH_REPLACEMENT("SecTrustCopyKey", macos(10.7, 11.0), ios(2.0, 14.0), watchos(1.0, 7.0), tvos(9.0, 14.0));
491
+
492
+ /*!
493
+ @function SecTrustCopyKey
494
+ @abstract Return the public key for a leaf certificate after it has
495
+ been evaluated.
496
+ @param trust A reference to the trust object which has been evaluated.
497
+ @result The certificate's public key, or NULL if it the public key could
498
+ not be extracted (this can happen if the public key algorithm is not
499
+ supported). The caller is responsible for calling CFRelease on the
500
+ returned key when it is no longer needed.
501
+ @discussion RSA and ECDSA public keys are supported. All other public key algorithms are unsupported.
502
+ */
503
+ __nullable
504
+ SecKeyRef SecTrustCopyKey(SecTrustRef trust)
505
+ API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0));
506
+
507
+ /*!
508
+ @function SecTrustGetCertificateCount
509
+ @abstract Returns the number of certificates in an evaluated certificate
510
+ chain.
511
+ @param trust A reference to a trust object.
512
+ @result The number of certificates in the trust chain, including the anchor.
513
+ @discussion Important: if the trust reference has not yet been evaluated,
514
+ this function will evaluate it first before returning. If speed is critical,
515
+ you may want to call SecTrustGetTrustResult first to make sure that a
516
+ result other than kSecTrustResultInvalid is present for the trust object.
517
+ */
518
+ CFIndex SecTrustGetCertificateCount(SecTrustRef trust)
519
+ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_2_0);
520
+
521
+ /*!
522
+ @function SecTrustGetCertificateAtIndex
523
+ @abstract Returns a certificate from the trust chain.
524
+ @param trust Reference to a trust object.
525
+ @param ix The index of the requested certificate. Indices run from 0
526
+ (leaf) to the anchor (or last certificate found if no anchor was found).
527
+ The leaf cert (index 0) is always present regardless of whether the trust
528
+ reference has been evaluated or not.
529
+ @result A SecCertificateRef for the requested certificate.
530
+ @discussion This API is fundamentally not thread-safe -- other threads using the same
531
+ trust object may trigger trust evaluations that release the returned certificate or change the
532
+ certificate chain as a thread is iterating through the certificate chain. The replacement function
533
+ SecTrustCopyCertificateChain provides thread-safe results.
534
+ */
535
+ __nullable
536
+ SecCertificateRef SecTrustGetCertificateAtIndex(SecTrustRef trust, CFIndex ix)
537
+ API_DEPRECATED_WITH_REPLACEMENT("SecTrustCopyCertificateChain", macos(10.7, 12.0), ios(2.0, 15.0), watchos(1.0, 8.0), tvos(9.0, 15.0));
538
+
539
+ /*!
540
+ @function SecTrustCopyExceptions
541
+ @abstract Returns an opaque cookie which will allow future evaluations
542
+ of the current certificate to succeed.
543
+ @param trust A reference to an evaluated trust object.
544
+ @result An opaque cookie which when passed to SecTrustSetExceptions() will
545
+ cause a call to SecTrustEvaluate() return kSecTrustResultProceed. This
546
+ will happen upon subsequent evaluation of the current certificate unless
547
+ some new error starts happening that wasn't being reported when the cookie
548
+ was returned from this function (for example, if the certificate expires
549
+ then evaluation will start failing again until a new cookie is obtained.)
550
+ @discussion Normally this API should only be called once the errors have
551
+ been presented to the user and the user decided to trust the current
552
+ certificate chain regardless of the errors being presented, for the
553
+ current application/server/protocol combination.
554
+ */
555
+ __nullable
556
+ CFDataRef SecTrustCopyExceptions(SecTrustRef trust)
557
+ __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_4_0);
558
+
559
+ /*!
560
+ @function SecTrustSetExceptions
561
+ @abstract Set a trust cookie to be used for evaluating this certificate chain.
562
+ @param trust A reference to a trust object.
563
+ @param exceptions An exceptions cookie as returned by a call to
564
+ SecTrustCopyExceptions() in the past. You may pass NULL to clear any
565
+ exceptions which have been previously set on this trust reference.
566
+ @result Upon calling SecTrustEvaluate(), any failures that were present at the
567
+ time the exceptions object was created are ignored, and instead of returning
568
+ kSecTrustResultRecoverableTrustFailure, kSecTrustResultProceed will be returned
569
+ (if the certificate for which exceptions was created matches the current leaf
570
+ certificate).
571
+ @result Returns true if the exceptions cookies was valid and matches the current
572
+ leaf certificate, false otherwise. This function will invalidate the existing
573
+ trust result, requiring a subsequent evaluation for the newly-set exceptions.
574
+ Note that this function returning true doesn't mean the caller can skip calling
575
+ SecTrustEvaluate, as there may be new errors since the exceptions cookie was
576
+ created (for example, a certificate may have subsequently expired.)
577
+ @discussion Clients of this interface will need to establish the context of this
578
+ exception to later decide when this exception cookie is to be used.
579
+ Examples of this context would be the server we are connecting to, the ssid
580
+ of the wireless network for which this cert is needed, the account for which
581
+ this cert should be considered valid, and so on.
582
+ */
583
+ bool SecTrustSetExceptions(SecTrustRef trust, CFDataRef __nullable exceptions)
584
+ __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_4_0);
585
+
586
+ /*!
587
+ @function SecTrustCopyProperties
588
+ @abstract Return a property array for this trust evaluation.
589
+ @param trust A reference to a trust object. If the trust has not been
590
+ evaluated, the returned property array will be empty.
591
+ @result A property array. It is the caller's responsibility to CFRelease
592
+ the returned array when it is no longer needed.
593
+ @discussion On macOS, this function returns an ordered array of CFDictionaryRef
594
+ instances for each certificate in the chain. Indices run from 0 (leaf) to
595
+ the anchor (or last certificate found if no anchor was found.)
596
+ On other platforms, this function returns an unordered array of CFDictionary instances.
597
+ See the "Trust Property Constants" section for a list of currently defined keys.
598
+ The error information conveyed via this interface is also conveyed via the
599
+ returned error of SecTrustEvaluateWithError.
600
+ */
601
+ __nullable
602
+ CFArrayRef SecTrustCopyProperties(SecTrustRef trust)
603
+ API_DEPRECATED_WITH_REPLACEMENT("SecTrustEvaluateWithError", macos(10.7, 12.0), ios(2.0, 15.0), watchos(1.0, 8.0), tvos(9.0, 15.0)) API_UNAVAILABLE(macCatalyst);
604
+
605
+ /*!
606
+ @function SecTrustCopyResult
607
+ @abstract Returns a dictionary containing information about the
608
+ evaluated certificate chain for use by clients.
609
+ @param trust A reference to a trust object.
610
+ @result A dictionary with various fields that can be displayed to the user,
611
+ or NULL if no additional info is available or the trust has not yet been
612
+ validated. The caller is responsible for calling CFRelease on the value
613
+ returned when it is no longer needed.
614
+ @discussion Returns a dictionary for the overall trust evaluation. See the
615
+ "Trust Result Constants" section for a list of currently defined keys.
616
+ */
617
+ __nullable
618
+ CFDictionaryRef SecTrustCopyResult(SecTrustRef trust)
619
+ __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
620
+
621
+ /*!
622
+ @function SecTrustSetOCSPResponse
623
+ @abstract Attach OCSPResponse data to a trust object.
624
+ @param trust A reference to a trust object.
625
+ @param responseData This may be either a CFData object containing a single
626
+ DER-encoded OCSPResponse (per RFC 2560), or a CFArray of these.
627
+ @result A result code. See "Security Error Codes" (SecBase.h).
628
+ @discussion Allows the caller to provide OCSPResponse data (which may be
629
+ obtained during a TLS/SSL handshake, per RFC 3546) as input to a trust
630
+ evaluation. If this data is available, it can obviate the need to contact
631
+ an OCSP server for current revocation information.
632
+ */
633
+ OSStatus SecTrustSetOCSPResponse(SecTrustRef trust, CFTypeRef __nullable responseData)
634
+ __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
635
+
636
+ /*!
637
+ @function SecTrustSignedCertificateTimestamps
638
+ @abstract Attach SignedCertificateTimestamp data to a trust object.
639
+ @param trust A reference to a trust object.
640
+ @param sctArray is a CFArray of CFData objects each containing a SCT (per RFC 6962).
641
+ @result A result code. See "Security Error Codes" (SecBase.h).
642
+ @discussion Allows the caller to provide SCT data (which may be
643
+ obtained during a TLS/SSL handshake, per RFC 6962) as input to a trust
644
+ evaluation.
645
+ */
646
+ OSStatus SecTrustSetSignedCertificateTimestamps(SecTrustRef trust, CFArrayRef __nullable sctArray)
647
+ API_AVAILABLE(macos(10.14.2), ios(12.1.1), tvos(12.1.1), watchos(5.1.1));
648
+
649
+ /*!
650
+ @function SecTrustCopyCertificateChain
651
+ @abstract Returns the certificate trust chain
652
+ @param trust Reference to a trust object.
653
+ @result A CFArray of the SecCertificateRefs for the resulting certificate chain
654
+ */
655
+ _Nullable CF_RETURNS_RETAINED
656
+ CFArrayRef SecTrustCopyCertificateChain(SecTrustRef trust)
657
+ API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0));
658
+
659
+ CF_IMPLICIT_BRIDGING_DISABLED
660
+ CF_ASSUME_NONNULL_END
661
+
662
+ /*
663
+ * Legacy functions (macOS only)
664
+ */
665
+ #if TARGET_OS_OSX
666
+
667
+ CF_ASSUME_NONNULL_BEGIN
668
+ CF_IMPLICIT_BRIDGING_ENABLED
669
+
670
+ /*!
671
+ @typedef SecTrustUserSetting
672
+ @abstract Specifies a user-specified trust setting value.
673
+ @discussion Deprecated in OS X 10.9. User trust settings are managed by
674
+ functions in SecTrustSettings.h (starting with OS X 10.5), and by the
675
+ SecTrustCopyExceptions and SecTrustSetExceptions functions (starting with
676
+ iOS 4 and OS X 10.9). The latter two functions are recommended for both macOS
677
+ and iOS, as they avoid the need to explicitly specify these values.
678
+ */
679
+ typedef SecTrustResultType SecTrustUserSetting
680
+ __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2, __MAC_10_9, __IPHONE_NA, __IPHONE_NA);
681
+
682
+ /*!
683
+ @typedef SecTrustOptionFlags
684
+ @abstract Options for customizing trust evaluation.
685
+ @constant kSecTrustOptionAllowExpired Allow expired certificates.
686
+ @constant kSecTrustOptionLeafIsCA Allow CA as leaf certificate.
687
+ @constant kSecTrustOptionFetchIssuerFromNet Allow network fetch of CA cert.
688
+ @constant kSecTrustOptionAllowExpiredRoot Allow expired roots.
689
+ @constant kSecTrustOptionRequireRevPerCert Require positive revocation
690
+ check per certificate.
691
+ @constant kSecTrustOptionUseTrustSettings Use TrustSettings instead of
692
+ anchors.
693
+ @constant kSecTrustOptionImplicitAnchors Properly self-signed certs are
694
+ treated as anchors implicitly.
695
+ */
696
+ typedef CF_OPTIONS(uint32_t, SecTrustOptionFlags) {
697
+ kSecTrustOptionAllowExpired = 0x00000001,
698
+ kSecTrustOptionLeafIsCA = 0x00000002,
699
+ kSecTrustOptionFetchIssuerFromNet = 0x00000004,
700
+ kSecTrustOptionAllowExpiredRoot = 0x00000008,
701
+ kSecTrustOptionRequireRevPerCert = 0x00000010,
702
+ kSecTrustOptionUseTrustSettings = 0x00000020,
703
+ kSecTrustOptionImplicitAnchors = 0x00000040
704
+ };
705
+
706
+ /*!
707
+ @function SecTrustSetOptions
708
+ @abstract Sets optional flags for customizing a trust evaluation.
709
+ @param trustRef A trust reference.
710
+ @param options Flags to change evaluation behavior for this trust.
711
+ @result A result code. See "Security Error Codes" (SecBase.h).
712
+ @discussion This function is not available on iOS. Use SecTrustSetExceptions
713
+ and SecTrustCopyExceptions to modify default trust results, and
714
+ SecTrustSetNetworkFetchAllowed to specify whether missing CA certificates
715
+ can be fetched from the network.
716
+ */
717
+ OSStatus SecTrustSetOptions(SecTrustRef trustRef, SecTrustOptionFlags options)
718
+ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA);
719
+
720
+ /*!
721
+ @function SecTrustSetParameters
722
+ @abstract Sets the action and action data for a trust object.
723
+ @param trustRef The reference to the trust to change.
724
+ @param action A trust action.
725
+ @param actionData A reference to data associated with this action.
726
+ @result A result code. See "Security Error Codes" (SecBase.h).
727
+ @discussion This function is deprecated in OS X 10.7 and later, where it
728
+ was replaced by SecTrustSetOptions, and is not available on iOS. Your code
729
+ should use SecTrustSetExceptions and SecTrustCopyExceptions to modify default
730
+ trust results, and SecTrustSetNetworkFetchAllowed to specify whether missing
731
+ CA certificates can be fetched from the network.
732
+ */
733
+ OSStatus SecTrustSetParameters(SecTrustRef trustRef,
734
+ CSSM_TP_ACTION action, CFDataRef actionData)
735
+ __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2, __MAC_10_7, __IPHONE_NA, __IPHONE_NA);
736
+
737
+ /*!
738
+ @function SecTrustSetKeychains
739
+ @abstract Sets the keychains for a given trust object.
740
+ @param trust A reference to a trust object.
741
+ @param keychainOrArray A reference to an array of keychains to search, a
742
+ single keychain, or NULL to use the default keychain search list.
743
+ @result A result code. See "Security Error Codes" (SecBase.h).
744
+ @discussion This function is deprecated in macOS 10.13 and later. Beginning in
745
+ macOS 10.12, this function no longer affected the behavior of the trust
746
+ evaluation: the user's keychain search list and the system
747
+ anchors keychain are searched for certificates to complete the chain. To change
748
+ the keychains that are searched, callers must use SecKeychainSetSearchList to
749
+ change the user's keychain search list.
750
+ Note: this function was never applicable to iOS.
751
+ */
752
+ OSStatus SecTrustSetKeychains(SecTrustRef trust, CFTypeRef __nullable keychainOrArray)
753
+ __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_3, __MAC_10_13, __IPHONE_NA, __IPHONE_NA);
754
+
755
+ /*!
756
+ @function SecTrustGetResult
757
+ @abstract Returns detailed information on the outcome of an evaluation.
758
+ @param trustRef A reference to a trust object.
759
+ @param result A pointer to the result from the call to SecTrustEvaluate.
760
+ @param certChain On return, a pointer to the certificate chain used to
761
+ validate the input certificate. Call the CFRelease function to release
762
+ this pointer.
763
+ @param statusChain On return, a pointer to the status of the certificate
764
+ chain. Do not attempt to free this pointer; it remains valid until the
765
+ trust is destroyed or the next call to SecTrustEvaluate.
766
+ @result A result code. See "Security Error Codes" (SecBase.h).
767
+ @discussion This function is deprecated in OS X 10.7 and later,
768
+ and is not available on iOS.
769
+ To get the complete certificate chain, use SecTrustCopyCertificateChain.
770
+ To get detailed status information for each certificate, use
771
+ SecTrustCopyProperties. To get the overall trust result for the evaluation,
772
+ use SecTrustGetTrustResult.
773
+ */
774
+ OSStatus SecTrustGetResult(SecTrustRef trustRef, SecTrustResultType * __nullable result,
775
+ CFArrayRef * __nullable CF_RETURNS_RETAINED certChain, CSSM_TP_APPLE_EVIDENCE_INFO * __nullable * __nullable statusChain)
776
+ __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2, __MAC_10_7, __IPHONE_NA, __IPHONE_NA);
777
+
778
+ /*!
779
+ @function SecTrustGetCssmResult
780
+ @abstract Gets the CSSM trust result.
781
+ @param trust A reference to a trust.
782
+ @param result On return, a pointer to the CSSM trust result.
783
+ @result A result code. See "Security Error Codes" (SecBase.h).
784
+ @discussion This function is deprecated in OS X 10.7 and later,
785
+ and is not available on iOS.
786
+ To get detailed status information for each certificate, use
787
+ SecTrustCopyProperties. To get the overall trust result for the evaluation,
788
+ use SecTrustGetTrustResult.
789
+ */
790
+ OSStatus SecTrustGetCssmResult(SecTrustRef trust,
791
+ CSSM_TP_VERIFY_CONTEXT_RESULT_PTR __nullable * __nonnull result)
792
+ __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2, __MAC_10_7, __IPHONE_NA, __IPHONE_NA);
793
+
794
+ /*!
795
+ @function SecTrustGetCssmResultCode
796
+ @abstract Gets the result code from the most recent call to SecTrustEvaluate
797
+ for the specified trust.
798
+ @param trust A reference to a trust.
799
+ @param resultCode On return, the result code produced by the most recent
800
+ evaluation of the given trust (cssmerr.h). The value of resultCode is
801
+ undefined if SecTrustEvaluate has not been called.
802
+ @result A result code. See "Security Error Codes" (SecBase.h). Returns
803
+ errSecTrustNotAvailable if SecTrustEvaluate has not been called for the
804
+ specified trust.
805
+ @discussion This function is deprecated in OS X 10.7 and later,
806
+ and is not available on iOS.
807
+ To get detailed status information for each certificate, use
808
+ SecTrustCopyProperties. To get the overall trust result for the evaluation,
809
+ use SecTrustGetTrustResult.
810
+ */
811
+ OSStatus SecTrustGetCssmResultCode(SecTrustRef trust, OSStatus *resultCode)
812
+ __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2, __MAC_10_7, __IPHONE_NA, __IPHONE_NA);
813
+
814
+ /*!
815
+ @function SecTrustGetTPHandle
816
+ @abstract Gets the CSSM trust handle
817
+ @param trust A reference to a trust.
818
+ @param handle On return, a CSSM trust handle.
819
+ @result A result code. See "Security Error Codes" (SecBase.h).
820
+ @discussion This function is deprecated in OS X 10.7 and later.
821
+ */
822
+ OSStatus SecTrustGetTPHandle(SecTrustRef trust, CSSM_TP_HANDLE *handle)
823
+ __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2, __MAC_10_7, __IPHONE_NA, __IPHONE_NA);
824
+
825
+ /*!
826
+ @function SecTrustCopyAnchorCertificates
827
+ @abstract Returns an array of default anchor (root) certificates used by
828
+ the system.
829
+ @param anchors On return, an array containing the system's default anchors
830
+ (roots). Call the CFRelease function to release this pointer.
831
+ @result A result code. See "Security Error Codes" (SecBase.h).
832
+ @discussion This function is not available on iOS, as certificate data
833
+ for system-trusted roots is currently unavailable on that platform.
834
+ */
835
+ OSStatus SecTrustCopyAnchorCertificates(CFArrayRef * __nonnull CF_RETURNS_RETAINED anchors)
836
+ __OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_NA);
837
+
838
+ CF_IMPLICIT_BRIDGING_DISABLED
839
+ CF_ASSUME_NONNULL_END
840
+
841
+ #endif /* TARGET_OS_MAC && !TARGET_OS_IPHONE */
842
+
843
+ __END_DECLS
844
+
845
+ #endif /* !_SECURITY_SECTRUST_H_ */