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    ///
303    /// # Safety
304    ///
305    /// `trust` must be a valid pointer.
306    #[doc(alias = "sec_trust_copy_ref")]
307    #[cfg(feature = "SecTrust")]
308    #[inline]
309    pub unsafe fn r#ref(trust: sec_trust_t) -> CFRetained<SecTrust> {
310        extern "C-unwind" {
311            fn sec_trust_copy_ref(trust: sec_trust_t) -> Option<NonNull<SecTrust>>;
312        }
313        let ret = unsafe { sec_trust_copy_ref(trust) };
314        let ret =
315            ret.expect("function was marked as returning non-null, but actually returned NULL");
316        unsafe { CFRetained::from_raw(ret) }
317    }
318}
319
320impl sec_identity {
321    /// Create an ARC-able `sec_identity_t` instance from a `SecIdentityRef`.
322    ///
323    ///
324    /// Parameter `identity`: A `SecIdentityRef` instance.
325    ///
326    ///
327    /// Returns: a `sec_identity_t` instance.
328    #[doc(alias = "sec_identity_create")]
329    #[cfg(feature = "SecBase")]
330    #[inline]
331    pub unsafe fn create(identity: &SecIdentity) -> sec_identity_t {
332        extern "C-unwind" {
333            fn sec_identity_create(identity: &SecIdentity) -> sec_identity_t;
334        }
335        unsafe { sec_identity_create(identity) }
336    }
337
338    /// Create an ARC-able `sec_identity_t` instance from a `SecIdentityRef` and
339    /// array of SecCertificateRef instances.
340    ///
341    ///
342    /// Parameter `identity`: A `SecIdentityRef` instance.
343    ///
344    ///
345    /// Parameter `certificates`: An array of `SecCertificateRef` instances.
346    ///
347    ///
348    /// Returns: a `sec_identity_t` instance.
349    ///
350    /// # Safety
351    ///
352    /// `certificates` generic must be of the correct type.
353    #[doc(alias = "sec_identity_create_with_certificates")]
354    #[cfg(feature = "SecBase")]
355    #[inline]
356    pub unsafe fn create_with_certificates(
357        identity: &SecIdentity,
358        certificates: &CFArray,
359    ) -> sec_identity_t {
360        extern "C-unwind" {
361            fn sec_identity_create_with_certificates(
362                identity: &SecIdentity,
363                certificates: &CFArray,
364            ) -> sec_identity_t;
365        }
366        unsafe { sec_identity_create_with_certificates(identity, certificates) }
367    }
368
369    /// Access the certificates associated with the `sec_identity_t` instance.
370    ///
371    ///
372    /// Parameter `identity`: A `sec_identity_t` instance.
373    ///
374    ///
375    /// Parameter `handler`: A block to invoke one or more times with `sec_certificate_t` instances.
376    ///
377    ///
378    /// Returns: Returns true if the peer certificates were accessible, false otherwise.
379    ///
380    /// # Safety
381    ///
382    /// `identity` must be a valid pointer.
383    #[doc(alias = "sec_identity_access_certificates")]
384    #[cfg(feature = "block2")]
385    #[inline]
386    pub unsafe fn access_certificates(
387        identity: sec_identity_t,
388        handler: &block2::DynBlock<dyn Fn(sec_certificate_t)>,
389    ) -> bool {
390        extern "C-unwind" {
391            fn sec_identity_access_certificates(
392                identity: sec_identity_t,
393                handler: &block2::DynBlock<dyn Fn(sec_certificate_t)>,
394            ) -> bool;
395        }
396        unsafe { sec_identity_access_certificates(identity, handler) }
397    }
398
399    /// Copy a retained reference to the underlying `SecIdentityRef` instance.
400    ///
401    ///
402    /// Parameter `identity`: A `sec_identity_t` instance.
403    ///
404    ///
405    /// Returns: The underlying `SecIdentityRef` instance.
406    ///
407    /// # Safety
408    ///
409    /// `identity` must be a valid pointer.
410    #[doc(alias = "sec_identity_copy_ref")]
411    #[cfg(feature = "SecBase")]
412    #[inline]
413    pub unsafe fn r#ref(identity: sec_identity_t) -> Option<CFRetained<SecIdentity>> {
414        extern "C-unwind" {
415            fn sec_identity_copy_ref(identity: sec_identity_t) -> Option<NonNull<SecIdentity>>;
416        }
417        let ret = unsafe { sec_identity_copy_ref(identity) };
418        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
419    }
420
421    /// Copy a retained reference to the underlying `CFArrayRef` container of `SecCertificateRef` types.
422    ///
423    ///
424    /// Parameter `identity`: A `sec_identity_t` instance.
425    ///
426    ///
427    /// Returns: The underlying `CFArrayRef` container with `SecCertificateRef` instances.
428    ///
429    /// # Safety
430    ///
431    /// `identity` must be a valid pointer.
432    #[doc(alias = "sec_identity_copy_certificates_ref")]
433    #[inline]
434    pub unsafe fn certificates_ref(identity: sec_identity_t) -> Option<CFRetained<CFArray>> {
435        extern "C-unwind" {
436            fn sec_identity_copy_certificates_ref(
437                identity: sec_identity_t,
438            ) -> Option<NonNull<CFArray>>;
439        }
440        let ret = unsafe { sec_identity_copy_certificates_ref(identity) };
441        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
442    }
443}
444
445impl sec_certificate {
446    /// Create an ARC-able `sec_certificate_t` instance from a `SecCertificateRef`.
447    ///
448    ///
449    /// Parameter `certificate`: A `SecCertificateRef` instance.
450    ///
451    ///
452    /// Returns: a `sec_certificate_t` instance.
453    #[doc(alias = "sec_certificate_create")]
454    #[cfg(feature = "SecBase")]
455    #[inline]
456    pub unsafe fn create(certificate: &SecCertificate) -> sec_certificate_t {
457        extern "C-unwind" {
458            fn sec_certificate_create(certificate: &SecCertificate) -> sec_certificate_t;
459        }
460        unsafe { sec_certificate_create(certificate) }
461    }
462
463    /// Copy a retained reference to the underlying `SecCertificateRef` instance.
464    ///
465    ///
466    /// Parameter `certificate`: A `sec_certificate_t` instance.
467    ///
468    ///
469    /// Returns: The underlying `SecCertificateRef` instance.
470    ///
471    /// # Safety
472    ///
473    /// `certificate` must be a valid pointer.
474    #[doc(alias = "sec_certificate_copy_ref")]
475    #[cfg(feature = "SecBase")]
476    #[inline]
477    pub unsafe fn r#ref(certificate: sec_certificate_t) -> CFRetained<SecCertificate> {
478        extern "C-unwind" {
479            fn sec_certificate_copy_ref(
480                certificate: sec_certificate_t,
481            ) -> Option<NonNull<SecCertificate>>;
482        }
483        let ret = unsafe { sec_certificate_copy_ref(certificate) };
484        let ret =
485            ret.expect("function was marked as returning non-null, but actually returned NULL");
486        unsafe { CFRetained::from_raw(ret) }
487    }
488}
489
490extern "C-unwind" {
491    #[cfg(feature = "SecTrust")]
492    #[deprecated = "renamed to `sec_trust::create`"]
493    pub fn sec_trust_create(trust: &SecTrust) -> sec_trust_t;
494}
495
496#[cfg(feature = "SecTrust")]
497#[deprecated = "renamed to `sec_trust::ref`"]
498#[inline]
499pub unsafe extern "C-unwind" fn sec_trust_copy_ref(trust: sec_trust_t) -> CFRetained<SecTrust> {
500    extern "C-unwind" {
501        fn sec_trust_copy_ref(trust: sec_trust_t) -> Option<NonNull<SecTrust>>;
502    }
503    let ret = unsafe { sec_trust_copy_ref(trust) };
504    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
505    unsafe { CFRetained::from_raw(ret) }
506}
507
508extern "C-unwind" {
509    #[cfg(feature = "SecBase")]
510    #[deprecated = "renamed to `sec_identity::create`"]
511    pub fn sec_identity_create(identity: &SecIdentity) -> sec_identity_t;
512}
513
514extern "C-unwind" {
515    #[cfg(feature = "SecBase")]
516    #[deprecated = "renamed to `sec_identity::create_with_certificates`"]
517    pub fn sec_identity_create_with_certificates(
518        identity: &SecIdentity,
519        certificates: &CFArray,
520    ) -> sec_identity_t;
521}
522
523extern "C-unwind" {
524    #[cfg(feature = "block2")]
525    #[deprecated = "renamed to `sec_identity::access_certificates`"]
526    pub fn sec_identity_access_certificates(
527        identity: sec_identity_t,
528        handler: &block2::DynBlock<dyn Fn(sec_certificate_t)>,
529    ) -> bool;
530}
531
532#[cfg(feature = "SecBase")]
533#[deprecated = "renamed to `sec_identity::ref`"]
534#[inline]
535pub unsafe extern "C-unwind" fn sec_identity_copy_ref(
536    identity: sec_identity_t,
537) -> Option<CFRetained<SecIdentity>> {
538    extern "C-unwind" {
539        fn sec_identity_copy_ref(identity: sec_identity_t) -> Option<NonNull<SecIdentity>>;
540    }
541    let ret = unsafe { sec_identity_copy_ref(identity) };
542    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
543}
544
545#[deprecated = "renamed to `sec_identity::certificates_ref`"]
546#[inline]
547pub unsafe extern "C-unwind" fn sec_identity_copy_certificates_ref(
548    identity: sec_identity_t,
549) -> Option<CFRetained<CFArray>> {
550    extern "C-unwind" {
551        fn sec_identity_copy_certificates_ref(identity: sec_identity_t)
552            -> Option<NonNull<CFArray>>;
553    }
554    let ret = unsafe { sec_identity_copy_certificates_ref(identity) };
555    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
556}
557
558extern "C-unwind" {
559    #[cfg(feature = "SecBase")]
560    #[deprecated = "renamed to `sec_certificate::create`"]
561    pub fn sec_certificate_create(certificate: &SecCertificate) -> sec_certificate_t;
562}
563
564#[cfg(feature = "SecBase")]
565#[deprecated = "renamed to `sec_certificate::ref`"]
566#[inline]
567pub unsafe extern "C-unwind" fn sec_certificate_copy_ref(
568    certificate: sec_certificate_t,
569) -> CFRetained<SecCertificate> {
570    extern "C-unwind" {
571        fn sec_certificate_copy_ref(
572            certificate: sec_certificate_t,
573        ) -> Option<NonNull<SecCertificate>>;
574    }
575    let ret = unsafe { sec_certificate_copy_ref(certificate) };
576    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
577    unsafe { CFRetained::from_raw(ret) }
578}