2  * Copyright (c) 2000-2009,2011,2012,2014,2016 Apple Inc. All Rights Reserved. 
   4  * @APPLE_LICENSE_HEADER_START@ 
   6  * This file contains Original Code and/or Modifications of Original Code 
   7  * as defined in and that are subject to the Apple Public Source License 
   8  * Version 2.0 (the 'License'). You may not use this file except in 
   9  * compliance with the License. Please obtain a copy of the License at 
  10  * http://www.opensource.apple.com/apsl/ and read it before using this 
  13  * The Original Code and all software distributed under the License are 
  14  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
  15  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
  16  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 
  17  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
  18  * Please see the License for the specific language governing rights and 
  19  * limitations under the License. 
  21  * @APPLE_LICENSE_HEADER_END@ 
  23  * CertExtensions.h -- X.509 Cert Extensions as C structs 
  26 #ifndef _CERT_EXTENSIONS_H_ 
  27 #define _CERT_EXTENSIONS_H_ 
  29 #include <Security/SecBase.h> 
  33 #include <Security/cssmtype.h> 
  34 #include <Security/x509defs.h> /* CSSM_X509_RDN_PTR */ 
  35 #pragma clang diagnostic push 
  36 #pragma clang diagnostic ignored "-Wdeprecated-declarations" 
  38 #else /* SEC_OS_IPHONE */ 
  41 #include <libDER/libDER.h> 
  43 #endif /* SEC_OS_IPHONE */ 
  46  *** Structs for declaring extension-specific data. 
  50  * GeneralName, used in AuthorityKeyID, SubjectAltName, and 
  53  * For now, we just provide explicit support for the types which are 
  54  * represented as IA5Strings, OIDs, and octet strings. Constructed types 
  55  * such as EDIPartyName and x400Address are not explicitly handled 
  56  * right now and must be encoded and decoded by the caller. (See exception 
  57  * for Name and OtherName, below). In those cases the SecECGeneralName.name.Data / CE_GeneralName.name.Data field 
  58  * represents the BER contents octets; SecCEGeneralName.name.Length / CE_GeneralName.name.Length is the 
  59  * length of the contents; the tag of the field is not needed - the BER 
  60  * encoding uses context-specific implicit tagging. The berEncoded field 
  61  * is set to true / CSSM_TRUE in these case. Simple types have berEncoded = false / CSSM_FALSE. 
  63  * In the case of a GeneralName in the form of a Name, we parse the Name 
  64  * into a CSSM_X509_NAME and place a pointer to the CSSM_X509_NAME in the 
  65  * CE_GeneralName.name.Data field. SecCEGeneralName.name.Length / CE_GeneralName.name.Length is set to 
  66  * sizeof(CSSM_X509_NAME). In this case berEncoded is false. 
  68  * In the case of a GeneralName in the form of a OtherName, we parse the fields 
  69  * into a CE_OtherName and place a pointer to the SecCEOtherName / CE_OtherName in the 
  70  * SecCEGeneralName.name.Data / CE_GeneralName.name.Data field. SecCEGeneralName.name.Length / CE_GeneralName.name.Length is set to 
  71  * sizeof(SecCEOtherName) / sizeof(CE_OtherName). In this case berEncoded is false. 
  73  *      GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName 
  75  *      GeneralName ::= CHOICE { 
  76  *           otherName                       [0]     OtherName 
  77  *           rfc822Name                      [1]     IA5String, 
  78  *           dNSName                         [2]     IA5String, 
  79  *           x400Address                     [3]     ORAddress, 
  80  *           directoryName                   [4]     Name, 
  81  *           ediPartyName                    [5]     EDIPartyName, 
  82  *           uniformResourceIdentifier       [6]     IA5String, 
  83  *           iPAddress                       [7]     OCTET STRING, 
  84  *           registeredID                    [8]     OBJECT IDENTIFIER} 
  86  *      OtherName ::= SEQUENCE { 
  87  *           type-id    OBJECT IDENTIFIER, 
  88  *           value      [0] EXPLICIT ANY DEFINED BY type-id } 
  90  *      EDIPartyName ::= SEQUENCE { 
  91  *           nameAssigner            [0]     DirectoryString OPTIONAL, 
  92  *           partyName               [1]     DirectoryString } 
  95 typedef enum __CE_GeneralNameType 
{ 
 105 } CE_GeneralNameType
