1 /* -*- Mode: C; tab-width: 8 -*-*/ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 /* Header file with all of the structures and types that will be exported 7 * by the security library for implementation of CRMF. 8 */ 9 10 #ifndef _CRMFT_H_ 11 #define _CRMFT_H_ 12 13 /* Use these enumerated values for adding fields to the certificate request */ 14 typedef enum { 15 crmfVersion = 0, 16 crmfSerialNumber = 1, 17 crmfSigningAlg = 2, 18 crmfIssuer = 3, 19 crmfValidity = 4, 20 crmfSubject = 5, 21 crmfPublicKey = 6, 22 crmfIssuerUID = 7, 23 crmfSubjectUID = 8, 24 crmfExtension = 9 25 } CRMFCertTemplateField; 26 27 /* 28 * An enumeration for the different types of controls. 29 */ 30 typedef enum { 31 crmfNoControl = 0, 32 crmfRegTokenControl = 1, 33 crmfAuthenticatorControl = 2, 34 crmfPKIPublicationInfoControl = 3, 35 crmfPKIArchiveOptionsControl = 4, 36 crmfOldCertIDControl = 5, 37 crmfProtocolEncrKeyControl = 6 38 } CRMFControlType; 39 40 /* 41 * The possible values that are passed into CRMF_CreatePKIPublicationInfo 42 */ 43 typedef enum { 44 crmfDontPublish = 0, 45 crmfPleasePublish = 1 46 } CRMFPublicationAction; 47 48 /* 49 * An enumeration for the possible for pubMethod which is a part of 50 * the SinglePubInfo ASN1 type. 51 */ 52 typedef enum { 53 crmfDontCare = 0, 54 crmfX500 = 1, 55 crmfWeb = 2, 56 crmfLdap = 3 57 } CRMFPublicationMethod; 58 59 /* 60 * An enumeration for the different options for PKIArchiveOptions type. 61 */ 62 typedef enum { 63 crmfNoArchiveOptions = 0, 64 crmfEncryptedPrivateKey = 1, 65 crmfKeyGenParameters = 2, 66 crmfArchiveRemGenPrivKey = 3 67 } CRMFPKIArchiveOptionsType; 68 69 /* 70 * An enumeration for the different options for ProofOfPossession 71 */ 72 typedef enum { 73 crmfNoPOPChoice = 0, 74 crmfRAVerified = 1, 75 crmfSignature = 2, 76 crmfKeyEncipherment = 3, 77 crmfKeyAgreement = 4 78 } CRMFPOPChoice; 79 80 /* 81 * An enumertion type for options for the authInfo field of the 82 * CRMFPOPOSigningKeyInput structure. 83 */ 84 typedef enum { 85 crmfSender = 0, 86 crmfPublicKeyMAC = 1 87 } CRMFPOPOSkiInputAuthChoice; 88 89 /* 90 * An enumeration for the SubsequentMessage Options. 91 */ 92 typedef enum { 93 crmfNoSubseqMess = 0, 94 crmfEncrCert = 1, 95 crmfChallengeResp = 2 96 } CRMFSubseqMessOptions; 97 98 /* 99 * An enumeration for the choice used by POPOPrivKey. 100 */ 101 typedef enum { 102 crmfNoMessage = 0, 103 crmfThisMessage = 1, 104 crmfSubsequentMessage = 2, 105 crmfDHMAC = 3 106 } CRMFPOPOPrivKeyChoice; 107 108 /* 109 * An enumeration for the choices for the EncryptedKey type. 110 */ 111 typedef enum { 112 crmfNoEncryptedKeyChoice = 0, 113 crmfEncryptedValueChoice = 1, 114 crmfEnvelopedDataChoice = 2 115 } CRMFEncryptedKeyChoice; 116 117 /* 118 * TYPE: CRMFEncoderOutputCallback 119 * This function type defines a prototype for a function that the CRMF 120 * library expects when encoding is performed. 121 * 122 * ARGUMENTS: 123 * arg 124 * This will be a pointer the user passed into an encoding function. 125 * The user of the library is free to use this pointer in any way. 126 * The most common use is to keep around a buffer for writing out 127 * the DER encoded bytes. 128 * buf 129 * The DER encoded bytes that should be written out. 130 * len 131 * The number of DER encoded bytes to write out. 132 * 133 */ 134 typedef void (*CRMFEncoderOutputCallback)(void *arg, 135 const char *buf, 136 unsigned long len); 137 138 /* 139 * Type for the function that gets a password. Just in case we ever 140 * need to support publicKeyMAC for POPOSigningKeyInput 141 */ 142 typedef SECItem *(*CRMFMACPasswordCallback)(void *arg); 143 144 typedef struct CRMFOptionalValidityStr CRMFOptionalValidity; 145 typedef struct CRMFValidityCreationInfoStr CRMFGetValidity; 146 typedef struct CRMFCertTemplateStr CRMFCertTemplate; 147 typedef struct CRMFCertRequestStr CRMFCertRequest; 148 typedef struct CRMFCertReqMsgStr CRMFCertReqMsg; 149 typedef struct CRMFCertReqMessagesStr CRMFCertReqMessages; 150 typedef struct CRMFProofOfPossessionStr CRMFProofOfPossession; 151 typedef struct CRMFPOPOSigningKeyStr CRMFPOPOSigningKey; 152 typedef struct CRMFPOPOSigningKeyInputStr CRMFPOPOSigningKeyInput; 153 typedef struct CRMFPOPOPrivKeyStr CRMFPOPOPrivKey; 154 typedef struct CRMFPKIPublicationInfoStr CRMFPKIPublicationInfo; 155 typedef struct CRMFSinglePubInfoStr CRMFSinglePubInfo; 156 typedef struct CRMFPKIArchiveOptionsStr CRMFPKIArchiveOptions; 157 typedef struct CRMFEncryptedKeyStr CRMFEncryptedKey; 158 typedef struct CRMFEncryptedValueStr CRMFEncryptedValue; 159 typedef struct CRMFCertIDStr CRMFCertID; 160 typedef struct CRMFCertIDStr CRMFOldCertID; 161 typedef CERTSubjectPublicKeyInfo CRMFProtocolEncrKey; 162 typedef struct CRMFValidityCreationInfoStr CRMFValidityCreationInfo; 163 typedef struct CRMFCertExtCreationInfoStr CRMFCertExtCreationInfo; 164 typedef struct CRMFPKMACValueStr CRMFPKMACValue; 165 typedef struct CRMFAttributeStr CRMFAttribute; 166 typedef struct CRMFControlStr CRMFControl; 167 typedef CERTGeneralName CRMFGeneralName; 168 typedef struct CRMFCertExtensionStr CRMFCertExtension; 169 170 struct CRMFValidityCreationInfoStr { 171 PRTime *notBefore; 172 PRTime *notAfter; 173 }; 174 175 struct CRMFCertExtCreationInfoStr { 176 CRMFCertExtension **extensions; 177 int numExtensions; 178 }; 179 180 /* 181 * Some ASN1 Templates that may be needed. 182 */ 183 extern const SEC_ASN1Template CRMFCertReqMessagesTemplate[]; 184 extern const SEC_ASN1Template CRMFCertRequestTemplate[]; 185 186 #endif /*_CRMFT_H_*/ 187