PageRenderTime 201ms CodeModel.GetById 71ms app.highlight 11ms RepoModel.GetById 45ms app.codeStats 0ms

/gecko_api/include/p12t.h

http://firefox-mac-pdf.googlecode.com/
C++ Header | 187 lines | 103 code | 29 blank | 55 comment | 0 complexity | 7c2609e2f818853232e168e3fe353a2f MD5 | raw file
  1/* ***** BEGIN LICENSE BLOCK *****
  2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  3 *
  4 * The contents of this file are subject to the Mozilla Public License Version
  5 * 1.1 (the "License"); you may not use this file except in compliance with
  6 * the License. You may obtain a copy of the License at
  7 * http://www.mozilla.org/MPL/
  8 *
  9 * Software distributed under the License is distributed on an "AS IS" basis,
 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 11 * for the specific language governing rights and limitations under the
 12 * License.
 13 *
 14 * The Original Code is the Netscape security libraries.
 15 *
 16 * The Initial Developer of the Original Code is
 17 * Netscape Communications Corporation.
 18 * Portions created by the Initial Developer are Copyright (C) 1994-2000
 19 * the Initial Developer. All Rights Reserved.
 20 *
 21 * Contributor(s):
 22 *
 23 * Alternatively, the contents of this file may be used under the terms of
 24 * either the GNU General Public License Version 2 or later (the "GPL"), or
 25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 26 * in which case the provisions of the GPL or the LGPL are applicable instead
 27 * of those above. If you wish to allow use of your version of this file only
 28 * under the terms of either the GPL or the LGPL, and not to allow others to
 29 * use your version of this file under the terms of the MPL, indicate your
 30 * decision by deleting the provisions above and replace them with the notice
 31 * and other provisions required by the GPL or the LGPL. If you do not delete
 32 * the provisions above, a recipient may use your version of this file under
 33 * the terms of any one of the MPL, the GPL or the LGPL.
 34 *
 35 * ***** END LICENSE BLOCK ***** */
 36
 37#ifndef _P12T_H_
 38#define _P12T_H_
 39
 40#include "secoid.h"
 41#include "key.h"
 42#include "pkcs11.h"
 43#include "secpkcs7.h"
 44#include "secdig.h"	/* for SGNDigestInfo */
 45#include "pkcs12t.h"
 46
 47#define SEC_PKCS12_VERSION	3
 48
 49/* structure declarations */
 50typedef struct sec_PKCS12PFXItemStr sec_PKCS12PFXItem;
 51typedef struct sec_PKCS12MacDataStr sec_PKCS12MacData;
 52typedef struct sec_PKCS12AuthenticatedSafeStr sec_PKCS12AuthenticatedSafe;
 53typedef struct sec_PKCS12SafeContentsStr sec_PKCS12SafeContents;
 54typedef struct sec_PKCS12SafeBagStr sec_PKCS12SafeBag;
 55typedef struct sec_PKCS12PKCS8ShroudedKeyBagStr sec_PKCS12PKCS8ShroudedKeyBag;
 56typedef struct sec_PKCS12CertBagStr sec_PKCS12CertBag;
 57typedef struct sec_PKCS12CRLBagStr sec_PKCS12CRLBag;
 58typedef struct sec_PKCS12SecretBag sec_PKCS12SecretBag;
 59typedef struct sec_PKCS12AttributeStr sec_PKCS12Attribute;
 60
 61struct sec_PKCS12CertBagStr {
 62    /* what type of cert is stored? */
 63    SECItem bagID;
 64
 65    /* certificate information */
 66    union {
 67	SECItem x509Cert;
 68	SECItem SDSICert;
 69    } value;
 70};
 71
 72struct sec_PKCS12CRLBagStr {
 73    /* what type of cert is stored? */
 74    SECItem bagID;
 75
 76    /* certificate information */
 77    union {
 78	SECItem x509CRL;
 79    } value;
 80};
 81
 82struct sec_PKCS12SecretBag {
 83    /* what type of secret? */
 84    SECItem secretType;
 85
 86    /* secret information.  ssshhhh be vewy vewy quiet. */
 87    SECItem secretContent;
 88};
 89
 90struct sec_PKCS12AttributeStr {
 91    SECItem attrType;
 92    SECItem **attrValue;
 93};
 94
 95struct sec_PKCS12SafeBagStr {
 96
 97    /* What type of bag are we using? */
 98    SECItem safeBagType;
 99
100    /* Dependent upon the type of bag being used. */
101    union {
102	SECKEYPrivateKeyInfo *pkcs8KeyBag;
103	SECKEYEncryptedPrivateKeyInfo *pkcs8ShroudedKeyBag;
104	sec_PKCS12CertBag *certBag;
105	sec_PKCS12CRLBag *crlBag;
106	sec_PKCS12SecretBag *secretBag;
107	sec_PKCS12SafeContents *safeContents;
108    } safeBagContent;
109
110    sec_PKCS12Attribute **attribs;
111
112    /* used locally */
113    SECOidData *bagTypeTag;
114    PRArenaPool *arena;
115    unsigned int nAttribs;
116
117    /* used for validation/importing */
118    PRBool problem, noInstall, validated, hasKey, unused, installed;
119    int error;
120
121    PRBool swapUnicodeBytes;
122    PK11SlotInfo *slot;
123    SECItem *pwitem;
124    PRBool oldBagType;
125    SECPKCS12TargetTokenCAs tokenCAs;
126};
127    
128struct sec_PKCS12SafeContentsStr {
129    sec_PKCS12SafeBag **safeBags;
130    SECItem **encodedSafeBags;
131    
132    /* used locally */
133    PRArenaPool *arena;
134    unsigned int bagCount;
135};
136
137struct sec_PKCS12MacDataStr {
138    SGNDigestInfo safeMac;
139    SECItem macSalt;
140    SECItem iter;
141};
142
143struct sec_PKCS12PFXItemStr {
144
145    SECItem version;
146
147    /* Content type will either be Data (password integrity mode)
148     * or signedData (public-key integrity mode)
149     */
150    SEC_PKCS7ContentInfo *authSafe;
151    SECItem encodedAuthSafe;
152
153    /* Only present in password integrity mode */
154    sec_PKCS12MacData macData;
155    SECItem encodedMacData;
156};
157
158struct sec_PKCS12AuthenticatedSafeStr {
159    /* Content type will either be encryptedData (password privacy mode)
160     * or envelopedData (public-key privacy mode)
161     */
162    SEC_PKCS7ContentInfo **safes;
163    SECItem **encodedSafes;
164
165    /* used locally */
166    unsigned int safeCount;
167    SECItem dummySafe;
168};
169
170extern const SEC_ASN1Template sec_PKCS12PFXItemTemplate[];
171extern const SEC_ASN1Template sec_PKCS12MacDataTemplate[];
172extern const SEC_ASN1Template sec_PKCS12AuthenticatedSafeTemplate[];
173extern const SEC_ASN1Template sec_PKCS12SafeContentsTemplate[];
174extern const SEC_ASN1Template sec_PKCS12SafeContentsDecodeTemplate[];
175extern const SEC_ASN1Template sec_PKCS12NestedSafeContentsDecodeTemplate[];
176extern const SEC_ASN1Template sec_PKCS12CertBagTemplate[];
177extern const SEC_ASN1Template sec_PKCS12CRLBagTemplate[];
178extern const SEC_ASN1Template sec_PKCS12SecretBagTemplate[];
179extern const SEC_ASN1Template sec_PKCS12PointerToCertBagTemplate[];
180extern const SEC_ASN1Template sec_PKCS12PointerToCRLBagTemplate[];
181extern const SEC_ASN1Template sec_PKCS12PointerToSecretBagTemplate[];
182extern const SEC_ASN1Template sec_PKCS12PointerToSafeContentsTemplate[];
183extern const SEC_ASN1Template sec_PKCS12AttributeTemplate[];
184extern const SEC_ASN1Template sec_PKCS12PointerToContentInfoTemplate[];
185extern const SEC_ASN1Template sec_PKCS12SafeBagTemplate[];
186
187#endif