; 
 119 } SecCEGeneralNameType
; 
 121 #endif /* SEC_OS_IPHONE */ 
 125 typedef struct __CE_OtherName 
{ 
 127         CSSM_DATA                               value
;          // unparsed, BER-encoded 
 128 } CE_OtherName DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 130 typedef struct __CE_GeneralName 
{ 
 131         CE_GeneralNameType              nameType
;       // GNT_RFC822Name, etc. 
 132         CSSM_BOOL                               berEncoded
; 
 134 } CE_GeneralName DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 136 typedef struct __CE_GeneralNames 
{ 
 138         CE_GeneralName                  
*generalName
; 
 139 } CE_GeneralNames DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 145         DERItem                 value
;          // unparsed, BER-encoded 
 149         SecCEGeneralNameType            nameType
;       // GNT_RFC822Name, etc. 
 156         SecCEGeneralName                        
*generalName
; 
 159 #endif /* SEC_OS_IPHONE */ 
 162  * id-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::=  { id-ce 35 } 
 164  *   AuthorityKeyIdentifier ::= SEQUENCE { 
 165  *     keyIdentifier             [0] KeyIdentifier           OPTIONAL, 
 166  *     authorityCertIssuer       [1] GeneralNames            OPTIONAL, 
 167  *     authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL  } 
 169  *   KeyIdentifier ::= OCTET STRING 
 171  * CSSM OID = CSSMOID_AuthorityKeyIdentifier 
 174 typedef struct __CE_AuthorityKeyID 
{ 
 175         CSSM_BOOL                       keyIdentifierPresent
; 
 176         CSSM_DATA                       keyIdentifier
; 
 177         CSSM_BOOL                       generalNamesPresent
; 
 178         CE_GeneralNames         
*generalNames
; 
 179         CSSM_BOOL                       serialNumberPresent
; 
 180         CSSM_DATA                       serialNumber
; 
 181 } CE_AuthorityKeyID DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 184         bool                keyIdentifierPresent
; 
 185         DERItem             keyIdentifier
; 
 186         bool                generalNamesPresent
; 
 187         SecCEGeneralNames               
*generalNames
; 
 188         bool                serialNumberPresent
; 
 189         DERItem             serialNumber
; 
 190 } SecCEAuthorityKeyID
; 
 191 #endif /* SEC_OS_IPHONE */ 
 194  * id-ce-subjectKeyIdentifier OBJECT IDENTIFIER ::=  { id-ce 14 } 
 195  *   SubjectKeyIdentifier ::= KeyIdentifier 
 197  * CSSM OID = CSSMOID_SubjectKeyIdentifier 
 200 typedef CSSM_DATA CE_SubjectKeyID DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 202 typedef DERItem SecCESubjectKeyID
