objc2_security/generated/
CMSDecoder.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/// [Apple's documentation](https://developer.apple.com/documentation/security/cmsdecoder?language=objc)
14#[repr(C)]
15pub struct CMSDecoder {
16    inner: [u8; 0],
17    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
18}
19
20cf_type!(
21    unsafe impl CMSDecoder {}
22);
23#[cfg(feature = "objc2")]
24cf_objc2_type!(
25    unsafe impl RefEncode<"_CMSDecoder"> for CMSDecoder {}
26);
27
28unsafe impl ConcreteType for CMSDecoder {
29    #[doc(alias = "CMSDecoderGetTypeID")]
30    #[inline]
31    fn type_id() -> CFTypeID {
32        extern "C-unwind" {
33            fn CMSDecoderGetTypeID() -> CFTypeID;
34        }
35        unsafe { CMSDecoderGetTypeID() }
36    }
37}
38
39/// [Apple's documentation](https://developer.apple.com/documentation/security/cmssignerstatus?language=objc)
40// NS_ENUM
41#[repr(transparent)]
42#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
43pub struct CMSSignerStatus(pub u32);
44impl CMSSignerStatus {
45    #[doc(alias = "kCMSSignerUnsigned")]
46    pub const Unsigned: Self = Self(0);
47    #[doc(alias = "kCMSSignerValid")]
48    pub const Valid: Self = Self(1);
49    #[doc(alias = "kCMSSignerNeedsDetachedContent")]
50    pub const NeedsDetachedContent: Self = Self(2);
51    #[doc(alias = "kCMSSignerInvalidSignature")]
52    pub const InvalidSignature: Self = Self(3);
53    #[doc(alias = "kCMSSignerInvalidCert")]
54    pub const InvalidCert: Self = Self(4);
55    #[doc(alias = "kCMSSignerInvalidIndex")]
56    pub const InvalidIndex: Self = Self(5);
57}
58
59#[cfg(feature = "objc2")]
60unsafe impl Encode for CMSSignerStatus {
61    const ENCODING: Encoding = u32::ENCODING;
62}
63
64#[cfg(feature = "objc2")]
65unsafe impl RefEncode for CMSSignerStatus {
66    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
67}
68
69impl CMSDecoder {
70    #[doc(alias = "CMSDecoderCreate")]
71    #[inline]
72    pub unsafe fn create(cms_decoder_out: NonNull<*mut CMSDecoder>) -> OSStatus {
73        extern "C-unwind" {
74            fn CMSDecoderCreate(cms_decoder_out: NonNull<*mut CMSDecoder>) -> OSStatus;
75        }
76        unsafe { CMSDecoderCreate(cms_decoder_out) }
77    }
78
79    #[doc(alias = "CMSDecoderUpdateMessage")]
80    #[inline]
81    pub unsafe fn update_message(
82        self: &CMSDecoder,
83        msg_bytes: NonNull<c_void>,
84        msg_bytes_len: usize,
85    ) -> OSStatus {
86        extern "C-unwind" {
87            fn CMSDecoderUpdateMessage(
88                cms_decoder: &CMSDecoder,
89                msg_bytes: NonNull<c_void>,
90                msg_bytes_len: usize,
91            ) -> OSStatus;
92        }
93        unsafe { CMSDecoderUpdateMessage(self, msg_bytes, msg_bytes_len) }
94    }
95
96    #[doc(alias = "CMSDecoderFinalizeMessage")]
97    #[inline]
98    pub unsafe fn finalize_message(self: &CMSDecoder) -> OSStatus {
99        extern "C-unwind" {
100            fn CMSDecoderFinalizeMessage(cms_decoder: &CMSDecoder) -> OSStatus;
101        }
102        unsafe { CMSDecoderFinalizeMessage(self) }
103    }
104
105    #[doc(alias = "CMSDecoderSetDetachedContent")]
106    #[inline]
107    pub unsafe fn set_detached_content(self: &CMSDecoder, detached_content: &CFData) -> OSStatus {
108        extern "C-unwind" {
109            fn CMSDecoderSetDetachedContent(
110                cms_decoder: &CMSDecoder,
111                detached_content: &CFData,
112            ) -> OSStatus;
113        }
114        unsafe { CMSDecoderSetDetachedContent(self, detached_content) }
115    }
116
117    #[doc(alias = "CMSDecoderCopyDetachedContent")]
118    #[inline]
119    pub unsafe fn copy_detached_content(
120        self: &CMSDecoder,
121        detached_content_out: NonNull<*const CFData>,
122    ) -> OSStatus {
123        extern "C-unwind" {
124            fn CMSDecoderCopyDetachedContent(
125                cms_decoder: &CMSDecoder,
126                detached_content_out: NonNull<*const CFData>,
127            ) -> OSStatus;
128        }
129        unsafe { CMSDecoderCopyDetachedContent(self, detached_content_out) }
130    }
131
132    #[doc(alias = "CMSDecoderSetSearchKeychain")]
133    #[deprecated]
134    #[inline]
135    pub unsafe fn set_search_keychain(self: &CMSDecoder, keychain_or_array: &CFType) -> OSStatus {
136        extern "C-unwind" {
137            fn CMSDecoderSetSearchKeychain(
138                cms_decoder: &CMSDecoder,
139                keychain_or_array: &CFType,
140            ) -> OSStatus;
141        }
142        unsafe { CMSDecoderSetSearchKeychain(self, keychain_or_array) }
143    }
144
145    #[doc(alias = "CMSDecoderGetNumSigners")]
146    #[inline]
147    pub unsafe fn num_signers(self: &CMSDecoder, num_signers_out: NonNull<usize>) -> OSStatus {
148        extern "C-unwind" {
149            fn CMSDecoderGetNumSigners(
150                cms_decoder: &CMSDecoder,
151                num_signers_out: NonNull<usize>,
152            ) -> OSStatus;
153        }
154        unsafe { CMSDecoderGetNumSigners(self, num_signers_out) }
155    }
156
157    #[doc(alias = "CMSDecoderCopySignerStatus")]
158    #[cfg(feature = "SecTrust")]
159    #[inline]
160    pub unsafe fn copy_signer_status(
161        self: &CMSDecoder,
162        signer_index: usize,
163        policy_or_array: &CFType,
164        evaluate_sec_trust: bool,
165        signer_status_out: *mut CMSSignerStatus,
166        sec_trust_out: *mut *mut SecTrust,
167        cert_verify_result_code_out: *mut OSStatus,
168    ) -> OSStatus {
169        extern "C-unwind" {
170            fn CMSDecoderCopySignerStatus(
171                cms_decoder: &CMSDecoder,
172                signer_index: usize,
173                policy_or_array: &CFType,
174                evaluate_sec_trust: Boolean,
175                signer_status_out: *mut CMSSignerStatus,
176                sec_trust_out: *mut *mut SecTrust,
177                cert_verify_result_code_out: *mut OSStatus,
178            ) -> OSStatus;
179        }
180        unsafe {
181            CMSDecoderCopySignerStatus(
182                self,
183                signer_index,
184                policy_or_array,
185                evaluate_sec_trust as _,
186                signer_status_out,
187                sec_trust_out,
188                cert_verify_result_code_out,
189            )
190        }
191    }
192
193    #[doc(alias = "CMSDecoderCopySignerEmailAddress")]
194    #[inline]
195    pub unsafe fn copy_signer_email_address(
196        self: &CMSDecoder,
197        signer_index: usize,
198        signer_email_address_out: NonNull<*const CFString>,
199    ) -> OSStatus {
200        extern "C-unwind" {
201            fn CMSDecoderCopySignerEmailAddress(
202                cms_decoder: &CMSDecoder,
203                signer_index: usize,
204                signer_email_address_out: NonNull<*const CFString>,
205            ) -> OSStatus;
206        }
207        unsafe { CMSDecoderCopySignerEmailAddress(self, signer_index, signer_email_address_out) }
208    }
209
210    #[doc(alias = "CMSDecoderCopySignerCert")]
211    #[cfg(feature = "SecBase")]
212    #[inline]
213    pub unsafe fn copy_signer_cert(
214        self: &CMSDecoder,
215        signer_index: usize,
216        signer_cert_out: NonNull<*mut SecCertificate>,
217    ) -> OSStatus {
218        extern "C-unwind" {
219            fn CMSDecoderCopySignerCert(
220                cms_decoder: &CMSDecoder,
221                signer_index: usize,
222                signer_cert_out: NonNull<*mut SecCertificate>,
223            ) -> OSStatus;
224        }
225        unsafe { CMSDecoderCopySignerCert(self, signer_index, signer_cert_out) }
226    }
227
228    #[doc(alias = "CMSDecoderIsContentEncrypted")]
229    #[inline]
230    pub unsafe fn is_content_encrypted(
231        self: &CMSDecoder,
232        is_encrypted_out: NonNull<Boolean>,
233    ) -> OSStatus {
234        extern "C-unwind" {
235            fn CMSDecoderIsContentEncrypted(
236                cms_decoder: &CMSDecoder,
237                is_encrypted_out: NonNull<Boolean>,
238            ) -> OSStatus;
239        }
240        unsafe { CMSDecoderIsContentEncrypted(self, is_encrypted_out) }
241    }
242
243    #[doc(alias = "CMSDecoderCopyEncapsulatedContentType")]
244    #[inline]
245    pub unsafe fn copy_encapsulated_content_type(
246        self: &CMSDecoder,
247        e_content_type_out: NonNull<*const CFData>,
248    ) -> OSStatus {
249        extern "C-unwind" {
250            fn CMSDecoderCopyEncapsulatedContentType(
251                cms_decoder: &CMSDecoder,
252                e_content_type_out: NonNull<*const CFData>,
253            ) -> OSStatus;
254        }
255        unsafe { CMSDecoderCopyEncapsulatedContentType(self, e_content_type_out) }
256    }
257
258    #[doc(alias = "CMSDecoderCopyAllCerts")]
259    #[inline]
260    pub unsafe fn copy_all_certs(
261        self: &CMSDecoder,
262        certs_out: NonNull<*const CFArray>,
263    ) -> OSStatus {
264        extern "C-unwind" {
265            fn CMSDecoderCopyAllCerts(
266                cms_decoder: &CMSDecoder,
267                certs_out: NonNull<*const CFArray>,
268            ) -> OSStatus;
269        }
270        unsafe { CMSDecoderCopyAllCerts(self, certs_out) }
271    }
272
273    #[doc(alias = "CMSDecoderCopyContent")]
274    #[inline]
275    pub unsafe fn copy_content(self: &CMSDecoder, content_out: NonNull<*const CFData>) -> OSStatus {
276        extern "C-unwind" {
277            fn CMSDecoderCopyContent(
278                cms_decoder: &CMSDecoder,
279                content_out: NonNull<*const CFData>,
280            ) -> OSStatus;
281        }
282        unsafe { CMSDecoderCopyContent(self, content_out) }
283    }
284
285    #[doc(alias = "CMSDecoderCopySignerSigningTime")]
286    #[inline]
287    pub unsafe fn copy_signer_signing_time(
288        self: &CMSDecoder,
289        signer_index: usize,
290        signing_time: NonNull<CFAbsoluteTime>,
291    ) -> OSStatus {
292        extern "C-unwind" {
293            fn CMSDecoderCopySignerSigningTime(
294                cms_decoder: &CMSDecoder,
295                signer_index: usize,
296                signing_time: NonNull<CFAbsoluteTime>,
297            ) -> OSStatus;
298        }
299        unsafe { CMSDecoderCopySignerSigningTime(self, signer_index, signing_time) }
300    }
301
302    #[doc(alias = "CMSDecoderCopySignerTimestamp")]
303    #[inline]
304    pub unsafe fn copy_signer_timestamp(
305        self: &CMSDecoder,
306        signer_index: usize,
307        timestamp: NonNull<CFAbsoluteTime>,
308    ) -> OSStatus {
309        extern "C-unwind" {
310            fn CMSDecoderCopySignerTimestamp(
311                cms_decoder: &CMSDecoder,
312                signer_index: usize,
313                timestamp: NonNull<CFAbsoluteTime>,
314            ) -> OSStatus;
315        }
316        unsafe { CMSDecoderCopySignerTimestamp(self, signer_index, timestamp) }
317    }
318
319    #[doc(alias = "CMSDecoderCopySignerTimestampWithPolicy")]
320    #[inline]
321    pub unsafe fn copy_signer_timestamp_with_policy(
322        self: &CMSDecoder,
323        time_stamp_policy: Option<&CFType>,
324        signer_index: usize,
325        timestamp: NonNull<CFAbsoluteTime>,
326    ) -> OSStatus {
327        extern "C-unwind" {
328            fn CMSDecoderCopySignerTimestampWithPolicy(
329                cms_decoder: &CMSDecoder,
330                time_stamp_policy: Option<&CFType>,
331                signer_index: usize,
332                timestamp: NonNull<CFAbsoluteTime>,
333            ) -> OSStatus;
334        }
335        unsafe {
336            CMSDecoderCopySignerTimestampWithPolicy(
337                self,
338                time_stamp_policy,
339                signer_index,
340                timestamp,
341            )
342        }
343    }
344
345    #[doc(alias = "CMSDecoderCopySignerTimestampCertificates")]
346    #[inline]
347    pub unsafe fn copy_signer_timestamp_certificates(
348        self: &CMSDecoder,
349        signer_index: usize,
350        certificate_refs: NonNull<*const CFArray>,
351    ) -> OSStatus {
352        extern "C-unwind" {
353            fn CMSDecoderCopySignerTimestampCertificates(
354                cms_decoder: &CMSDecoder,
355                signer_index: usize,
356                certificate_refs: NonNull<*const CFArray>,
357            ) -> OSStatus;
358        }
359        unsafe { CMSDecoderCopySignerTimestampCertificates(self, signer_index, certificate_refs) }
360    }
361}
362
363extern "C-unwind" {
364    #[deprecated = "renamed to `CMSDecoder::create`"]
365    pub fn CMSDecoderCreate(cms_decoder_out: NonNull<*mut CMSDecoder>) -> OSStatus;
366}
367
368extern "C-unwind" {
369    #[deprecated = "renamed to `CMSDecoder::update_message`"]
370    pub fn CMSDecoderUpdateMessage(
371        cms_decoder: &CMSDecoder,
372        msg_bytes: NonNull<c_void>,
373        msg_bytes_len: usize,
374    ) -> OSStatus;
375}
376
377extern "C-unwind" {
378    #[deprecated = "renamed to `CMSDecoder::finalize_message`"]
379    pub fn CMSDecoderFinalizeMessage(cms_decoder: &CMSDecoder) -> OSStatus;
380}
381
382extern "C-unwind" {
383    #[deprecated = "renamed to `CMSDecoder::set_detached_content`"]
384    pub fn CMSDecoderSetDetachedContent(
385        cms_decoder: &CMSDecoder,
386        detached_content: &CFData,
387    ) -> OSStatus;
388}
389
390extern "C-unwind" {
391    #[deprecated = "renamed to `CMSDecoder::copy_detached_content`"]
392    pub fn CMSDecoderCopyDetachedContent(
393        cms_decoder: &CMSDecoder,
394        detached_content_out: NonNull<*const CFData>,
395    ) -> OSStatus;
396}
397
398extern "C-unwind" {
399    #[deprecated = "renamed to `CMSDecoder::set_search_keychain`"]
400    pub fn CMSDecoderSetSearchKeychain(
401        cms_decoder: &CMSDecoder,
402        keychain_or_array: &CFType,
403    ) -> OSStatus;
404}
405
406extern "C-unwind" {
407    #[deprecated = "renamed to `CMSDecoder::num_signers`"]
408    pub fn CMSDecoderGetNumSigners(
409        cms_decoder: &CMSDecoder,
410        num_signers_out: NonNull<usize>,
411    ) -> OSStatus;
412}
413
414#[cfg(feature = "SecTrust")]
415#[deprecated = "renamed to `CMSDecoder::copy_signer_status`"]
416#[inline]
417pub unsafe extern "C-unwind" fn CMSDecoderCopySignerStatus(
418    cms_decoder: &CMSDecoder,
419    signer_index: usize,
420    policy_or_array: &CFType,
421    evaluate_sec_trust: bool,
422    signer_status_out: *mut CMSSignerStatus,
423    sec_trust_out: *mut *mut SecTrust,
424    cert_verify_result_code_out: *mut OSStatus,
425) -> OSStatus {
426    extern "C-unwind" {
427        fn CMSDecoderCopySignerStatus(
428            cms_decoder: &CMSDecoder,
429            signer_index: usize,
430            policy_or_array: &CFType,
431            evaluate_sec_trust: Boolean,
432            signer_status_out: *mut CMSSignerStatus,
433            sec_trust_out: *mut *mut SecTrust,
434            cert_verify_result_code_out: *mut OSStatus,
435        ) -> OSStatus;
436    }
437    unsafe {
438        CMSDecoderCopySignerStatus(
439            cms_decoder,
440            signer_index,
441            policy_or_array,
442            evaluate_sec_trust as _,
443            signer_status_out,
444            sec_trust_out,
445            cert_verify_result_code_out,
446        )
447    }
448}
449
450extern "C-unwind" {
451    #[deprecated = "renamed to `CMSDecoder::copy_signer_email_address`"]
452    pub fn CMSDecoderCopySignerEmailAddress(
453        cms_decoder: &CMSDecoder,
454        signer_index: usize,
455        signer_email_address_out: NonNull<*const CFString>,
456    ) -> OSStatus;
457}
458
459extern "C-unwind" {
460    #[cfg(feature = "SecBase")]
461    #[deprecated = "renamed to `CMSDecoder::copy_signer_cert`"]
462    pub fn CMSDecoderCopySignerCert(
463        cms_decoder: &CMSDecoder,
464        signer_index: usize,
465        signer_cert_out: NonNull<*mut SecCertificate>,
466    ) -> OSStatus;
467}
468
469extern "C-unwind" {
470    #[deprecated = "renamed to `CMSDecoder::is_content_encrypted`"]
471    pub fn CMSDecoderIsContentEncrypted(
472        cms_decoder: &CMSDecoder,
473        is_encrypted_out: NonNull<Boolean>,
474    ) -> OSStatus;
475}
476
477extern "C-unwind" {
478    #[deprecated = "renamed to `CMSDecoder::copy_encapsulated_content_type`"]
479    pub fn CMSDecoderCopyEncapsulatedContentType(
480        cms_decoder: &CMSDecoder,
481        e_content_type_out: NonNull<*const CFData>,
482    ) -> OSStatus;
483}
484
485extern "C-unwind" {
486    #[deprecated = "renamed to `CMSDecoder::copy_all_certs`"]
487    pub fn CMSDecoderCopyAllCerts(
488        cms_decoder: &CMSDecoder,
489        certs_out: NonNull<*const CFArray>,
490    ) -> OSStatus;
491}
492
493extern "C-unwind" {
494    #[deprecated = "renamed to `CMSDecoder::copy_content`"]
495    pub fn CMSDecoderCopyContent(
496        cms_decoder: &CMSDecoder,
497        content_out: NonNull<*const CFData>,
498    ) -> OSStatus;
499}
500
501extern "C-unwind" {
502    #[deprecated = "renamed to `CMSDecoder::copy_signer_signing_time`"]
503    pub fn CMSDecoderCopySignerSigningTime(
504        cms_decoder: &CMSDecoder,
505        signer_index: usize,
506        signing_time: NonNull<CFAbsoluteTime>,
507    ) -> OSStatus;
508}
509
510extern "C-unwind" {
511    #[deprecated = "renamed to `CMSDecoder::copy_signer_timestamp`"]
512    pub fn CMSDecoderCopySignerTimestamp(
513        cms_decoder: &CMSDecoder,
514        signer_index: usize,
515        timestamp: NonNull<CFAbsoluteTime>,
516    ) -> OSStatus;
517}
518
519extern "C-unwind" {
520    #[deprecated = "renamed to `CMSDecoder::copy_signer_timestamp_with_policy`"]
521    pub fn CMSDecoderCopySignerTimestampWithPolicy(
522        cms_decoder: &CMSDecoder,
523        time_stamp_policy: Option<&CFType>,
524        signer_index: usize,
525        timestamp: NonNull<CFAbsoluteTime>,
526    ) -> OSStatus;
527}
528
529extern "C-unwind" {
530    #[deprecated = "renamed to `CMSDecoder::copy_signer_timestamp_certificates`"]
531    pub fn CMSDecoderCopySignerTimestampCertificates(
532        cms_decoder: &CMSDecoder,
533        signer_index: usize,
534        certificate_refs: NonNull<*const CFArray>,
535    ) -> OSStatus;
536}