1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/crmf/crmfit.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,187 @@ 1.4 +/* -*- Mode: C; tab-width: 8 -*-*/ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 + 1.10 +#ifndef _CRMFIT_H_ 1.11 +#define _CRMFIT_H_ 1.12 + 1.13 +struct CRMFCertReqMessagesStr { 1.14 + CRMFCertReqMsg **messages; 1.15 + PLArenaPool *poolp; 1.16 +}; 1.17 + 1.18 +struct CRMFCertExtensionStr { 1.19 + SECItem id; 1.20 + SECItem critical; 1.21 + SECItem value; 1.22 +}; 1.23 + 1.24 + 1.25 +struct CRMFOptionalValidityStr { 1.26 + SECItem notBefore; 1.27 + SECItem notAfter; 1.28 +}; 1.29 + 1.30 +struct CRMFCertTemplateStr { 1.31 + SECItem version; 1.32 + SECItem serialNumber; 1.33 + SECAlgorithmID *signingAlg; 1.34 + CERTName *issuer; 1.35 + CRMFOptionalValidity *validity; 1.36 + CERTName *subject; 1.37 + CERTSubjectPublicKeyInfo *publicKey; 1.38 + SECItem issuerUID; 1.39 + SECItem subjectUID; 1.40 + CRMFCertExtension **extensions; 1.41 + int numExtensions; 1.42 +}; 1.43 + 1.44 +struct CRMFCertIDStr { 1.45 + SECItem issuer; /* General Name */ 1.46 + SECItem serialNumber; /*INTEGER*/ 1.47 +}; 1.48 + 1.49 +struct CRMFEncryptedValueStr { 1.50 + SECAlgorithmID *intendedAlg; 1.51 + SECAlgorithmID *symmAlg; 1.52 + SECItem encSymmKey; /*BIT STRING */ 1.53 + SECAlgorithmID *keyAlg; 1.54 + SECItem valueHint; /*OCTET STRING */ 1.55 + SECItem encValue; /*BIT STRING */ 1.56 +}; 1.57 + 1.58 +/* 1.59 + * The field derValue will contain the actual der 1.60 + * to include in the encoding or that was read in 1.61 + * from a der blob. 1.62 + */ 1.63 +struct CRMFEncryptedKeyStr { 1.64 + union { 1.65 + SEC_PKCS7ContentInfo *envelopedData; 1.66 + CRMFEncryptedValue encryptedValue; 1.67 + } value; 1.68 + CRMFEncryptedKeyChoice encKeyChoice; 1.69 + SECItem derValue; 1.70 +}; 1.71 + 1.72 +/* ASN1 must only have one of the following 3 options. */ 1.73 +struct CRMFPKIArchiveOptionsStr { 1.74 + union { 1.75 + CRMFEncryptedKey encryptedKey; 1.76 + SECItem keyGenParameters; 1.77 + SECItem archiveRemGenPrivKey; /* BOOLEAN */ 1.78 + } option; 1.79 + CRMFPKIArchiveOptionsType archOption; 1.80 +}; 1.81 + 1.82 +struct CRMFPKIPublicationInfoStr { 1.83 + SECItem action; /* Possible values */ 1.84 + /* dontPublish (0), pleasePublish (1) */ 1.85 + CRMFSinglePubInfo **pubInfos; 1.86 +}; 1.87 + 1.88 +struct CRMFControlStr { 1.89 + SECOidTag tag; 1.90 + SECItem derTag; 1.91 + SECItem derValue; 1.92 + /* These will be C structures used to represent the various 1.93 + * options. Values that can't be stored as der right away. 1.94 + * After creating these structures, we'll place their der 1.95 + * encoding in derValue so the encoder knows how to get to 1.96 + * it. 1.97 + */ 1.98 + union { 1.99 + CRMFCertID oldCertId; 1.100 + CRMFPKIArchiveOptions archiveOptions; 1.101 + CRMFPKIPublicationInfo pubInfo; 1.102 + CRMFProtocolEncrKey protEncrKey; 1.103 + } value; 1.104 +}; 1.105 + 1.106 +struct CRMFCertRequestStr { 1.107 + SECItem certReqId; 1.108 + CRMFCertTemplate certTemplate; 1.109 + CRMFControl **controls; 1.110 + /* The following members are used by the internal implementation, but 1.111 + * are not part of the encoding. 1.112 + */ 1.113 + PLArenaPool *poolp; 1.114 + PRUint32 requestID; /* This is the value that will be encoded into 1.115 + * the certReqId field. 1.116 + */ 1.117 +}; 1.118 + 1.119 +struct CRMFAttributeStr { 1.120 + SECItem derTag; 1.121 + SECItem derValue; 1.122 +}; 1.123 + 1.124 +struct CRMFCertReqMsgStr { 1.125 + CRMFCertRequest *certReq; 1.126 + CRMFProofOfPossession *pop; 1.127 + CRMFAttribute **regInfo; 1.128 + SECItem derPOP; 1.129 + /* This arena will be used for allocating memory when decoding. 1.130 + */ 1.131 + PLArenaPool *poolp; 1.132 + PRBool isDecoded; 1.133 +}; 1.134 + 1.135 +struct CRMFPOPOSigningKeyInputStr { 1.136 + /* ASN1 must have only one of the next 2 options */ 1.137 + union { 1.138 + SECItem sender; /*General Name*/ 1.139 + CRMFPKMACValue *publicKeyMAC; 1.140 + }authInfo; 1.141 + CERTSubjectPublicKeyInfo publicKey; 1.142 +}; 1.143 + 1.144 +struct CRMFPOPOSigningKeyStr { 1.145 + SECItem derInput; /*If in the future we support 1.146 + *POPOSigningKeyInput, this will 1.147 + *a C structure representation 1.148 + *instead. 1.149 + */ 1.150 + SECAlgorithmID *algorithmIdentifier; 1.151 + SECItem signature; /* This is a BIT STRING. Remember */ 1.152 +}; /* that when interpreting. */ 1.153 + 1.154 +/* ASN1 must only choose one of these members */ 1.155 +struct CRMFPOPOPrivKeyStr { 1.156 + union { 1.157 + SECItem thisMessage; /* BIT STRING */ 1.158 + SECItem subsequentMessage; /*INTEGER*/ 1.159 + SECItem dhMAC; /*BIT STRING*/ 1.160 + } message; 1.161 + CRMFPOPOPrivKeyChoice messageChoice; 1.162 +}; 1.163 + 1.164 +/* ASN1 must only have one of these options. */ 1.165 +struct CRMFProofOfPossessionStr { 1.166 + union { 1.167 + SECItem raVerified; 1.168 + CRMFPOPOSigningKey signature; 1.169 + CRMFPOPOPrivKey keyEncipherment; 1.170 + CRMFPOPOPrivKey keyAgreement; 1.171 + } popChoice; 1.172 + CRMFPOPChoice popUsed; /*Not part of encoding*/ 1.173 +}; 1.174 + 1.175 +struct CRMFPKMACValueStr { 1.176 + SECAlgorithmID algID; 1.177 + SECItem value; /*BIT STRING*/ 1.178 +}; 1.179 + 1.180 +struct CRMFSinglePubInfoStr { 1.181 + SECItem pubMethod; /* Possible Values: 1.182 + * dontCare (0) 1.183 + * x500 (1) 1.184 + * web (2) 1.185 + * ldap (3) 1.186 + */ 1.187 + CERTGeneralName *pubLocation; /* General Name */ 1.188 +}; 1.189 + 1.190 +#endif /* _CRMFIT_H_ */