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