objc2-security 0.3.2

Bindings to the Security framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_generalnametype?language=objc)
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CE_GeneralNameType(pub c_uint);
impl CE_GeneralNameType {
    pub const GNT_OtherName: Self = Self(0);
    pub const GNT_RFC822Name: Self = Self(1);
    pub const GNT_DNSName: Self = Self(2);
    pub const GNT_X400Address: Self = Self(3);
    pub const GNT_DirectoryName: Self = Self(4);
    pub const GNT_EdiPartyName: Self = Self(5);
    pub const GNT_URI: Self = Self(6);
    pub const GNT_IPAddress: Self = Self(7);
    pub const GNT_RegisteredID: Self = Self(8);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CE_GeneralNameType {
    const ENCODING: Encoding = c_uint::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CE_GeneralNameType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_othername?language=objc)
#[cfg(feature = "SecAsn1Types")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_OtherName {
    pub typeId: SecAsn1Oid,
    pub value: SecAsn1Item,
}

#[cfg(all(feature = "SecAsn1Types", feature = "objc2"))]
unsafe impl Encode for CE_OtherName {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_OtherName",
        &[<SecAsn1Oid>::ENCODING, <SecAsn1Item>::ENCODING],
    );
}

#[cfg(all(feature = "SecAsn1Types", feature = "objc2"))]
unsafe impl RefEncode for CE_OtherName {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_generalname?language=objc)
#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "cssmtype"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_GeneralName {
    pub nameType: CE_GeneralNameType,
    pub berEncoded: CSSM_BOOL,
    pub name: SecAsn1Item,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl Encode for CE_GeneralName {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_GeneralName",
        &[
            <CE_GeneralNameType>::ENCODING,
            <CSSM_BOOL>::ENCODING,
            <SecAsn1Item>::ENCODING,
        ],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl RefEncode for CE_GeneralName {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_generalnames?language=objc)
#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "cssmtype"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_GeneralNames {
    pub numNames: uint32,
    pub generalName: *mut CE_GeneralName,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl Encode for CE_GeneralNames {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_GeneralNames",
        &[<uint32>::ENCODING, <*mut CE_GeneralName>::ENCODING],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl RefEncode for CE_GeneralNames {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_authoritykeyid?language=objc)
#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "cssmtype"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_AuthorityKeyID {
    pub keyIdentifierPresent: CSSM_BOOL,
    pub keyIdentifier: SecAsn1Item,
    pub generalNamesPresent: CSSM_BOOL,
    pub generalNames: *mut CE_GeneralNames,
    pub serialNumberPresent: CSSM_BOOL,
    pub serialNumber: SecAsn1Item,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl Encode for CE_AuthorityKeyID {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_AuthorityKeyID",
        &[
            <CSSM_BOOL>::ENCODING,
            <SecAsn1Item>::ENCODING,
            <CSSM_BOOL>::ENCODING,
            <*mut CE_GeneralNames>::ENCODING,
            <CSSM_BOOL>::ENCODING,
            <SecAsn1Item>::ENCODING,
        ],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl RefEncode for CE_AuthorityKeyID {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_subjectkeyid?language=objc)
#[deprecated]
#[cfg(feature = "SecAsn1Types")]
pub type CE_SubjectKeyID = SecAsn1Item;

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_keyusage?language=objc)
#[deprecated]
#[cfg(feature = "cssmconfig")]
pub type CE_KeyUsage = uint16;

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_crlreason?language=objc)
#[deprecated]
#[cfg(feature = "cssmconfig")]
pub type CE_CrlReason = uint32;

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_extendedkeyusage?language=objc)
#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "cssmtype"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_ExtendedKeyUsage {
    pub numPurposes: uint32,
    pub purposes: CSSM_OID_PTR,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl Encode for CE_ExtendedKeyUsage {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_ExtendedKeyUsage",
        &[<uint32>::ENCODING, <CSSM_OID_PTR>::ENCODING],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl RefEncode for CE_ExtendedKeyUsage {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_basicconstraints?language=objc)
#[cfg(all(feature = "cssmconfig", feature = "cssmtype"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_BasicConstraints {
    pub cA: CSSM_BOOL,
    pub pathLenConstraintPresent: CSSM_BOOL,
    pub pathLenConstraint: uint32,
}

