objc2_security/generated/
SecProtocolTypes.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10
11use crate::*;
12
13/// These are os_object compatible and ARC-able wrappers around existing CoreFoundation
14/// Security types, including: SecTrustRef, SecIdentityRef, and SecCertificateRef. They allow
15/// clients to use these types in os_object-type APIs and data structures. The underlying
16/// CoreFoundation types may be extracted and used by clients as needed.
17///
18/// See also [Apple's documentation](https://developer.apple.com/documentation/security/sec_trust?language=objc)
19#[repr(C)]
20#[derive(Debug)]
21pub struct sec_trust {
22    inner: [u8; 0],
23    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
24}
25
26#[cfg(feature = "objc2")]
27unsafe impl RefEncode for sec_trust {
28    const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("sec_trust", &[]));
29}
30
31/// These are os_object compatible and ARC-able wrappers around existing CoreFoundation
32/// Security types, including: SecTrustRef, SecIdentityRef, and SecCertificateRef. They allow
33/// clients to use these types in os_object-type APIs and data structures. The underlying
34/// CoreFoundation types may be extracted and used by clients as needed.
35///
36/// See also [Apple's documentation](https://developer.apple.com/documentation/security/sec_trust_t?language=objc)
37pub type sec_trust_t = *mut sec_trust;
38
39/// [Apple's documentation](https://developer.apple.com/documentation/security/sec_identity?language=objc)
40#[repr(C)]
41#[derive(Debug)]
42pub struct sec_identity {
43    inner: [u8; 0],
44    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
45}
46
47#[cfg(feature = "objc2")]
48unsafe impl RefEncode for sec_identity {
49    const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("sec_identity", &[]));
50}
51
52/// [Apple's documentation](https://developer.apple.com/documentation/security/sec_identity_t?language=objc)
53pub type sec_identity_t = *mut sec_identity;
54
55/// [Apple's documentation](https://developer.apple.com/documentation/security/sec_certificate?language=objc)
56#[repr(C)]
57#[derive(Debug)]
58pub struct sec_certificate {
59    inner: [u8; 0],
60    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
61}
62
63#[cfg(feature = "objc2")]
64unsafe impl RefEncode for sec_certificate {
65    const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("sec_certificate", &[]));
66}
67
68/// [Apple's documentation](https://developer.apple.com/documentation/security/sec_certificate_t?language=objc)
69pub type sec_certificate_t = *mut sec_certificate;
70
71/// Enumerations for the set of supported TLS and DTLS protocol versions.
72///
73/// See also [Apple's documentation](https://developer.apple.com/documentation/security/tls_protocol_version_t?language=objc)
74// NS_ENUM
75#[repr(transparent)]
76#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
77pub struct tls_protocol_version_t(pub u16);
78impl tls_protocol_version_t {
79    #[doc(alias = "tls_protocol_version_TLSv10")]
80    #[deprecated = "Use tls_protocol_version_TLSv12 or tls_protocol_version_TLSv13 instead."]
81    pub const TLSv10: Self = Self(0x0301);
82    #[doc(alias = "tls_protocol_version_TLSv11")]
83    #[deprecated = "Use tls_protocol_version_TLSv12 or tls_protocol_version_TLSv13 instead."]
84    pub const TLSv11: Self = Self(0x0302);
85    #[doc(alias = "tls_protocol_version_TLSv12")]
86    pub const TLSv12: Self = Self(0x0303);
87    #[doc(alias = "tls_protocol_version_TLSv13")]
88    pub const TLSv13: Self = Self(0x0304);
89    #[doc(alias = "tls_protocol_version_DTLSv10")]
90    #[deprecated = "Use tls_protocol_version_DTLSv12 instead."]
91    pub const DTLSv10: Self = Self(0xfeff);
92    #[doc(alias = "tls_protocol_version_DTLSv12")]
93    pub const DTLSv12: Self = Self(0xfefd);
94}
95
96#[cfg(feature = "objc2")]
97unsafe impl Encode for tls_protocol_version_t {
98    const ENCODING: Encoding = u16::ENCODING;
99}
100
101#[cfg(feature = "objc2")]
102unsafe impl RefEncode for tls_protocol_version_t {
103    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
104}
105
106/// Enumerations for the set of supported TLS and DTLS ciphersuites.
107///
108/// See https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-4
109/// for ciphersuite codepoint allocations and reference RFCs.
110///
111/// See also [Apple's documentation](https://developer.apple.com/documentation/security/tls_ciphersuite_t?language=objc)
112// NS_ENUM
113#[repr(transparent)]
114#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
115pub struct tls_ciphersuite_t(pub u16);
116impl tls_ciphersuite_t {
117    #[doc(alias = "tls_ciphersuite_RSA_WITH_3DES_EDE_CBC_SHA")]
118    #[deprecated]
119    pub const RSA_WITH_3DES_EDE_CBC_SHA: Self = Self(0x000A);
120    #[doc(alias = "tls_ciphersuite_RSA_WITH_AES_128_CBC_SHA")]
121    pub const RSA_WITH_AES_128_CBC_SHA: Self = Self(0x002F);
122    #[doc(alias = "tls_ciphersuite_RSA_WITH_AES_256_CBC_SHA")]
123    pub const RSA_WITH_AES_256_CBC_SHA: Self = Self(0x0035);
124    #[doc(alias = "tls_ciphersuite_RSA_WITH_AES_128_GCM_SHA256")]
125    pub const RSA_WITH_AES_128_GCM_SHA256: Self = Self(0x009C);
126    #[doc(alias = "tls_ciphersuite_RSA_WITH_AES_256_GCM_SHA384")]
127    pub const RSA_WITH_AES_256_GCM_SHA384: Self = Self(0x009D);
128    #[doc(alias = "tls_ciphersuite_RSA_WITH_AES_128_CBC_SHA256")]
129    pub const RSA_WITH_AES_128_CBC_SHA256: Self = Self(0x003C);
130    #[doc(alias = "tls_ciphersuite_RSA_WITH_AES_256_CBC_SHA256")]
131    pub const RSA_WITH_AES_256_CBC_SHA256: Self = Self(0x003D);
132    #[doc(alias = "tls_ciphersuite_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA")]
133    #[deprecated]
134    pub const ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA: Self = Self(0xC008);
135    #[doc(alias = "tls_ciphersuite_ECDHE_ECDSA_WITH_AES_128_CBC_SHA")]
136    pub const ECDHE_ECDSA_WITH_AES_128_CBC_SHA: Self = Self(0xC009);
137    #[doc(alias = "tls_ciphersuite_ECDHE_ECDSA_WITH_AES_256_CBC_SHA")]
138    pub const ECDHE_ECDSA_WITH_AES_256_CBC_SHA: Self = Self(0xC00A);
139    #[doc(alias = "tls_ciphersuite_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA")]
140    #[deprecated]
141    pub const ECDHE_RSA_WITH_3DES_EDE_CBC_SHA: Self = Self(0xC012);
142    #[doc(alias = "tls_ciphersuite_ECDHE_RSA_WITH_AES_128_CBC_SHA")]
143    pub const ECDHE_RSA_WITH_AES_128_CBC_SHA: Self = Self(0xC013);
144    #[doc(alias = "tls_ciphersuite_ECDHE_RSA_WITH_AES_256_CBC_SHA")]
145    pub const ECDHE_RSA_WITH_AES_256_CBC_SHA: Self = Self(0xC014);
146    #[doc(alias = "tls_ciphersuite_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256")]
147    pub const ECDHE_ECDSA_WITH_AES_128_CBC_SHA256: Self = Self(0xC023);
148    #[doc(alias = "tls_ciphersuite_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384")]
149    pub const ECDHE_ECDSA_WITH_AES_256_CBC_SHA384: Self = Self(0xC024);
150    #[doc(alias = "tls_ciphersuite_ECDHE_RSA_WITH_AES_128_CBC_SHA256")]
151    pub const ECDHE_RSA_WITH_AES_128_CBC_SHA256: Self = Self(0xC027);
152    #[doc(alias = "tls_ciphersuite_ECDHE_RSA_WITH_AES_256_CBC_SHA384")]
153    pub const ECDHE_RSA_WITH_AES_256_CBC_SHA384: Self = Self(0xC028);
154    #[doc(alias = "tls_ciphersuite_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256")]
155    pub const ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: Self = Self(0xC02B);
156    #[doc(alias = "tls_ciphersuite_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384")]
157    pub const ECDHE_ECDSA_WITH_AES_256_GCM_SHA384: Self = Self(0xC02C);
158    #[doc(alias = "tls_ciphersuite_ECDHE_RSA_WITH_AES_128_GCM_SHA256")]
159    pub const ECDHE_RSA_WITH_AES_128_GCM_SHA256: Self = Self(0xC02F);
160    #[doc(alias = "tls_ciphersuite_ECDHE_RSA_WITH_AES_256_GCM_SHA384")]
161    pub const ECDHE_RSA_WITH_AES_256_GCM_SHA384: Self = Self(0xC030);
162    #[doc(alias = "tls_ciphersuite_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256")]
163    pub const ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256: Self = Self(0xCCA8);
164    #[doc(alias = "tls_ciphersuite_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256")]
165    pub const ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256: Self = Self(0xCCA9);
166    #[doc(alias = "tls_ciphersuite_AES_128_GCM_SHA256")]
167    pub const AES_128_GCM_SHA256: Self = Self(0x1301);
168    #[doc(alias = "tls_ciphersuite_AES_256_GCM_SHA384")]
169    pub const AES_256_GCM_SHA384: Self = Self(0x1302);
170    #[doc(alias = "tls_ciphersuite_CHACHA20_POLY1305_SHA256")]
171    pub const CHACHA20_POLY1305_SHA256: Self = Self(0x1303);
172}
173
174#[cfg(feature = "objc2")]
175unsafe impl Encode for tls_ciphersuite_t {
176    const ENCODING: Encoding = u16::ENCODING;
177}
178
179#[cfg(feature = "objc2")]
180unsafe impl RefEncode for tls_ciphersuite_t {
181    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
182}
183
184/// Convenience ciphersuite groups that collate ciphersuites of comparable security
185/// properties into a single alias.
186///
187/// See also [Apple's documentation](https://developer.apple.com/documentation/security/tls_ciphersuite_group_t?language=objc)
188// NS_ENUM
189#[repr(transparent)]
190#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
191pub struct tls_ciphersuite_group_t(pub u16);
192impl tls_ciphersuite_group_t {
193    #[doc(alias = "tls_ciphersuite_group_default")]
194    pub const default: Self = Self(0);
195    #[doc(alias = "tls_ciphersuite_group_compatibility")]
196    pub const compatibility: Self = Self(1);
197    #[doc(alias = "tls_ciphersuite_group_legacy")]
198    pub const legacy: Self = Self(2);
199    #[doc(alias = "tls_ciphersuite_group_ats")]
200    pub const ats: Self = Self(3);
201    #[doc(alias = "tls_ciphersuite_group_ats_compatibility")]
202    pub const ats_compatibility: Self = Self(4);
203}
204
205#[cfg(feature = "objc2")]
206unsafe impl Encode for tls_ciphersuite_group_t {
207    const ENCODING: Encoding = u16::ENCODING;
208}
209
210#[cfg(feature = "objc2")]
211unsafe impl RefEncode for tls_ciphersuite_group_t {
212    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
213}
214
215/// Enumerations for the set of supported TLS and DTLS protocol versions.
216///
217///
218/// Note: This enumeration is deprecated. Use `tls_protocol_version_t` instead.
219///
220/// See also [Apple's documentation](https://developer.apple.com/documentation/security/sslprotocol?language=objc)
221// NS_ENUM
222#[repr(transparent)]
223#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
224pub struct SSLProtocol(pub c_int);
225impl SSLProtocol {
226    #[doc(alias = "kSSLProtocolUnknown")]
227    #[deprecated]
228    pub const SSLProtocolUnknown: Self = Self(0);
229    #[doc(alias = "kTLSProtocol1")]
230    #[deprecated]
231    pub const TLSProtocol1: Self = Self(4);
232    #[doc(alias = "kTLSProtocol11")]
233    #[deprecated]
234    pub const TLSProtocol11: Self = Self(7);
235    #[doc(alias = "kTLSProtocol12")]
236    #[deprecated]
237    pub const TLSProtocol12: Self = Self(8);
238    #[doc(alias = "kDTLSProtocol1")]
239    #[deprecated]
240    pub const DTLSProtocol1: Self = Self(9);
241    #[doc(alias = "kTLSProtocol13")]
242    #[deprecated]
243    pub const TLSProtocol13: Self = Self(10);
244    #[doc(alias = "kDTLSProtocol12")]
245    #[deprecated]
246    pub const DTLSProtocol12: Self = Self(11);
247    #[doc(alias = "kTLSProtocolMaxSupported")]
248    #[deprecated]
249    pub const TLSProtocolMaxSupported: Self = Self(999);
250    #[doc(alias = "kSSLProtocol2")]
251    #[deprecated]
252    pub const SSLProtocol2: Self = Self(1);
253    #[doc(alias = "kSSLProtocol3")]
254    #[deprecated]
255    pub const SSLProtocol3: Self = Self(2);
256    #[doc(alias = "kSSLProtocol3Only")]
257    #[deprecated]
258    pub const SSLProtocol3Only: Self = Self(3);
259    #[doc(alias = "kTLSProtocol1Only")]
260    #[deprecated]
261    pub const TLSProtocol1Only: Self = Self(5);
262    #[doc(alias = "kSSLProtocolAll")]
263    #[deprecated]
264    pub const SSLProtocolAll: Self = Self(6);
265}
266
267#[cfg(feature = "objc2")]
268unsafe impl Encode for SSLProtocol {
269    const ENCODING: Encoding = c_int::ENCODING;
270}
271
272#[cfg(feature = "objc2")]
273unsafe impl RefEncode for SSLProtocol {
274    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
275}
276
277impl sec_trust {
278    /// Create an ARC-able `sec_trust_t` instance from a `SecTrustRef`.
279    ///
280    ///
281    /// Parameter `trust`: A `SecTrustRef` instance.
282    ///
283    ///
284    /// Returns: a `sec_trust_t` instance.
285    #[doc(alias = "sec_trust_create")]
286    #[cfg(feature = "SecTrust")]
287    #[inline]
288    pub unsafe fn create(trust: &SecTrust) -> sec_trust_t {
289        extern "C-unwind" {
290            fn sec_trust_create(trust: &SecTrust) -> sec_trust_t;
291        }
292        unsafe { sec_trust_create(trust) }
293    }
294
295    /// Copy a retained reference to the underlying `SecTrustRef` instance.
296    ///
297    ///
298    /// Parameter `trust`: A `sec_trust_t` instance.
299    ///
300    ///
301    /// Returns: The underlying `SecTrustRef` instance.
302    #[doc(alias = "sec_trust_copy_ref")]
303    #[cfg(feature = "SecTrust")]
304    #[inline]
305    pub unsafe fn r#ref(trust: sec_trust_t) -> CFRetained<SecTrust> {
306        extern "C-unwind" {
307            fn sec_trust_copy_ref(trust: sec_trust_t) -> Option<NonNull<SecTrust>>;
308        }
309        let ret = unsafe { sec_trust_copy_ref(trust) };
310        let ret =
311            ret.expect("function was marked as returning non-null, but actually returned NULL");
312        unsafe { CFRetained::from_raw(ret) }
313    }
314}
315
316impl sec_identity {
317    /// Create an ARC-able `sec_identity_t` instance from a `SecIdentityRef`.
318    ///
319    ///
320    /// Parameter `identity`: A `SecIdentityRef` instance.
321    ///
322    ///
323    /// Returns: a `sec_identity_t` instance.
324    #[doc(alias = "sec_identity_create")]
325    #[cfg(feature = "SecBase")]
326    #[inline]
327    pub unsafe fn create(identity: &SecIdentity) -> sec_identity_t {
328        extern "C-unwind" {
329            fn sec_identity_create(identity: &SecIdentity) -> sec_identity_t;
330        }
331        unsafe { sec_identity_create(identity) }
332    }
333
334    /// Create an ARC-able `sec_identity_t` instance from a `SecIdentityRef` and
335    /// array of SecCertificateRef instances.
336    ///
337    ///
338    /// Parameter `identity`: A `SecIdentityRef` instance.
339    ///
340    ///
341    /// Parameter `certificates`: An array of `SecCertificateRef` instances.
342    ///
343    ///
344    /// Returns: a `sec_identity_t` instance.
345    #[doc(alias = "sec_identity_create_with_certificates")]
346    #[cfg(feature = "SecBase")]
347    #[inline]
348    pub unsafe fn create_with_certificates(
349        identity: &SecIdentity,
350        certificates: &CFArray,
351    ) -> sec_identity_t {
352        extern "C-unwind" {
353            fn sec_identity_create_with_certificates(
354                identity: &SecIdentity,
355                certificates: &CFArray,
356            ) -> sec_identity_t;
357        }
358        unsafe { sec_identity_create_with_certificates(identity, certificates) }
359    }
360
361    /// Access the certificates associated with the `sec_identity_t` instance.
362    ///
363    ///
364    /// Parameter `identity`: A `sec_identity_t` instance.
365    ///
366    ///
367    /// Parameter `handler`: A block to invoke one or more times with `sec_certificate_t` instances.
368    ///
369    ///
370    /// Returns: Returns true if the peer certificates were accessible, false otherwise.
371    #[doc(alias = "sec_identity_access_certificates")]
372    #[cfg(feature = "block2")]
373    #[inline]
374    pub unsafe fn access_certificates(
375        identity: sec_identity_t,
376        handler: &block2::DynBlock<dyn Fn(sec_certificate_t)>,
377    ) -> bool {
378        extern "C-unwind" {
379            fn sec_identity_access_certificates(
380                identity: sec_identity_t,
381                handler: &block2::DynBlock<dyn Fn(sec_certificate_t)>,
382            ) -> bool;
383        }
384        unsafe { sec_identity_access_certificates(identity, handler) }
385    }
386
387    /// Copy a retained reference to the underlying `SecIdentityRef` instance.
388    ///
389    ///
390    /// Parameter `identity`: A `sec_identity_t` instance.
391    ///
392    ///
393    /// Returns: The underlying `SecIdentityRef` instance.
394    #[doc(alias = "sec_identity_copy_ref")]
395    #[cfg(feature = "SecBase")]
396    #[inline]
397    pub unsafe fn r#ref(identity: sec_identity_t) -> Option<CFRetained<SecIdentity>> {
398        extern "C-unwind" {
399            fn sec_identity_copy_ref(identity: sec_identity_t) -> Option<NonNull<SecIdentity>>;
400        }
401        let ret = unsafe { sec_identity_copy_ref(identity) };
402        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
403    }
404
405    /// Copy a retained reference to the underlying `CFArrayRef` container of `SecCertificateRef` types.
406    ///
407    ///
408    /// Parameter `identity`: A `sec_identity_t` instance.
409    ///
410    ///
411    /// Returns: The underlying `CFArrayRef` container with `SecCertificateRef` instances.
412    #[doc(alias = "sec_identity_copy_certificates_ref")]
413    #[inline]
414    pub unsafe fn certificates_ref(identity: sec_identity_t) -> Option<CFRetained<CFArray>> {
415        extern "C-unwind" {
416            fn sec_identity_copy_certificates_ref(
417                identity: sec_identity_t,
418            ) -> Option<NonNull<CFArray>>;
419        }
420        let ret = unsafe { sec_identity_copy_certificates_ref(identity) };
421        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
422    }
423}
424
425impl sec_certificate {
426    /// Create an ARC-able `sec_certificate_t` instance from a `SecCertificateRef`.
427    ///
428    ///
429    /// Parameter `certificate`: A `SecCertificateRef` instance.
430    ///
431    ///
432    /// Returns: a `sec_certificate_t` instance.
433    #[doc(alias = "sec_certificate_create")]
434    #[cfg(feature = "SecBase")]
435    #[inline]
436    pub unsafe fn create(certificate: &SecCertificate) -> sec_certificate_t {
437        extern "C-unwind" {
438            fn sec_certificate_create(certificate: &SecCertificate) -> sec_certificate_t;
439        }
440        unsafe { sec_certificate_create(certificate) }
441    }
442
443    /// Copy a retained reference to the underlying `SecCertificateRef` instance.
444    ///
445    ///
446    /// Parameter `certificate`: A `sec_certificate_t` instance.
447    ///
448    ///
449    /// Returns: The underlying `SecCertificateRef` instance.
450    #[doc(alias = "sec_certificate_copy_ref")]
451    #[cfg(feature = "SecBase")]
452    #[inline]
453    pub unsafe fn r#ref(certificate: sec_certificate_t) -> CFRetained<SecCertificate> {
454        extern "C-unwind" {
455            fn sec_certificate_copy_ref(
456                certificate: sec_certificate_t,
457            ) -> Option<NonNull<SecCertificate>>;
458        }
459        let ret = unsafe { sec_certificate_copy_ref(certificate) };
460        let ret =
461            ret.expect("function was marked as returning non-null, but actually returned NULL");
462        unsafe { CFRetained::from_raw(ret) }
463    }
464}
465
466extern "C-unwind" {
467    #[cfg(feature = "SecTrust")]
468    #[deprecated = "renamed to `sec_trust::create`"]
469    pub fn sec_trust_create(trust: &SecTrust) -> sec_trust_t;
470}
471
472#[cfg(feature = "SecTrust")]
473#[deprecated = "renamed to `sec_trust::ref`"]
474#[inline]
475pub unsafe extern "C-unwind" fn sec_trust_copy_ref(trust: sec_trust_t) -> CFRetained<SecTrust> {
476    extern "C-unwind" {
477        fn sec_trust_copy_ref(trust: sec_trust_t) -> Option<NonNull<SecTrust>>;
478    }
479    let ret = unsafe { sec_trust_copy_ref(trust) };
480    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
481    unsafe { CFRetained::from_raw(ret) }
482}
483
484extern "C-unwind" {
485    #[cfg(feature = "SecBase")]
486    #[deprecated = "renamed to `sec_identity::create`"]
487    pub fn sec_identity_create(identity: &SecIdentity) -> sec_identity_t;
488}
489
490extern "C-unwind" {
491    #[cfg(feature = "SecBase")]
492    #[deprecated = "renamed to `sec_identity::create_with_certificates`"]
493    pub fn sec_identity_create_with_certificates(
494        identity: &SecIdentity,
495        certificates: &CFArray,
496    ) -> sec_identity_t;
497}
498
499extern "C-unwind" {
500    #[cfg(feature = "block2")]
501    #[deprecated = "renamed to `sec_identity::access_certificates`"]
502    pub fn sec_identity_access_certificates(
503        identity: sec_identity_t,
504        handler: &block2::DynBlock<dyn Fn(sec_certificate_t)>,
505    ) -> bool;
506}
507
508#[cfg(feature = "SecBase")]
509#[deprecated = "renamed to `sec_identity::ref`"]
510#[inline]
511pub unsafe extern "C-unwind" fn sec_identity_copy_ref(
512    identity: sec_identity_t,
513) -> Option<CFRetained<SecIdentity>> {
514    extern "C-unwind" {
515        fn sec_identity_copy_ref(identity: sec_identity_t) -> Option<NonNull<SecIdentity>>;
516    }
517    let ret = unsafe { sec_identity_copy_ref(identity) };
518    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
519}
520
521#[deprecated = "renamed to `sec_identity::certificates_ref`"]
522#[inline]
523pub unsafe extern "C-unwind" fn sec_identity_copy_certificates_ref(
524    identity: sec_identity_t,
525) -> Option<CFRetained<CFArray>> {
526    extern "C-unwind" {
527        fn sec_identity_copy_certificates_ref(identity: sec_identity_t)
528            -> Option<NonNull<CFArray>>;
529    }
530    let ret = unsafe { sec_identity_copy_certificates_ref(identity) };
531    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
532}
533
534extern "C-unwind" {
535    #[cfg(feature = "SecBase")]
536    #[deprecated = "renamed to `sec_certificate::create`"]
537    pub fn sec_certificate_create(certificate: &SecCertificate) -> sec_certificate_t;
538}
539
540#[cfg(feature = "SecBase")]
541#[deprecated = "renamed to `sec_certificate::ref`"]
542#[inline]
543pub unsafe extern "C-unwind" fn sec_certificate_copy_ref(
544    certificate: sec_certificate_t,
545) -> CFRetained<SecCertificate> {
546    extern "C-unwind" {
547        fn sec_certificate_copy_ref(
548            certificate: sec_certificate_t,
549        ) -> Option<NonNull<SecCertificate>>;
550    }
551    let ret = unsafe { sec_certificate_copy_ref(certificate) };
552    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
553    unsafe { CFRetained::from_raw(ret) }
554}