Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C; tab-width: 8 -*-*/ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | |
michael@0 | 7 | #ifndef _CRMFIT_H_ |
michael@0 | 8 | #define _CRMFIT_H_ |
michael@0 | 9 | |
michael@0 | 10 | struct CRMFCertReqMessagesStr { |
michael@0 | 11 | CRMFCertReqMsg **messages; |
michael@0 | 12 | PLArenaPool *poolp; |
michael@0 | 13 | }; |
michael@0 | 14 | |
michael@0 | 15 | struct CRMFCertExtensionStr { |
michael@0 | 16 | SECItem id; |
michael@0 | 17 | SECItem critical; |
michael@0 | 18 | SECItem value; |
michael@0 | 19 | }; |
michael@0 | 20 | |
michael@0 | 21 | |
michael@0 | 22 | struct CRMFOptionalValidityStr { |
michael@0 | 23 | SECItem notBefore; |
michael@0 | 24 | SECItem notAfter; |
michael@0 | 25 | }; |
michael@0 | 26 | |
michael@0 | 27 | struct CRMFCertTemplateStr { |
michael@0 | 28 | SECItem version; |
michael@0 | 29 | SECItem serialNumber; |
michael@0 | 30 | SECAlgorithmID *signingAlg; |
michael@0 | 31 | CERTName *issuer; |
michael@0 | 32 | CRMFOptionalValidity *validity; |
michael@0 | 33 | CERTName *subject; |
michael@0 | 34 | CERTSubjectPublicKeyInfo *publicKey; |
michael@0 | 35 | SECItem issuerUID; |
michael@0 | 36 | SECItem subjectUID; |
michael@0 | 37 | CRMFCertExtension **extensions; |
michael@0 | 38 | int numExtensions; |
michael@0 | 39 | }; |
michael@0 | 40 | |
michael@0 | 41 | struct CRMFCertIDStr { |
michael@0 | 42 | SECItem issuer; /* General Name */ |
michael@0 | 43 | SECItem serialNumber; /*INTEGER*/ |
michael@0 | 44 | }; |
michael@0 | 45 | |
michael@0 | 46 | struct CRMFEncryptedValueStr { |
michael@0 | 47 | SECAlgorithmID *intendedAlg; |
michael@0 | 48 | SECAlgorithmID *symmAlg; |
michael@0 | 49 | SECItem encSymmKey; /*BIT STRING */ |
michael@0 | 50 | SECAlgorithmID *keyAlg; |
michael@0 | 51 | SECItem valueHint; /*OCTET STRING */ |
michael@0 | 52 | SECItem encValue; /*BIT STRING */ |
michael@0 | 53 | }; |
michael@0 | 54 | |
michael@0 | 55 | /* |
michael@0 | 56 | * The field derValue will contain the actual der |
michael@0 | 57 | * to include in the encoding or that was read in |
michael@0 | 58 | * from a der blob. |
michael@0 | 59 | */ |
michael@0 | 60 | struct CRMFEncryptedKeyStr { |
michael@0 | 61 | union { |
michael@0 | 62 | SEC_PKCS7ContentInfo *envelopedData; |
michael@0 | 63 | CRMFEncryptedValue encryptedValue; |
michael@0 | 64 | } value; |
michael@0 | 65 | CRMFEncryptedKeyChoice encKeyChoice; |
michael@0 | 66 | SECItem derValue; |
michael@0 | 67 | }; |
michael@0 | 68 | |
michael@0 | 69 | /* ASN1 must only have one of the following 3 options. */ |
michael@0 | 70 | struct CRMFPKIArchiveOptionsStr { |
michael@0 | 71 | union { |
michael@0 | 72 | CRMFEncryptedKey encryptedKey; |
michael@0 | 73 | SECItem keyGenParameters; |
michael@0 | 74 | SECItem archiveRemGenPrivKey; /* BOOLEAN */ |
michael@0 | 75 | } option; |
michael@0 | 76 | CRMFPKIArchiveOptionsType archOption; |
michael@0 | 77 | }; |
michael@0 | 78 | |
michael@0 | 79 | struct CRMFPKIPublicationInfoStr { |
michael@0 | 80 | SECItem action; /* Possible values */ |
michael@0 | 81 | /* dontPublish (0), pleasePublish (1) */ |
michael@0 | 82 | CRMFSinglePubInfo **pubInfos; |
michael@0 | 83 | }; |
michael@0 | 84 | |
michael@0 | 85 | struct CRMFControlStr { |
michael@0 | 86 | SECOidTag tag; |
michael@0 | 87 | SECItem derTag; |
michael@0 | 88 | SECItem derValue; |
michael@0 | 89 | /* These will be C structures used to represent the various |
michael@0 | 90 | * options. Values that can't be stored as der right away. |
michael@0 | 91 | * After creating these structures, we'll place their der |
michael@0 | 92 | * encoding in derValue so the encoder knows how to get to |
michael@0 | 93 | * it. |
michael@0 | 94 | */ |
michael@0 | 95 | union { |
michael@0 | 96 | CRMFCertID oldCertId; |
michael@0 | 97 | CRMFPKIArchiveOptions archiveOptions; |
michael@0 | 98 | CRMFPKIPublicationInfo pubInfo; |
michael@0 | 99 | CRMFProtocolEncrKey protEncrKey; |
michael@0 | 100 | } value; |
michael@0 | 101 | }; |
michael@0 | 102 | |
michael@0 | 103 | struct CRMFCertRequestStr { |
michael@0 | 104 | SECItem certReqId; |
michael@0 | 105 | CRMFCertTemplate certTemplate; |
michael@0 | 106 | CRMFControl **controls; |
michael@0 | 107 | /* The following members are used by the internal implementation, but |
michael@0 | 108 | * are not part of the encoding. |
michael@0 | 109 | */ |
michael@0 | 110 | PLArenaPool *poolp; |
michael@0 | 111 | PRUint32 requestID; /* This is the value that will be encoded into |
michael@0 | 112 | * the certReqId field. |
michael@0 | 113 | */ |
michael@0 | 114 | }; |
michael@0 | 115 | |
michael@0 | 116 | struct CRMFAttributeStr { |
michael@0 | 117 | SECItem derTag; |
michael@0 | 118 | SECItem derValue; |
michael@0 | 119 | }; |
michael@0 | 120 | |
michael@0 | 121 | struct CRMFCertReqMsgStr { |
michael@0 | 122 | CRMFCertRequest *certReq; |
michael@0 | 123 | CRMFProofOfPossession *pop; |
michael@0 | 124 | CRMFAttribute **regInfo; |
michael@0 | 125 | SECItem derPOP; |
michael@0 | 126 | /* This arena will be used for allocating memory when decoding. |
michael@0 | 127 | */ |
michael@0 | 128 | PLArenaPool *poolp; |
michael@0 | 129 | PRBool isDecoded; |
michael@0 | 130 | }; |
michael@0 | 131 | |
michael@0 | 132 | struct CRMFPOPOSigningKeyInputStr { |
michael@0 | 133 | /* ASN1 must have only one of the next 2 options */ |
michael@0 | 134 | union { |
michael@0 | 135 | SECItem sender; /*General Name*/ |
michael@0 | 136 | CRMFPKMACValue *publicKeyMAC; |
michael@0 | 137 | }authInfo; |
michael@0 | 138 | CERTSubjectPublicKeyInfo publicKey; |
michael@0 | 139 | }; |
michael@0 | 140 | |
michael@0 | 141 | struct CRMFPOPOSigningKeyStr { |
michael@0 | 142 | SECItem derInput; /*If in the future we support |
michael@0 | 143 | *POPOSigningKeyInput, this will |
michael@0 | 144 | *a C structure representation |
michael@0 | 145 | *instead. |
michael@0 | 146 | */ |
michael@0 | 147 | SECAlgorithmID *algorithmIdentifier; |
michael@0 | 148 | SECItem signature; /* This is a BIT STRING. Remember */ |
michael@0 | 149 | }; /* that when interpreting. */ |
michael@0 | 150 | |
michael@0 | 151 | /* ASN1 must only choose one of these members */ |
michael@0 | 152 | struct CRMFPOPOPrivKeyStr { |
michael@0 | 153 | union { |
michael@0 | 154 | SECItem thisMessage; /* BIT STRING */ |
michael@0 | 155 | SECItem subsequentMessage; /*INTEGER*/ |
michael@0 | 156 | SECItem dhMAC; /*BIT STRING*/ |
michael@0 | 157 | } message; |
michael@0 | 158 | CRMFPOPOPrivKeyChoice messageChoice; |
michael@0 | 159 | }; |
michael@0 | 160 | |
michael@0 | 161 | /* ASN1 must only have one of these options. */ |
michael@0 | 162 | struct CRMFProofOfPossessionStr { |
michael@0 | 163 | union { |
michael@0 | 164 | SECItem raVerified; |
michael@0 | 165 | CRMFPOPOSigningKey signature; |
michael@0 | 166 | CRMFPOPOPrivKey keyEncipherment; |
michael@0 | 167 | CRMFPOPOPrivKey keyAgreement; |
michael@0 | 168 | } popChoice; |
michael@0 | 169 | CRMFPOPChoice popUsed; /*Not part of encoding*/ |
michael@0 | 170 | }; |
michael@0 | 171 | |
michael@0 | 172 | struct CRMFPKMACValueStr { |
michael@0 | 173 | SECAlgorithmID algID; |
michael@0 | 174 | SECItem value; /*BIT STRING*/ |
michael@0 | 175 | }; |
michael@0 | 176 | |
michael@0 | 177 | struct CRMFSinglePubInfoStr { |
michael@0 | 178 | SECItem pubMethod; /* Possible Values: |
michael@0 | 179 | * dontCare (0) |
michael@0 | 180 | * x500 (1) |
michael@0 | 181 | * web (2) |
michael@0 | 182 | * ldap (3) |
michael@0 | 183 | */ |
michael@0 | 184 | CERTGeneralName *pubLocation; /* General Name */ |
michael@0 | 185 | }; |
michael@0 | 186 | |
michael@0 | 187 | #endif /* _CRMFIT_H_ */ |