#[cfg(all(feature = "cssmconfig", feature = "cssmtype", feature = "objc2"))]
unsafe impl Encode for CE_BasicConstraints {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_BasicConstraints",
        &[
            <CSSM_BOOL>::ENCODING,
            <CSSM_BOOL>::ENCODING,
            <uint32>::ENCODING,
        ],
    );
}

#[cfg(all(feature = "cssmconfig", feature = "cssmtype", feature = "objc2"))]
unsafe impl RefEncode for CE_BasicConstraints {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_policyqualifierinfo?language=objc)
#[cfg(feature = "SecAsn1Types")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_PolicyQualifierInfo {
    pub policyQualifierId: SecAsn1Oid,
    pub qualifier: SecAsn1Item,
}

#[cfg(all(feature = "SecAsn1Types", feature = "objc2"))]
unsafe impl Encode for CE_PolicyQualifierInfo {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_PolicyQualifierInfo",
        &[<SecAsn1Oid>::ENCODING, <SecAsn1Item>::ENCODING],
    );
}

#[cfg(all(feature = "SecAsn1Types", feature = "objc2"))]
unsafe impl RefEncode for CE_PolicyQualifierInfo {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_policyinformation?language=objc)
#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_PolicyInformation {
    pub certPolicyId: SecAsn1Oid,
    pub numPolicyQualifiers: uint32,
    pub policyQualifiers: *mut CE_PolicyQualifierInfo,
}

#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "objc2"))]
unsafe impl Encode for CE_PolicyInformation {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_PolicyInformation",
        &[
            <SecAsn1Oid>::ENCODING,
            <uint32>::ENCODING,
            <*mut CE_PolicyQualifierInfo>::ENCODING,
        ],
    );
}

#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "objc2"))]
unsafe impl RefEncode for CE_PolicyInformation {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_certpolicies?language=objc)
#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_CertPolicies {
    pub numPolicies: uint32,
    pub policies: *mut CE_PolicyInformation,
}

#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "objc2"))]
unsafe impl Encode for CE_CertPolicies {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_CertPolicies",
        &[<uint32>::ENCODING, <*mut CE_PolicyInformation>::ENCODING],
    );
}