; 
 203 #endif /* SEC_OS_IPHONE */ 
 206  * id-ce-keyUsage OBJECT IDENTIFIER ::=  { id-ce 15 } 
 208  *     KeyUsage ::= BIT STRING { 
 209  *          digitalSignature        (0), 
 210  *          nonRepudiation          (1), 
 211  *          keyEncipherment         (2), 
 212  *          dataEncipherment        (3), 
 219  * CSSM OID = CSSMOID_KeyUsage 
 223 typedef uint16 CE_KeyUsage DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 225 typedef uint16_t SecCEKeyUsage
; 
 226 #endif /* SEC_OS_IPHONE */ 
 229 #define CE_KU_DigitalSignature  0x8000 
 230 #define CE_KU_NonRepudiation    0x4000 
 231 #define CE_KU_KeyEncipherment   0x2000 
 232 #define CE_KU_DataEncipherment  0x1000 
 233 #define CE_KU_KeyAgreement              0x0800 
 234 #define CE_KU_KeyCertSign               0x0400 
 235 #define CE_KU_CRLSign                   0x0200 
 236 #define CE_KU_EncipherOnly              0x0100 
 237 #define CE_KU_DecipherOnly              0x0080 
 238 #else /* SEC_OS_IPHONE */ 
 239 #define SecCEKU_DigitalSignature        0x8000 
 240 #define SecCEKU_NonRepudiation  0x4000 
 241 #define SecCEKU_KeyEncipherment 0x2000 
 242 #define SecCEKU_DataEncipherment        0x1000 
 243 #define SecCEKU_KeyAgreement            0x0800 
 244 #define SecCEKU_KeyCertSign             0x0400 
 245 #define SecCEKU_CRLSign                 0x0200 
 246 #define SecCEKU_EncipherOnly            0x0100 
 247 #define SecCEKU_DecipherOnly     0x0080 
 248 #endif /* SEC_OS_IPHONE */ 
 251  *  id-ce-cRLReason OBJECT IDENTIFIER ::= { id-ce 21 } 
 253  *   -- reasonCode ::= { CRLReason } 
 255  *   CRLReason ::= ENUMERATED { 
 259  *      affiliationChanged      (3), 
 261  *      cessationOfOperation    (5), 
 262  *              certificateHold         (6), 
 263  *              removeFromCRL           (8) } 
 265  * CSSM OID = CSSMOID_CrlReason 
 269 typedef uint32 CE_CrlReason DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 271 typedef uint32_t SecCECrlReason
; 
 272 #endif /* SEC_OS_IPHONE */ 
 275 #define CE_CR_Unspecified                       0 
 276 #define CE_CR_KeyCompromise                     1 
 277 #define CE_CR_CACompromise                      2 
 278 #define CE_CR_AffiliationChanged        3 
 279 #define CE_CR_Superseded                        4 
 280 #define CE_CR_CessationOfOperation      5 
 281 #define CE_CR_CertificateHold           6 
 282 #define CE_CR_RemoveFromCRL                     8 
 284 #define SecCECR_Unspecified                     0 
 285 #define SecCECR_KeyCompromise                   1 
 286 #define SecCECR_CACompromise                    2 
 287 #define SecCECR_AffiliationChanged      3 
 288 #define SecCECR_Superseded                      4 
 289 #define SecCECR_CessationOfOperation    5 
 290 #define SecCECR_CertificateHold         6 
 291 #define SecCECR_RemoveFromCRL                   8 
 292 #endif /* SEC_OS_IPHONE */ 
 295  * id-ce-subjectAltName OBJECT IDENTIFIER ::=  { id-ce 17 } 
 297  *      SubjectAltName ::= GeneralNames 
 299  * CSSM OID = CSSMOID_SubjectAltName 
 301  * GeneralNames defined above. 
 305  *  id-ce-extKeyUsage OBJECT IDENTIFIER ::= {id-ce 37} 
 307  *   ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId* 
 309  *  KeyPurposeId ::= OBJECT IDENTIFIER 
 311  * CSSM OID = CSSMOID_ExtendedKeyUsage 
 314 typedef struct __CE_ExtendedKeyUsage 
{ 
 316         CSSM_OID_PTR    purposes
;               // in Intel pre-encoded format 
 317 } CE_ExtendedKeyUsage
; 
 322         uint32_t                numPurposes
; 
 323         DERItem         
*purposes
;              // in Intel pre-encoded format 
 324 } SecCEExtendedKeyUsage
; 
 325 #endif /* SEC_OS_IPHONE */ 
 328  * id-ce-basicConstraints OBJECT IDENTIFIER ::=  { id-ce 19 } 
 330  * BasicConstraints ::= SEQUENCE { 
 331  *       cA                      BOOLEAN DEFAULT FALSE, 
 332  *       pathLenConstraint       INTEGER (0..MAX) OPTIONAL } 
 334  * CSSM OID = CSSMOID_BasicConstraints 
 337 typedef struct __CE_BasicConstraints 
{ 
 339         CSSM_BOOL                       pathLenConstraintPresent
; 
 340         uint32                          pathLenConstraint
; 
 341 } CE_BasicConstraints DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 349         bool                pathLenConstraintPresent
