security/nss/lib/pkcs12/p12t.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #ifndef _P12T_H_
michael@0 6 #define _P12T_H_
michael@0 7
michael@0 8 #include "secoid.h"
michael@0 9 #include "key.h"
michael@0 10 #include "pkcs11.h"
michael@0 11 #include "secpkcs7.h"
michael@0 12 #include "secdig.h" /* for SGNDigestInfo */
michael@0 13 #include "pkcs12t.h"
michael@0 14
michael@0 15 #define SEC_PKCS12_VERSION 3
michael@0 16
michael@0 17 /* structure declarations */
michael@0 18 typedef struct sec_PKCS12PFXItemStr sec_PKCS12PFXItem;
michael@0 19 typedef struct sec_PKCS12MacDataStr sec_PKCS12MacData;
michael@0 20 typedef struct sec_PKCS12AuthenticatedSafeStr sec_PKCS12AuthenticatedSafe;
michael@0 21 typedef struct sec_PKCS12SafeContentsStr sec_PKCS12SafeContents;
michael@0 22 typedef struct sec_PKCS12SafeBagStr sec_PKCS12SafeBag;
michael@0 23 typedef struct sec_PKCS12PKCS8ShroudedKeyBagStr sec_PKCS12PKCS8ShroudedKeyBag;
michael@0 24 typedef struct sec_PKCS12CertBagStr sec_PKCS12CertBag;
michael@0 25 typedef struct sec_PKCS12CRLBagStr sec_PKCS12CRLBag;
michael@0 26 typedef struct sec_PKCS12SecretBag sec_PKCS12SecretBag;
michael@0 27 typedef struct sec_PKCS12AttributeStr sec_PKCS12Attribute;
michael@0 28
michael@0 29 struct sec_PKCS12CertBagStr {
michael@0 30 /* what type of cert is stored? */
michael@0 31 SECItem bagID;
michael@0 32
michael@0 33 /* certificate information */
michael@0 34 union {
michael@0 35 SECItem x509Cert;
michael@0 36 SECItem SDSICert;
michael@0 37 } value;
michael@0 38 };
michael@0 39
michael@0 40 struct sec_PKCS12CRLBagStr {
michael@0 41 /* what type of cert is stored? */
michael@0 42 SECItem bagID;
michael@0 43
michael@0 44 /* certificate information */
michael@0 45 union {
michael@0 46 SECItem x509CRL;
michael@0 47 } value;
michael@0 48 };
michael@0 49
michael@0 50 struct sec_PKCS12SecretBag {
michael@0 51 /* what type of secret? */
michael@0 52 SECItem secretType;
michael@0 53
michael@0 54 /* secret information. ssshhhh be vewy vewy quiet. */
michael@0 55 SECItem secretContent;
michael@0 56 };
michael@0 57
michael@0 58 struct sec_PKCS12AttributeStr {
michael@0 59 SECItem attrType;
michael@0 60 SECItem **attrValue;
michael@0 61 };
michael@0 62
michael@0 63 struct sec_PKCS12SafeBagStr {
michael@0 64
michael@0 65 /* What type of bag are we using? */
michael@0 66 SECItem safeBagType;
michael@0 67
michael@0 68 /* Dependent upon the type of bag being used. */
michael@0 69 union {
michael@0 70 SECKEYPrivateKeyInfo *pkcs8KeyBag;
michael@0 71 SECKEYEncryptedPrivateKeyInfo *pkcs8ShroudedKeyBag;
michael@0 72 sec_PKCS12CertBag *certBag;
michael@0 73 sec_PKCS12CRLBag *crlBag;
michael@0 74 sec_PKCS12SecretBag *secretBag;
michael@0 75 sec_PKCS12SafeContents *safeContents;
michael@0 76 } safeBagContent;
michael@0 77
michael@0 78 sec_PKCS12Attribute **attribs;
michael@0 79
michael@0 80 /* used locally */
michael@0 81 SECOidData *bagTypeTag;
michael@0 82 PLArenaPool *arena;
michael@0 83 unsigned int nAttribs;
michael@0 84
michael@0 85 /* used for validation/importing */
michael@0 86 PRBool problem, noInstall, validated, hasKey, unused, installed;
michael@0 87 int error;
michael@0 88
michael@0 89 PRBool swapUnicodeBytes;
michael@0 90 PK11SlotInfo *slot;
michael@0 91 SECItem *pwitem;
michael@0 92 PRBool oldBagType;
michael@0 93 SECPKCS12TargetTokenCAs tokenCAs;
michael@0 94 };
michael@0 95
michael@0 96 struct sec_PKCS12SafeContentsStr {
michael@0 97 sec_PKCS12SafeBag **safeBags;
michael@0 98 SECItem **encodedSafeBags;
michael@0 99
michael@0 100 /* used locally */
michael@0 101 PLArenaPool *arena;
michael@0 102 unsigned int bagCount;
michael@0 103 };
michael@0 104
michael@0 105 struct sec_PKCS12MacDataStr {
michael@0 106 SGNDigestInfo safeMac;
michael@0 107 SECItem macSalt;
michael@0 108 SECItem iter;
michael@0 109 };
michael@0 110
michael@0 111 struct sec_PKCS12PFXItemStr {
michael@0 112
michael@0 113 SECItem version;
michael@0 114
michael@0 115 /* Content type will either be Data (password integrity mode)
michael@0 116 * or signedData (public-key integrity mode)
michael@0 117 */
michael@0 118 SEC_PKCS7ContentInfo *authSafe;
michael@0 119 SECItem encodedAuthSafe;
michael@0 120
michael@0 121 /* Only present in password integrity mode */
michael@0 122 sec_PKCS12MacData macData;
michael@0 123 SECItem encodedMacData;
michael@0 124 };
michael@0 125
michael@0 126 struct sec_PKCS12AuthenticatedSafeStr {
michael@0 127 /* Content type will either be encryptedData (password privacy mode)
michael@0 128 * or envelopedData (public-key privacy mode)
michael@0 129 */
michael@0 130 SEC_PKCS7ContentInfo **safes;
michael@0 131 SECItem **encodedSafes;
michael@0 132
michael@0 133 /* used locally */
michael@0 134 unsigned int safeCount;
michael@0 135 SECItem dummySafe;
michael@0 136 };
michael@0 137
michael@0 138 extern const SEC_ASN1Template sec_PKCS12PFXItemTemplate[];
michael@0 139 extern const SEC_ASN1Template sec_PKCS12MacDataTemplate[];
michael@0 140 extern const SEC_ASN1Template sec_PKCS12AuthenticatedSafeTemplate[];
michael@0 141 extern const SEC_ASN1Template sec_PKCS12SafeContentsTemplate[];
michael@0 142 extern const SEC_ASN1Template sec_PKCS12SafeContentsDecodeTemplate[];
michael@0 143 extern const SEC_ASN1Template sec_PKCS12NestedSafeContentsDecodeTemplate[];
michael@0 144 extern const SEC_ASN1Template sec_PKCS12CertBagTemplate[];
michael@0 145 extern const SEC_ASN1Template sec_PKCS12CRLBagTemplate[];
michael@0 146 extern const SEC_ASN1Template sec_PKCS12SecretBagTemplate[];
michael@0 147 extern const SEC_ASN1Template sec_PKCS12PointerToCertBagTemplate[];
michael@0 148 extern const SEC_ASN1Template sec_PKCS12PointerToCRLBagTemplate[];
michael@0 149 extern const SEC_ASN1Template sec_PKCS12PointerToSecretBagTemplate[];
michael@0 150 extern const SEC_ASN1Template sec_PKCS12PointerToSafeContentsTemplate[];
michael@0 151 extern const SEC_ASN1Template sec_PKCS12AttributeTemplate[];
michael@0 152 extern const SEC_ASN1Template sec_PKCS12PointerToContentInfoTemplate[];
michael@0 153 extern const SEC_ASN1Template sec_PKCS12SafeBagTemplate[];
michael@0 154
michael@0 155 #endif

mercurial