#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "objc2"))]
unsafe impl RefEncode for CE_CertPolicies {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_netscapecerttype?language=objc)
#[deprecated]
#[cfg(feature = "cssmconfig")]
pub type CE_NetscapeCertType = uint16;

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_crldistreasonflags?language=objc)
#[deprecated]
#[cfg(feature = "cssmconfig")]
pub type CE_CrlDistReasonFlags = uint8;

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_crldistributionpointnametype?language=objc)
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CE_CrlDistributionPointNameType(pub c_uint);
impl CE_CrlDistributionPointNameType {
    #[doc(alias = "CE_CDNT_FullName")]
    pub const CDNT_FullName: Self = Self(0);
    #[doc(alias = "CE_CDNT_NameRelativeToCrlIssuer")]
    pub const CDNT_NameRelativeToCrlIssuer: Self = Self(1);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CE_CrlDistributionPointNameType {
    const ENCODING: Encoding = c_uint::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CE_CrlDistributionPointNameType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/__ce_distributionpointname_dpn?language=objc)
#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "x509defs"
))]
#[repr(C)]
#[derive(Clone, Copy)]
pub union __CE_DistributionPointName_dpn {
    pub fullName: *mut CE_GeneralNames,
    pub rdn: CSSM_X509_RDN_PTR,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2",
    feature = "x509defs"
))]
unsafe impl Encode for __CE_DistributionPointName_dpn {
    const ENCODING: Encoding = Encoding::Union(
        "?",
        &[
            <*mut CE_GeneralNames>::ENCODING,
            <CSSM_X509_RDN_PTR>::ENCODING,
        ],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2",
    feature = "x509defs"
))]
unsafe impl RefEncode for __CE_DistributionPointName_dpn {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_distributionpointname?language=objc)
#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "x509defs"
))]
#[repr(C)]
#[derive(Clone, Copy)]
pub struct CE_DistributionPointName {
    pub nameType: CE_CrlDistributionPointNameType,
    pub dpn: __CE_DistributionPointName_dpn,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2",
    feature = "x509defs"
))]
unsafe impl Encode for CE_DistributionPointName {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_DistributionPointName",
        &[
            <CE_CrlDistributionPointNameType>::ENCODING,
            <__CE_DistributionPointName_dpn>::ENCODING,
        ],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2",
    feature = "x509defs"
))]
unsafe impl RefEncode for CE_DistributionPointName {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_crldistributionpoint?language=objc)
#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "x509defs"
))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_CRLDistributionPoint {
    pub distPointName: *mut CE_DistributionPointName,
    pub reasonsPresent: CSSM_BOOL,
    pub reasons: CE_CrlDistReasonFlags,
    pub crlIssuer: *mut CE_GeneralNames,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2",
    feature = "x509defs"
))]
unsafe impl Encode for CE_CRLDistributionPoint {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_CRLDistributionPoint",
        &[
            <*mut CE_DistributionPointName>::ENCODING,
            <CSSM_BOOL>::ENCODING,
            <CE_CrlDistReasonFlags>::ENCODING,
            <*mut CE_GeneralNames>::ENCODING,
        ],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2",
    feature = "x509defs"
))]
unsafe impl RefEncode for CE_CRLDistributionPoint {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_crldistpointssyntax?language=objc)
#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "x509defs"
))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_CRLDistPointsSyntax {
    pub numDistPoints: uint32,
    pub distPoints: *mut CE_CRLDistributionPoint,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2",
    feature = "x509defs"
))]
unsafe impl Encode for CE_CRLDistPointsSyntax {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_CRLDistPointsSyntax",
        &[<uint32>::ENCODING, <*mut CE_CRLDistributionPoint>::ENCODING],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2",
    feature = "x509defs"
))]
unsafe impl RefEncode for CE_CRLDistPointsSyntax {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_accessdescription?language=objc)
#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "cssmtype"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_AccessDescription {
    pub accessMethod: SecAsn1Oid,
    pub accessLocation: CE_GeneralName,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl Encode for CE_AccessDescription {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_AccessDescription",
        &[<SecAsn1Oid>::ENCODING, <CE_GeneralName>::ENCODING],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl RefEncode for CE_AccessDescription {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_authorityinfoaccess?language=objc)
#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "cssmtype"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_AuthorityInfoAccess {
    pub numAccessDescriptions: uint32,
    pub accessDescriptions: *mut CE_AccessDescription,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl Encode for CE_AuthorityInfoAccess {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_AuthorityInfoAccess",
        &[<uint32>::ENCODING, <*mut CE_AccessDescription>::ENCODING],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl RefEncode for CE_AuthorityInfoAccess {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_nameregistrationauthorities?language=objc)
#[deprecated]
#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "cssmtype"))]
pub type CE_NameRegistrationAuthorities = CE_GeneralNames;

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_semanticsinformation?language=objc)
#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "cssmtype"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_SemanticsInformation {
    pub semanticsIdentifier: *mut SecAsn1Oid,
    pub nameRegistrationAuthorities: *mut CE_NameRegistrationAuthorities,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl Encode for CE_SemanticsInformation {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_SemanticsInformation",
        &[
            <*mut SecAsn1Oid>::ENCODING,
            <*mut CE_NameRegistrationAuthorities>::ENCODING,
        ],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl RefEncode for CE_SemanticsInformation {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_qc_statement?language=objc)
#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "cssmtype"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_QC_Statement {
    pub statementId: SecAsn1Oid,
    pub semanticsInfo: *mut CE_SemanticsInformation,
    pub otherInfo: *mut SecAsn1Item,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl Encode for CE_QC_Statement {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_QC_Statement",
        &[
            <SecAsn1Oid>::ENCODING,
            <*mut CE_SemanticsInformation>::ENCODING,
            <*mut SecAsn1Item>::ENCODING,
        ],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl RefEncode for CE_QC_Statement {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_qc_statements?language=objc)
#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "cssmtype"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_QC_Statements {
    pub numQCStatements: uint32,
    pub qcStatements: *mut CE_QC_Statement,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl Encode for CE_QC_Statements {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_QC_Statements",
        &[<uint32>::ENCODING, <*mut CE_QC_Statement>::ENCODING],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl RefEncode for CE_QC_Statements {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// * CRL extensions **
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/security/ce_crlnumber?language=objc)
#[cfg(feature = "cssmconfig")]
pub type CE_CrlNumber = uint32;

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_deltacrl?language=objc)
#[cfg(feature = "cssmconfig")]
pub type CE_DeltaCrl = uint32;

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_issuingdistributionpoint?language=objc)
#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "x509defs"
))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_IssuingDistributionPoint {
    pub distPointName: *mut CE_DistributionPointName,
    pub onlyUserCertsPresent: CSSM_BOOL,
    pub onlyUserCerts: CSSM_BOOL,
    pub onlyCACertsPresent: CSSM_BOOL,
    pub onlyCACerts: CSSM_BOOL,
    pub onlySomeReasonsPresent: CSSM_BOOL,
    pub onlySomeReasons: CE_CrlDistReasonFlags,
    pub indirectCrlPresent: CSSM_BOOL,
    pub indirectCrl: CSSM_BOOL,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2",
    feature = "x509defs"
))]
unsafe impl Encode for CE_IssuingDistributionPoint {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_IssuingDistributionPoint",
        &[
            <*mut CE_DistributionPointName>::ENCODING,
            <CSSM_BOOL>::ENCODING,
            <CSSM_BOOL>::ENCODING,
            <CSSM_BOOL>::ENCODING,
            <CSSM_BOOL>::ENCODING,
            <CSSM_BOOL>::ENCODING,
            <CE_CrlDistReasonFlags>::ENCODING,
            <CSSM_BOOL>::ENCODING,
            <CSSM_BOOL>::ENCODING,
        ],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2",
    feature = "x509defs"
))]
unsafe impl RefEncode for CE_IssuingDistributionPoint {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_generalsubtree?language=objc)
#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "cssmtype"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_GeneralSubtree {
    pub base: *mut CE_GeneralNames,
    pub minimum: uint32,
    pub maximumPresent: CSSM_BOOL,
    pub maximum: uint32,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl Encode for CE_GeneralSubtree {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_GeneralSubtree",
        &[
            <*mut CE_GeneralNames>::ENCODING,
            <uint32>::ENCODING,
            <CSSM_BOOL>::ENCODING,
            <uint32>::ENCODING,
        ],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl RefEncode for CE_GeneralSubtree {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_generalsubtrees?language=objc)
#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "cssmtype"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_GeneralSubtrees {
    pub numSubtrees: uint32,
    pub subtrees: *mut CE_GeneralSubtree,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl Encode for CE_GeneralSubtrees {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_GeneralSubtrees",
        &[<uint32>::ENCODING, <*mut CE_GeneralSubtree>::ENCODING],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl RefEncode for CE_GeneralSubtrees {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_nameconstraints?language=objc)
#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "cssmtype"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_NameConstraints {
    pub permitted: *mut CE_GeneralSubtrees,
    pub excluded: *mut CE_GeneralSubtrees,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl Encode for CE_NameConstraints {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_NameConstraints",
        &[
            <*mut CE_GeneralSubtrees>::ENCODING,
            <*mut CE_GeneralSubtrees>::ENCODING,
        ],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2"
))]
unsafe impl RefEncode for CE_NameConstraints {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_policymapping?language=objc)
#[cfg(feature = "SecAsn1Types")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_PolicyMapping {
    pub issuerDomainPolicy: SecAsn1Oid,
    pub subjectDomainPolicy: SecAsn1Oid,
}

