]> git.saurik.com Git - apple/security.git/blob - protocol/SecProtocolTypesPriv.h
Security-59306.80.4.tar.gz
[apple/security.git] / protocol / SecProtocolTypesPriv.h
1 /*
2 * Copyright (c) 2018 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 #ifndef SecProtocolTypesPriv_h
25 #define SecProtocolTypesPriv_h
26
27 #include <Security/SecProtocolTypes.h>
28
29 __BEGIN_DECLS
30
31 SEC_ASSUME_NONNULL_BEGIN
32
33 /*!
34 * @function sec_identity_create_with_certificates_and_external_private_key
35 *
36 * @abstract
37 * Create an ARC-able `sec_identity_t` instance from an array of `SecCertificateRef`
38 * instances and blocks to be invoked for private key opertions. Callers may use this
39 * constructor to build a `sec_identity_t` instance with an external private key.
40 *
41 * @param certificates
42 * An array of `SecCertificateRef` instances.
43 *
44 * @param sign_block
45 * A `sec_protocol_private_key_sign_t` block.
46 *
47 * @param decrypt_block
48 * A `sec_protocol_private_key_decrypt_t` block.
49 *
50 * @param operation_queue
51 * The `dispatch_queue_t` queue on which each private key operation is invoked.
52 *
53 * @return a `sec_identity_t` instance.
54 */
55 API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
56 SEC_RETURNS_RETAINED _Nullable sec_identity_t
57 sec_identity_create_with_certificates_and_external_private_key(CFArrayRef certificates,
58 sec_protocol_private_key_sign_t sign_block,
59 sec_protocol_private_key_decrypt_t decrypt_block,
60 dispatch_queue_t operation_queue);
61
62 /*!
63 * @function sec_identity_copy_private_key_sign_block
64 *
65 * @abstract
66 * Copy a retained reference to the underlying `sec_protocol_private_key_sign_t` used by the identity.
67 *
68 * @param identity
69 * A `sec_identity_t` instance.
70 *
71 * @return a `sec_protocol_private_key_sign_t` block, or nil.
72 */
73 API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
74 SEC_RETURNS_RETAINED _Nullable sec_protocol_private_key_sign_t
75 sec_identity_copy_private_key_sign_block(sec_identity_t identity);
76
77 /*!
78 * @function sec_identity_copy_private_key_decrypt_block
79 *
80 * @abstract
81 * Copy a retained reference to the underlying `sec_protocol_private_key_decrypt_t` used by the identity.
82 *
83 * @param identity
84 * A `sec_identity_t` instance.
85 *
86 * @return a `sec_protocol_private_key_decrypt_t` block, or nil.
87 */
88 API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
89 SEC_RETURNS_RETAINED _Nullable sec_protocol_private_key_decrypt_t
90 sec_identity_copy_private_key_decrypt_block(sec_identity_t identity);
91
92 /*!
93 * @function sec_identity_copy_private_key_queue
94 *
95 * @abstract
96 * Copy a retained reference to the `dispatch_queue_t` to be used by external private key
97 * operations, if any.
98 *
99 * @param identity
100 * A `sec_identity_t` instance.
101 *
102 * @return a `dispatch_queue_t` queue, or nil.
103 */
104 API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
105 SEC_RETURNS_RETAINED _Nullable dispatch_queue_t
106 sec_identity_copy_private_key_queue(sec_identity_t identity);
107
108 /*!
109 * @function sec_identity_has_certificates
110 *
111 * @abstract
112 * Determine if the `sec_identity_t` has a list of certificates associated with it.
113 *
114 * @param identity
115 * A `sec_identity_t` instance.
116 *
117 * @return True if the identity has certificates associated with it, and false otherwise.
118 */
119 API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
120 bool
121 sec_identity_has_certificates(sec_identity_t identity);
122
123 SEC_ASSUME_NONNULL_END
124
125 __END_DECLS
126
127 #endif // SecProtocolTypesPriv_h