; 
 350         uint32_t                        pathLenConstraint
; 
 351 } SecCEBasicConstraints
; 
 356         bool                requireExplicitPolicyPresent
; 
 357         uint32_t                        requireExplicitPolicy
; 
 358         bool                inhibitPolicyMappingPresent
; 
 359         uint32_t                        inhibitPolicyMapping
; 
 360 } SecCEPolicyConstraints
; 
 361 #endif /* SEC_OS_IPHONE */ 
 364  * id-ce-certificatePolicies OBJECT IDENTIFIER ::=  { id-ce 32 } 
 366  *   certificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation 
 368  *   PolicyInformation ::= SEQUENCE { 
 369  *        policyIdentifier   CertPolicyId, 
 370  *        policyQualifiers   SEQUENCE SIZE (1..MAX) OF 
 371  *                                PolicyQualifierInfo OPTIONAL } 
 373  *   CertPolicyId ::= OBJECT IDENTIFIER 
 375  *   PolicyQualifierInfo ::= SEQUENCE { 
 376  *        policyQualifierId  PolicyQualifierId, 
 377  *        qualifier          ANY DEFINED BY policyQualifierId } 
 379  *   -- policyQualifierIds for Internet policy qualifiers 
 381  *   id-qt          OBJECT IDENTIFIER ::=  { id-pkix 2 } 
 382  *   id-qt-cps      OBJECT IDENTIFIER ::=  { id-qt 1 } 
 383  *   id-qt-unotice  OBJECT IDENTIFIER ::=  { id-qt 2 } 
 385  *   PolicyQualifierId ::= 
 386  *        OBJECT IDENTIFIER ( id-qt-cps | id-qt-unotice ) 
 388  *   Qualifier ::= CHOICE { 
 390  *        userNotice       UserNotice } 
 392  *   CPSuri ::= IA5String 
 394  *   UserNotice ::= SEQUENCE { 
 395  *        noticeRef        NoticeReference OPTIONAL, 
 396  *        explicitText     DisplayText OPTIONAL} 
 398  *   NoticeReference ::= SEQUENCE { 
 399  *        organization     DisplayText, 
 400  *        noticeNumbers    SEQUENCE OF INTEGER } 
 402  *   DisplayText ::= CHOICE { 
 403  *        visibleString    VisibleString  (SIZE (1..200)), 
 404  *        bmpString        BMPString      (SIZE (1..200)), 
 405  *        utf8String       UTF8String     (SIZE (1..200)) } 
 407  *  CSSM OID = CSSMOID_CertificatePolicies 
 409  * We only support down to the level of Qualifier, and then only the CPSuri 
 410  * choice. UserNotice is transmitted to and from this library as a raw 
 411  * CSSM_DATA containing the BER-encoded UserNotice sequence. 
 415 typedef struct __CE_PolicyQualifierInfo 
{ 
 416         CSSM_OID        policyQualifierId
;                      // CSSMOID_QT_CPS, CSSMOID_QT_UNOTICE 
 417         CSSM_DATA       qualifier
;                                      // CSSMOID_QT_CPS: IA5String contents 
 422         DERItem     policyQualifierId
;                  // CSSMOID_QT_CPS, CSSMOID_QT_UNOTICE 
 423         DERItem     qualifier
;                                  // CSSMOID_QT_CPS: IA5String contents 
 424 } SecCEPolicyQualifierInfo
; 
 428     DERItem policyIdentifier
; 
 429     DERItem policyQualifiers
; 
 430 } SecCEPolicyInformation
; 
 435         size_t                  numPolicies
;                    // size of *policies; 
 436         SecCEPolicyInformation  
*policies
; 
 437 } SecCECertificatePolicies
; 
 440     DERItem issuerDomainPolicy
; 
 441     DERItem subjectDomainPolicy
; 
 442 } SecCEPolicyMapping
; 
 445    PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE { 
 446         issuerDomainPolicy      CertPolicyId, 
 447         subjectDomainPolicy     CertPolicyId } 
 452         size_t            numMappings
