1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/pkcs12/p12t.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,155 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef _P12T_H_ 1.9 +#define _P12T_H_ 1.10 + 1.11 +#include "secoid.h" 1.12 +#include "key.h" 1.13 +#include "pkcs11.h" 1.14 +#include "secpkcs7.h" 1.15 +#include "secdig.h" /* for SGNDigestInfo */ 1.16 +#include "pkcs12t.h" 1.17 + 1.18 +#define SEC_PKCS12_VERSION 3 1.19 + 1.20 +/* structure declarations */ 1.21 +typedef struct sec_PKCS12PFXItemStr sec_PKCS12PFXItem; 1.22 +typedef struct sec_PKCS12MacDataStr sec_PKCS12MacData; 1.23 +typedef struct sec_PKCS12AuthenticatedSafeStr sec_PKCS12AuthenticatedSafe; 1.24 +typedef struct sec_PKCS12SafeContentsStr sec_PKCS12SafeContents; 1.25 +typedef struct sec_PKCS12SafeBagStr sec_PKCS12SafeBag; 1.26 +typedef struct sec_PKCS12PKCS8ShroudedKeyBagStr sec_PKCS12PKCS8ShroudedKeyBag; 1.27 +typedef struct sec_PKCS12CertBagStr sec_PKCS12CertBag; 1.28 +typedef struct sec_PKCS12CRLBagStr sec_PKCS12CRLBag; 1.29 +typedef struct sec_PKCS12SecretBag sec_PKCS12SecretBag; 1.30 +typedef struct sec_PKCS12AttributeStr sec_PKCS12Attribute; 1.31 + 1.32 +struct sec_PKCS12CertBagStr { 1.33 + /* what type of cert is stored? */ 1.34 + SECItem bagID; 1.35 + 1.36 + /* certificate information */ 1.37 + union { 1.38 + SECItem x509Cert; 1.39 + SECItem SDSICert; 1.40 + } value; 1.41 +}; 1.42 + 1.43 +struct sec_PKCS12CRLBagStr { 1.44 + /* what type of cert is stored? */ 1.45 + SECItem bagID; 1.46 + 1.47 + /* certificate information */ 1.48 + union { 1.49 + SECItem x509CRL; 1.50 + } value; 1.51 +}; 1.52 + 1.53 +struct sec_PKCS12SecretBag { 1.54 + /* what type of secret? */ 1.55 + SECItem secretType; 1.56 + 1.57 + /* secret information. ssshhhh be vewy vewy quiet. */ 1.58 + SECItem secretContent; 1.59 +}; 1.60 + 1.61 +struct sec_PKCS12AttributeStr { 1.62 + SECItem attrType; 1.63 + SECItem **attrValue; 1.64 +}; 1.65 + 1.66 +struct sec_PKCS12SafeBagStr { 1.67 + 1.68 + /* What type of bag are we using? */ 1.69 + SECItem safeBagType; 1.70 + 1.71 + /* Dependent upon the type of bag being used. */ 1.72 + union { 1.73 + SECKEYPrivateKeyInfo *pkcs8KeyBag; 1.74 + SECKEYEncryptedPrivateKeyInfo *pkcs8ShroudedKeyBag; 1.75 + sec_PKCS12CertBag *certBag; 1.76 + sec_PKCS12CRLBag *crlBag; 1.77 + sec_PKCS12SecretBag *secretBag; 1.78 + sec_PKCS12SafeContents *safeContents; 1.79 + } safeBagContent; 1.80 + 1.81 + sec_PKCS12Attribute **attribs; 1.82 + 1.83 + /* used locally */ 1.84 + SECOidData *bagTypeTag; 1.85 + PLArenaPool *arena; 1.86 + unsigned int nAttribs; 1.87 + 1.88 + /* used for validation/importing */ 1.89 + PRBool problem, noInstall, validated, hasKey, unused, installed; 1.90 + int error; 1.91 + 1.92 + PRBool swapUnicodeBytes; 1.93 + PK11SlotInfo *slot; 1.94 + SECItem *pwitem; 1.95 + PRBool oldBagType; 1.96 + SECPKCS12TargetTokenCAs tokenCAs; 1.97 +}; 1.98 + 1.99 +struct sec_PKCS12SafeContentsStr { 1.100 + sec_PKCS12SafeBag **safeBags; 1.101 + SECItem **encodedSafeBags; 1.102 + 1.103 + /* used locally */ 1.104 + PLArenaPool *arena; 1.105 + unsigned int bagCount; 1.106 +}; 1.107 + 1.108 +struct sec_PKCS12MacDataStr { 1.109 + SGNDigestInfo safeMac; 1.110 + SECItem macSalt; 1.111 + SECItem iter; 1.112 +}; 1.113 + 1.114 +struct sec_PKCS12PFXItemStr { 1.115 + 1.116 + SECItem version; 1.117 + 1.118 + /* Content type will either be Data (password integrity mode) 1.119 + * or signedData (public-key integrity mode) 1.120 + */ 1.121 + SEC_PKCS7ContentInfo *authSafe; 1.122 + SECItem encodedAuthSafe; 1.123 + 1.124 + /* Only present in password integrity mode */ 1.125 + sec_PKCS12MacData macData; 1.126 + SECItem encodedMacData; 1.127 +}; 1.128 + 1.129 +struct sec_PKCS12AuthenticatedSafeStr { 1.130 + /* Content type will either be encryptedData (password privacy mode) 1.131 + * or envelopedData (public-key privacy mode) 1.132 + */ 1.133 + SEC_PKCS7ContentInfo **safes; 1.134 + SECItem **encodedSafes; 1.135 + 1.136 + /* used locally */ 1.137 + unsigned int safeCount; 1.138 + SECItem dummySafe; 1.139 +}; 1.140 + 1.141 +extern const SEC_ASN1Template sec_PKCS12PFXItemTemplate[]; 1.142 +extern const SEC_ASN1Template sec_PKCS12MacDataTemplate[]; 1.143 +extern const SEC_ASN1Template sec_PKCS12AuthenticatedSafeTemplate[]; 1.144 +extern const SEC_ASN1Template sec_PKCS12SafeContentsTemplate[]; 1.145 +extern const SEC_ASN1Template sec_PKCS12SafeContentsDecodeTemplate[]; 1.146 +extern const SEC_ASN1Template sec_PKCS12NestedSafeContentsDecodeTemplate[]; 1.147 +extern const SEC_ASN1Template sec_PKCS12CertBagTemplate[]; 1.148 +extern const SEC_ASN1Template sec_PKCS12CRLBagTemplate[]; 1.149 +extern const SEC_ASN1Template sec_PKCS12SecretBagTemplate[]; 1.150 +extern const SEC_ASN1Template sec_PKCS12PointerToCertBagTemplate[]; 1.151 +extern const SEC_ASN1Template sec_PKCS12PointerToCRLBagTemplate[]; 1.152 +extern const SEC_ASN1Template sec_PKCS12PointerToSecretBagTemplate[]; 1.153 +extern const SEC_ASN1Template sec_PKCS12PointerToSafeContentsTemplate[]; 1.154 +extern const SEC_ASN1Template sec_PKCS12AttributeTemplate[]; 1.155 +extern const SEC_ASN1Template sec_PKCS12PointerToContentInfoTemplate[]; 1.156 +extern const SEC_ASN1Template sec_PKCS12SafeBagTemplate[]; 1.157 + 1.158 +#endif