1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/crmf/crmft.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,188 @@ 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 +/* Header file with all of the structures and types that will be exported 1.11 + * by the security library for implementation of CRMF. 1.12 + */ 1.13 + 1.14 +#ifndef _CRMFT_H_ 1.15 +#define _CRMFT_H_ 1.16 + 1.17 +/* Use these enumerated values for adding fields to the certificate request */ 1.18 +typedef enum { 1.19 + crmfVersion = 0, 1.20 + crmfSerialNumber = 1, 1.21 + crmfSigningAlg = 2, 1.22 + crmfIssuer = 3, 1.23 + crmfValidity = 4, 1.24 + crmfSubject = 5, 1.25 + crmfPublicKey = 6, 1.26 + crmfIssuerUID = 7, 1.27 + crmfSubjectUID = 8, 1.28 + crmfExtension = 9 1.29 +} CRMFCertTemplateField; 1.30 + 1.31 +/* 1.32 + * An enumeration for the different types of controls. 1.33 + */ 1.34 +typedef enum { 1.35 + crmfNoControl = 0, 1.36 + crmfRegTokenControl = 1, 1.37 + crmfAuthenticatorControl = 2, 1.38 + crmfPKIPublicationInfoControl = 3, 1.39 + crmfPKIArchiveOptionsControl = 4, 1.40 + crmfOldCertIDControl = 5, 1.41 + crmfProtocolEncrKeyControl = 6 1.42 +} CRMFControlType; 1.43 + 1.44 +/* 1.45 + * The possible values that are passed into CRMF_CreatePKIPublicationInfo 1.46 + */ 1.47 +typedef enum { 1.48 + crmfDontPublish = 0, 1.49 + crmfPleasePublish = 1 1.50 +} CRMFPublicationAction; 1.51 + 1.52 +/* 1.53 + * An enumeration for the possible for pubMethod which is a part of 1.54 + * the SinglePubInfo ASN1 type. 1.55 + */ 1.56 +typedef enum { 1.57 + crmfDontCare = 0, 1.58 + crmfX500 = 1, 1.59 + crmfWeb = 2, 1.60 + crmfLdap = 3 1.61 +} CRMFPublicationMethod; 1.62 + 1.63 +/* 1.64 + * An enumeration for the different options for PKIArchiveOptions type. 1.65 + */ 1.66 +typedef enum { 1.67 + crmfNoArchiveOptions = 0, 1.68 + crmfEncryptedPrivateKey = 1, 1.69 + crmfKeyGenParameters = 2, 1.70 + crmfArchiveRemGenPrivKey = 3 1.71 +} CRMFPKIArchiveOptionsType; 1.72 + 1.73 +/* 1.74 + * An enumeration for the different options for ProofOfPossession 1.75 + */ 1.76 +typedef enum { 1.77 + crmfNoPOPChoice = 0, 1.78 + crmfRAVerified = 1, 1.79 + crmfSignature = 2, 1.80 + crmfKeyEncipherment = 3, 1.81 + crmfKeyAgreement = 4 1.82 +} CRMFPOPChoice; 1.83 + 1.84 +/* 1.85 + * An enumertion type for options for the authInfo field of the 1.86 + * CRMFPOPOSigningKeyInput structure. 1.87 + */ 1.88 +typedef enum { 1.89 + crmfSender = 0, 1.90 + crmfPublicKeyMAC = 1 1.91 +} CRMFPOPOSkiInputAuthChoice; 1.92 + 1.93 +/* 1.94 + * An enumeration for the SubsequentMessage Options. 1.95 + */ 1.96 +typedef enum { 1.97 + crmfNoSubseqMess = 0, 1.98 + crmfEncrCert = 1, 1.99 + crmfChallengeResp = 2 1.100 +} CRMFSubseqMessOptions; 1.101 + 1.102 +/* 1.103 + * An enumeration for the choice used by POPOPrivKey. 1.104 + */ 1.105 +typedef enum { 1.106 + crmfNoMessage = 0, 1.107 + crmfThisMessage = 1, 1.108 + crmfSubsequentMessage = 2, 1.109 + crmfDHMAC = 3 1.110 +} CRMFPOPOPrivKeyChoice; 1.111 + 1.112 +/* 1.113 + * An enumeration for the choices for the EncryptedKey type. 1.114 + */ 1.115 +typedef enum { 1.116 + crmfNoEncryptedKeyChoice = 0, 1.117 + crmfEncryptedValueChoice = 1, 1.118 + crmfEnvelopedDataChoice = 2 1.119 +} CRMFEncryptedKeyChoice; 1.120 + 1.121 +/* 1.122 + * TYPE: CRMFEncoderOutputCallback 1.123 + * This function type defines a prototype for a function that the CRMF 1.124 + * library expects when encoding is performed. 1.125 + * 1.126 + * ARGUMENTS: 1.127 + * arg 1.128 + * This will be a pointer the user passed into an encoding function. 1.129 + * The user of the library is free to use this pointer in any way. 1.130 + * The most common use is to keep around a buffer for writing out 1.131 + * the DER encoded bytes. 1.132 + * buf 1.133 + * The DER encoded bytes that should be written out. 1.134 + * len 1.135 + * The number of DER encoded bytes to write out. 1.136 + * 1.137 + */ 1.138 +typedef void (*CRMFEncoderOutputCallback) (void *arg, 1.139 + const char *buf, 1.140 + unsigned long len); 1.141 + 1.142 +/* 1.143 + * Type for the function that gets a password. Just in case we ever 1.144 + * need to support publicKeyMAC for POPOSigningKeyInput 1.145 + */ 1.146 +typedef SECItem* (*CRMFMACPasswordCallback) (void *arg); 1.147 + 1.148 +typedef struct CRMFOptionalValidityStr CRMFOptionalValidity; 1.149 +typedef struct CRMFValidityCreationInfoStr CRMFGetValidity; 1.150 +typedef struct CRMFCertTemplateStr CRMFCertTemplate; 1.151 +typedef struct CRMFCertRequestStr CRMFCertRequest; 1.152 +typedef struct CRMFCertReqMsgStr CRMFCertReqMsg; 1.153 +typedef struct CRMFCertReqMessagesStr CRMFCertReqMessages; 1.154 +typedef struct CRMFProofOfPossessionStr CRMFProofOfPossession; 1.155 +typedef struct CRMFPOPOSigningKeyStr CRMFPOPOSigningKey; 1.156 +typedef struct CRMFPOPOSigningKeyInputStr CRMFPOPOSigningKeyInput; 1.157 +typedef struct CRMFPOPOPrivKeyStr CRMFPOPOPrivKey; 1.158 +typedef struct CRMFPKIPublicationInfoStr CRMFPKIPublicationInfo; 1.159 +typedef struct CRMFSinglePubInfoStr CRMFSinglePubInfo; 1.160 +typedef struct CRMFPKIArchiveOptionsStr CRMFPKIArchiveOptions; 1.161 +typedef struct CRMFEncryptedKeyStr CRMFEncryptedKey; 1.162 +typedef struct CRMFEncryptedValueStr CRMFEncryptedValue; 1.163 +typedef struct CRMFCertIDStr CRMFCertID; 1.164 +typedef struct CRMFCertIDStr CRMFOldCertID; 1.165 +typedef CERTSubjectPublicKeyInfo CRMFProtocolEncrKey; 1.166 +typedef struct CRMFValidityCreationInfoStr CRMFValidityCreationInfo; 1.167 +typedef struct CRMFCertExtCreationInfoStr CRMFCertExtCreationInfo; 1.168 +typedef struct CRMFPKMACValueStr CRMFPKMACValue; 1.169 +typedef struct CRMFAttributeStr CRMFAttribute; 1.170 +typedef struct CRMFControlStr CRMFControl; 1.171 +typedef CERTGeneralName CRMFGeneralName; 1.172 +typedef struct CRMFCertExtensionStr CRMFCertExtension; 1.173 + 1.174 +struct CRMFValidityCreationInfoStr { 1.175 + PRTime *notBefore; 1.176 + PRTime *notAfter; 1.177 +}; 1.178 + 1.179 +struct CRMFCertExtCreationInfoStr { 1.180 + CRMFCertExtension **extensions; 1.181 + int numExtensions; 1.182 +}; 1.183 + 1.184 +/* 1.185 + * Some ASN1 Templates that may be needed. 1.186 + */ 1.187 +extern const SEC_ASN1Template CRMFCertReqMessagesTemplate[]; 1.188 +extern const SEC_ASN1Template CRMFCertRequestTemplate[]; 1.189 + 1.190 + 1.191 +#endif /*_CRMFT_H_*/