#[cfg(all(feature = "SecAsn1Types", feature = "objc2"))]
unsafe impl Encode for CE_PolicyMapping {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_PolicyMapping",
        &[<SecAsn1Oid>::ENCODING, <SecAsn1Oid>::ENCODING],
    );
}

#[cfg(all(feature = "SecAsn1Types", feature = "objc2"))]
unsafe impl RefEncode for CE_PolicyMapping {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_policymappings?language=objc)
#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_PolicyMappings {
    pub numPolicyMappings: uint32,
    pub policyMappings: *mut CE_PolicyMapping,
}

#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "objc2"))]
unsafe impl Encode for CE_PolicyMappings {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_PolicyMappings",
        &[<uint32>::ENCODING, <*mut CE_PolicyMapping>::ENCODING],
    );
}

#[cfg(all(feature = "SecAsn1Types", feature = "cssmconfig", feature = "objc2"))]
unsafe impl RefEncode for CE_PolicyMappings {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_policyconstraints?language=objc)
#[cfg(all(feature = "cssmconfig", feature = "cssmtype"))]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CE_PolicyConstraints {
    pub requireExplicitPolicyPresent: CSSM_BOOL,
    pub requireExplicitPolicy: uint32,
    pub inhibitPolicyMappingPresent: CSSM_BOOL,
    pub inhibitPolicyMapping: uint32,
}