;                  // size of *mappings; 
 453         SecCEPolicyMapping  
*mappings
; 
 454 } SecCEPolicyMappings
; 
 457      InhibitAnyPolicy ::= SkipCerts 
 458      SkipCerts ::= INTEGER (0..MAX) 
 464 } SecCEInhibitAnyPolicy
; 
 465 #endif /* SEC_OS_IPHONE */ 
 466                                                                                         // CSSMOID_QT_UNOTICE : Sequence contents 
 468 } CE_PolicyQualifierInfo DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 470 typedef struct __CE_PolicyInformation 
{ 
 471         CSSM_OID                                certPolicyId
; 
 472         uint32                                  numPolicyQualifiers
;    // size of *policyQualifiers; 
 473         CE_PolicyQualifierInfo  
*policyQualifiers
; 
 474 } CE_PolicyInformation DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 476 typedef struct __CE_CertPolicies 
{ 
 477         uint32                                  numPolicies
;                    // size of *policies; 
 478         CE_PolicyInformation    
*policies
; 
 479 } CE_CertPolicies DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 482  * netscape-cert-type, a bit string. 
 484  * CSSM OID = CSSMOID_NetscapeCertType 
 486  * Bit fields defined in oidsattr.h: CE_NCT_SSL_Client, etc. 
 488 typedef uint16 CE_NetscapeCertType DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 491  * CRLDistributionPoints. 
 493  *   id-ce-cRLDistributionPoints OBJECT IDENTIFIER ::=  { id-ce 31 } 
 495  *   cRLDistributionPoints ::= { 
 496  *        CRLDistPointsSyntax } 
 498  *   CRLDistPointsSyntax ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint 
 500  *   NOTE: RFC 2459 claims that the tag for the optional DistributionPointName 
 501  *   is IMPLICIT as shown here, but in practice it is EXPLICIT. It has to be - 
 502  *   because the underlying type also uses an implicit tag for distinguish 
 505  *   DistributionPoint ::= SEQUENCE { 
 506  *        distributionPoint       [0]     DistributionPointName OPTIONAL, 
 507  *        reasons                 [1]     ReasonFlags OPTIONAL, 
 508  *        cRLIssuer               [2]     GeneralNames OPTIONAL } 
 510  *   DistributionPointName ::= CHOICE { 
 511  *        fullName                [0]     GeneralNames, 
 512  *        nameRelativeToCRLIssuer [1]     RelativeDistinguishedName } 
 514  *   ReasonFlags ::= BIT STRING { 
 518  *        affiliationChanged      (3), 
 520  *        cessationOfOperation    (5), 
 521  *        certificateHold         (6) } 
 523  * CSSM OID = CSSMOID_CrlDistributionPoints 
 527  * Note that this looks similar to CE_CrlReason, but that's an enum and this 
 528  * is an OR-able bit string. 
 530 typedef uint8 CE_CrlDistReasonFlags DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 532 #define CE_CD_Unspecified                       0x80 
 533 #define CE_CD_KeyCompromise                     0x40 
 534 #define CE_CD_CACompromise                      0x20 
 535 #define CE_CD_AffiliationChanged        0x10 
 536 #define CE_CD_Superseded                        0x08 
 537 #define CE_CD_CessationOfOperation      0x04 
 538 #define CE_CD_CertificateHold           0x02 
 540 typedef enum __CE_CrlDistributionPointNameType 
{ 
 542         CE_CDNT_NameRelativeToCrlIssuer
 
 543 } CE_CrlDistributionPointNameType DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 545 typedef struct __CE_DistributionPointName 
{ 
 546         CE_CrlDistributionPointNameType         nameType
; 
 548                 CE_GeneralNames                                 
*fullName
; 
 549                 CSSM_X509_RDN_PTR                               rdn
; 
 551 } CE_DistributionPointName DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 554  * The top-level CRLDistributionPoint. 
 555  * All fields are optional; NULL pointers indicate absence. 
 557 typedef struct __CE_CRLDistributionPoint 
{ 
 558         CE_DistributionPointName                        
*distPointName
; 
 559         CSSM_BOOL                                                       reasonsPresent
; 
 560         CE_CrlDistReasonFlags                           reasons
; 
 561         CE_GeneralNames                                         
*crlIssuer
; 
 562 } CE_CRLDistributionPoint DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 564 typedef struct __CE_CRLDistPointsSyntax 
{ 
 565         uint32                                                          numDistPoints
; 
 566         CE_CRLDistributionPoint                         
*distPoints
; 
 567 } CE_CRLDistPointsSyntax DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 570  * Authority Information Access and Subject Information Access. 
 572  * CSSM OID = CSSMOID_AuthorityInfoAccess 
 573  * CSSM OID = CSSMOID_SubjectInfoAccess 
 575  * SubjAuthInfoAccessSyntax  ::= 
 576  *              SEQUENCE SIZE (1..MAX) OF AccessDescription 
 578  * AccessDescription  ::=  SEQUENCE { 
 579  *              accessMethod          OBJECT IDENTIFIER, 
 580  *              accessLocation        GeneralName  } 
 582 typedef struct __CE_AccessDescription 
{ 
 583         CSSM_OID                                accessMethod
; 
 584         CE_GeneralName                  accessLocation
; 
 585 } CE_AccessDescription DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 587 typedef struct __CE_AuthorityInfoAccess 
{ 
 588         uint32                                  numAccessDescriptions
; 
 589         CE_AccessDescription    
*accessDescriptions
; 
 590 } CE_AuthorityInfoAccess DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 593  * Qualified Certificate Statement support, per RFC 3739. 
 595  * First, NameRegistrationAuthorities, a component of 
 596  * SemanticsInformation; it's the same as a GeneralNames - 
 597  * a sequence of GeneralName. 
 599 typedef CE_GeneralNames CE_NameRegistrationAuthorities DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 602  * SemanticsInformation, identified as the qcType field 
 603  * of a CE_QC_Statement for statementId value id-qcs-pkixQCSyntax-v2. 
 604  * Both fields optional; at least one must be present. 
 606 typedef struct __CE_SemanticsInformation 
{ 
 607         CSSM_OID                                                        
*semanticsIdentifier
; 
 608         CE_NameRegistrationAuthorities          
*nameRegistrationAuthorities
; 
 609 } CE_SemanticsInformation DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 612  * One Qualified Certificate Statement. 
 613  * The statementId OID is required; zero or one of {semanticsInfo, 
 614  * otherInfo} can be valid, depending on the value of statementId. 
 615  * For statementId id-qcs-pkixQCSyntax-v2 (CSSMOID_OID_QCS_SYNTAX_V2), 
 616  * the semanticsInfo field may be present; otherwise, DER-encoded 
 617  * information may be present in otherInfo. Both semanticsInfo and 
 618  * otherInfo are optional. 
 620 typedef struct __CE_QC_Statement 
{ 
 621         CSSM_OID                                                        statementId
; 
 622         CE_SemanticsInformation                         
*semanticsInfo
; 
 623         CSSM_DATA                                                       
*otherInfo
; 
 624 } CE_QC_Statement DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 627  * The top-level Qualified Certificate Statements extension. 
 629 typedef struct __CE_QC_Statements 
{ 
 630         uint32                                                          numQCStatements
; 
 631         CE_QC_Statement                                         
*qcStatements
; 
 632 } CE_QC_Statements DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 634 /*** CRL extensions ***/ 
 637  * cRLNumber, an integer. 
 639  * CSSM OID = CSSMOID_CrlNumber 
 641 typedef uint32 CE_CrlNumber