#[cfg(all(feature = "cssmconfig", feature = "cssmtype", feature = "objc2"))]
unsafe impl Encode for CE_PolicyConstraints {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_PolicyConstraints",
        &[
            <CSSM_BOOL>::ENCODING,
            <uint32>::ENCODING,
            <CSSM_BOOL>::ENCODING,
            <uint32>::ENCODING,
        ],
    );
}

#[cfg(all(feature = "cssmconfig", feature = "cssmtype", feature = "objc2"))]
unsafe impl RefEncode for CE_PolicyConstraints {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_inhibitanypolicy?language=objc)
#[deprecated]
#[cfg(feature = "cssmconfig")]
pub type CE_InhibitAnyPolicy = uint32;

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_datatype?language=objc)
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CE_DataType(pub c_uint);
impl CE_DataType {
    pub const DT_AuthorityKeyID: Self = Self(0);
    pub const DT_SubjectKeyID: Self = Self(1);
    pub const DT_KeyUsage: Self = Self(2);
    pub const DT_SubjectAltName: Self = Self(3);
    pub const DT_IssuerAltName: Self = Self(4);
    pub const DT_ExtendedKeyUsage: Self = Self(5);
    pub const DT_BasicConstraints: Self = Self(6);
    pub const DT_CertPolicies: Self = Self(7);
    pub const DT_NetscapeCertType: Self = Self(8);
    pub const DT_CrlNumber: Self = Self(9);
    pub const DT_DeltaCrl: Self = Self(10);
    pub const DT_CrlReason: Self = Self(11);
    pub const DT_CrlDistributionPoints: Self = Self(12);
    pub const DT_IssuingDistributionPoint: Self = Self(13);
    pub const DT_AuthorityInfoAccess: Self = Self(14);
    pub const DT_Other: Self = Self(15);
    pub const DT_QC_Statements: Self = Self(16);
    pub const DT_NameConstraints: Self = Self(17);
    pub const DT_PolicyMappings: Self = Self(18);
    pub const DT_PolicyConstraints: Self = Self(19);
    pub const DT_InhibitAnyPolicy: Self = Self(20);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CE_DataType {
    const ENCODING: Encoding = c_uint::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CE_DataType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_data?language=objc)
#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "x509defs"
))]
#[repr(C)]
#[derive(Clone, Copy)]
pub union CE_Data {
    pub authorityKeyID: CE_AuthorityKeyID,
    pub subjectKeyID: CE_SubjectKeyID,
    pub keyUsage: CE_KeyUsage,
    pub subjectAltName: CE_GeneralNames,
    pub issuerAltName: CE_GeneralNames,
    pub extendedKeyUsage: CE_ExtendedKeyUsage,
    pub basicConstraints: CE_BasicConstraints,
    pub certPolicies: CE_CertPolicies,
    pub netscapeCertType: CE_NetscapeCertType,
    pub crlNumber: CE_CrlNumber,
    pub deltaCrl: CE_DeltaCrl,
    pub crlReason: CE_CrlReason,
    pub crlDistPoints: CE_CRLDistPointsSyntax,
    pub issuingDistPoint: CE_IssuingDistributionPoint,
    pub authorityInfoAccess: CE_AuthorityInfoAccess,
    pub qualifiedCertStatements: CE_QC_Statements,
    pub nameConstraints: CE_NameConstraints,
    pub policyMappings: CE_PolicyMappings,
    pub policyConstraints: CE_PolicyConstraints,
    pub inhibitAnyPolicy: CE_InhibitAnyPolicy,
    pub rawData: SecAsn1Item,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2",
    feature = "x509defs"
))]
unsafe impl Encode for CE_Data {
    const ENCODING: Encoding = Encoding::Union(
        "?",
        &[
            <CE_AuthorityKeyID>::ENCODING,
            <CE_SubjectKeyID>::ENCODING,
            <CE_KeyUsage>::ENCODING,
            <CE_GeneralNames>::ENCODING,
            <CE_GeneralNames>::ENCODING,
            <CE_ExtendedKeyUsage>::ENCODING,
            <CE_BasicConstraints>::ENCODING,
            <CE_CertPolicies>::ENCODING,
            <CE_NetscapeCertType>::ENCODING,
            <CE_CrlNumber>::ENCODING,
            <CE_DeltaCrl>::ENCODING,
            <CE_CrlReason>::ENCODING,
            <CE_CRLDistPointsSyntax>::ENCODING,
            <CE_IssuingDistributionPoint>::ENCODING,
            <CE_AuthorityInfoAccess>::ENCODING,
            <CE_QC_Statements>::ENCODING,
            <CE_NameConstraints>::ENCODING,
            <CE_PolicyMappings>::ENCODING,
            <CE_PolicyConstraints>::ENCODING,
            <CE_InhibitAnyPolicy>::ENCODING,
            <SecAsn1Item>::ENCODING,
        ],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2",
    feature = "x509defs"
))]
unsafe impl RefEncode for CE_Data {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/ce_dataandtype?language=objc)
#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "x509defs"
))]
#[repr(C)]
#[derive(Clone, Copy)]
pub struct CE_DataAndType {
    pub r#type: CE_DataType,
    pub extension: CE_Data,
    pub critical: CSSM_BOOL,
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2",
    feature = "x509defs"
))]
unsafe impl Encode for CE_DataAndType {
    const ENCODING: Encoding = Encoding::Struct(
        "__CE_DataAndType",
        &[
            <CE_DataType>::ENCODING,
            <CE_Data>::ENCODING,
            <CSSM_BOOL>::ENCODING,
        ],
    );
}

#[cfg(all(
    feature = "SecAsn1Types",
    feature = "cssmconfig",
    feature = "cssmtype",
    feature = "objc2",
    feature = "x509defs"
))]
unsafe impl RefEncode for CE_DataAndType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}