; 
 644  * deltaCRLIndicator, an integer. 
 646  * CSSM OID = CSSMOID_DeltaCrlIndicator 
 648 typedef uint32 CE_DeltaCrl
; 
 651  * IssuingDistributionPoint 
 653  * id-ce-issuingDistributionPoint OBJECT IDENTIFIER ::= { id-ce 28 } 
 655  * issuingDistributionPoint ::= SEQUENCE { 
 656  *      distributionPoint       [0] DistributionPointName OPTIONAL, 
 657  *              onlyContainsUserCerts   [1] BOOLEAN DEFAULT FALSE, 
 658  *      onlyContainsCACerts     [2] BOOLEAN DEFAULT FALSE, 
 659  *      onlySomeReasons         [3] ReasonFlags OPTIONAL, 
 660  *      indirectCRL             [4] BOOLEAN DEFAULT FALSE } 
 662  * CSSM OID = CSSMOID_IssuingDistributionPoint 
 664 typedef struct __CE_IssuingDistributionPoint 
{ 
 665         CE_DistributionPointName        
*distPointName
;         // optional 
 666         CSSM_BOOL                                       onlyUserCertsPresent
; 
 667         CSSM_BOOL                                       onlyUserCerts
; 
 668         CSSM_BOOL                                       onlyCACertsPresent
; 
 669         CSSM_BOOL                                       onlyCACerts
; 
 670         CSSM_BOOL                                       onlySomeReasonsPresent
; 
 671         CE_CrlDistReasonFlags           onlySomeReasons
; 
 672         CSSM_BOOL                                       indirectCrlPresent
; 
 673         CSSM_BOOL                                       indirectCrl
; 
 674 } CE_IssuingDistributionPoint DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 679  * id-ce-nameConstraints OBJECT IDENTIFIER ::=  { id-ce 30 } 
 681  *     NameConstraints ::= SEQUENCE { 
 682  *          permittedSubtrees       [0]     GeneralSubtrees OPTIONAL, 
 683  *          excludedSubtrees        [1]     GeneralSubtrees OPTIONAL } 
 685  *     GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree 
 687  *     GeneralSubtree ::= SEQUENCE { 
 689  *          minimum         [0]     BaseDistance DEFAULT 0, 
 690  *          maximum         [1]     BaseDistance OPTIONAL } 
 692  *     BaseDistance ::= INTEGER (0..MAX) 
 694 typedef struct __CE_GeneralSubtree 
{ 
 695         CE_GeneralNames                                         
*base
; 
 696         uint32                                                          minimum
; // default=0 
 697         CSSM_BOOL                                                       maximumPresent
; 
 698         uint32                                                          maximum
; // optional 
 699 } CE_GeneralSubtree DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 701 typedef struct __CE_GeneralSubtrees 
{ 
 703         CE_GeneralSubtree                                       
*subtrees
; 
 704 } CE_GeneralSubtrees DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 706 typedef struct __CE_NameConstraints 
{ 
 707         CE_GeneralSubtrees                                      
*permitted
; // optional 
 708         CE_GeneralSubtrees                                      
*excluded
;  // optional 
 709 } CE_NameConstraints DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 714  * id-ce-policyMappings OBJECT IDENTIFIER ::=  { id-ce 33 } 
 716  *     PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE { 
 717  *          issuerDomainPolicy      CertPolicyId, 
 718  *          subjectDomainPolicy     CertPolicyId } 
 720  * Note that both issuer and subject policy OIDs are required, 
 721  * and are stored by value in this structure. 
 723 typedef struct __CE_PolicyMapping 
{ 
 724         CSSM_OID                                                        issuerDomainPolicy
; 
 725         CSSM_OID                                                        subjectDomainPolicy
; 
 726 } CE_PolicyMapping DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 728 typedef struct __CE_PolicyMappings 
{ 
 729         uint32                                                          numPolicyMappings
; 
 730         CE_PolicyMapping                                        
*policyMappings
; 
 731 } CE_PolicyMappings DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 736  * id-ce-policyConstraints OBJECT IDENTIFIER ::=  { id-ce 36 } 
 738  *     PolicyConstraints ::= SEQUENCE { 
 739  *          requireExplicitPolicy   [0]     SkipCerts OPTIONAL, 
 740  *          inhibitPolicyMapping    [1]     SkipCerts OPTIONAL } 
 742  *      SkipCerts ::= INTEGER (0..MAX) 
 744 typedef struct __CE_PolicyConstraints 
{ 
 745         CSSM_BOOL                                                       requireExplicitPolicyPresent
; 
 746         uint32                                                          requireExplicitPolicy
; // optional 
 747         CSSM_BOOL                                                       inhibitPolicyMappingPresent
; 
 748         uint32                                                          inhibitPolicyMapping
;  // optional 
 749 } CE_PolicyConstraints DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 752  * InhibitAnyPolicy, an integer. 
 754  * CSSM OID = CSSMOID_InhibitAnyPolicy 
 756 typedef uint32 CE_InhibitAnyPolicy DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 759  * An enumerated list identifying one of the above per-extension 
 762 typedef enum __CE_DataType 
{ 
 763         DT_AuthorityKeyID
,                      // CE_AuthorityKeyID 
 764         DT_SubjectKeyID
,                        // CE_SubjectKeyID 
 765         DT_KeyUsage
,                            // CE_KeyUsage 
 766         DT_SubjectAltName
,                      // implies CE_GeneralName 
 767         DT_IssuerAltName
,                       // implies CE_GeneralName 
 768         DT_ExtendedKeyUsage
,            // CE_ExtendedKeyUsage 
 769         DT_BasicConstraints
,            // CE_BasicConstraints 
 770         DT_CertPolicies
,                        // CE_CertPolicies 
 771         DT_NetscapeCertType
,            // CE_NetscapeCertType 
 772         DT_CrlNumber
,                           // CE_CrlNumber 
 773         DT_DeltaCrl
,                            // CE_DeltaCrl 
 774         DT_CrlReason
,                           // CE_CrlReason 
 775         DT_CrlDistributionPoints
,       // CE_CRLDistPointsSyntax 
 776         DT_IssuingDistributionPoint
,// CE_IssuingDistributionPoint 
 777         DT_AuthorityInfoAccess
,         // CE_AuthorityInfoAccess 
 778         DT_Other
,                                       // unknown, raw data as a CSSM_DATA 
 779         DT_QC_Statements
,                       // CE_QC_Statements 
 780         DT_NameConstraints
,                     // CE_NameConstraints 
 781         DT_PolicyMappings
,                      // CE_PolicyMappings 
 782         DT_PolicyConstraints
,           // CE_PolicyConstraints 
 783         DT_InhibitAnyPolicy                     
// CE_InhibitAnyPolicy 
 787  * One unified representation of all the cert and CRL extensions we know about. 
 790         CE_AuthorityKeyID                       authorityKeyID
; 
 791         CE_SubjectKeyID                         subjectKeyID
; 
 792         CE_KeyUsage                                     keyUsage
; 
 793         CE_GeneralNames                         subjectAltName
; 
 794         CE_GeneralNames                         issuerAltName
; 
 795         CE_ExtendedKeyUsage                     extendedKeyUsage
; 
 796         CE_BasicConstraints                     basicConstraints
; 
 797         CE_CertPolicies                         certPolicies
; 
 798         CE_NetscapeCertType                     netscapeCertType
; 
 799         CE_CrlNumber                            crlNumber
; 
 800         CE_DeltaCrl                                     deltaCrl
; 
 801         CE_CrlReason                            crlReason
; 
 802         CE_CRLDistPointsSyntax          crlDistPoints
; 
 803         CE_IssuingDistributionPoint     issuingDistPoint
; 
 804         CE_AuthorityInfoAccess          authorityInfoAccess
; 
 805         CE_QC_Statements                        qualifiedCertStatements
; 
 806         CE_NameConstraints                      nameConstraints
; 
 807         CE_PolicyMappings                       policyMappings
; 
 808         CE_PolicyConstraints            policyConstraints
; 
 809         CE_InhibitAnyPolicy                     inhibitAnyPolicy
; 
 810         CSSM_DATA                                       rawData
;                        // unknown, not decoded 
 811 } CE_Data DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 813 typedef struct __CE_DataAndType 
{ 
 817 } CE_DataAndType DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
; 
 819 #endif /* SEC_OS_OSX */ 
 822 #pragma clang diagnostic pop 
 825 #endif  /* _CERT_EXTENSIONS_H_ */