Bug 460926 A11y hierachy is broken on Ubuntu 8.10 (GNOME 2.24), r=Evan.Yan sr=roc
[wine-gecko.git] / security / nss / lib / pkcs12 / p12.h
blob852047c1f2f3b16a31661674dabf85f5e44bcd07
1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
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/
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.
14 * The Original Code is the Netscape security libraries.
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.
21 * Contributor(s):
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.
35 * ***** END LICENSE BLOCK ***** */
38 #ifndef _P12_H_
39 #define _P12_H_
41 #include "secoid.h"
42 #include "key.h"
43 #include "secpkcs7.h"
44 #include "p12t.h"
46 typedef int (PR_CALLBACK * PKCS12OpenFunction)(void *arg);
47 typedef int (PR_CALLBACK * PKCS12ReadFunction)(void *arg,
48 unsigned char *buffer,
49 unsigned int *lenRead,
50 unsigned int maxLen);
51 typedef int (PR_CALLBACK * PKCS12WriteFunction)(void *arg,
52 unsigned char *buffer,
53 unsigned int *bufLen,
54 unsigned int *lenWritten);
55 typedef int (PR_CALLBACK * PKCS12CloseFunction)(void *arg);
56 typedef SECStatus (PR_CALLBACK * PKCS12UnicodeConvertFunction)(
57 PLArenaPool *arena,
58 SECItem *dest, SECItem *src,
59 PRBool toUnicode,
60 PRBool swapBytes);
61 typedef void (PR_CALLBACK * SEC_PKCS12EncoderOutputCallback)(
62 void *arg, const char *buf,
63 unsigned long len);
64 typedef void (PR_CALLBACK * SEC_PKCS12DecoderOutputCallback)(
65 void *arg, const char *buf,
66 unsigned long len);
67 typedef SECItem * (PR_CALLBACK * SEC_PKCS12NicknameCollisionCallback)(
68 SECItem *old_nickname,
69 PRBool *cancel,
70 void *arg);
75 typedef SECStatus (PR_CALLBACK *digestOpenFn)(void *arg, PRBool readData);
76 typedef SECStatus (PR_CALLBACK *digestCloseFn)(void *arg, PRBool removeFile);
77 typedef int (PR_CALLBACK *digestIOFn)(void *arg, unsigned char *buf,
78 unsigned long len);
80 typedef struct SEC_PKCS12ExportContextStr SEC_PKCS12ExportContext;
81 typedef struct SEC_PKCS12SafeInfoStr SEC_PKCS12SafeInfo;
82 typedef struct SEC_PKCS12DecoderContextStr SEC_PKCS12DecoderContext;
83 typedef struct SEC_PKCS12DecoderItemStr SEC_PKCS12DecoderItem;
85 struct sec_PKCS12PasswordModeInfo {
86 SECItem *password;
87 SECOidTag algorithm;
90 struct sec_PKCS12PublicKeyModeInfo {
91 CERTCertificate *cert;
92 CERTCertDBHandle *certDb;
93 SECOidTag algorithm;
94 int keySize;
97 struct SEC_PKCS12DecoderItemStr {
98 SECItem *der;
99 SECOidTag type;
100 PRBool hasKey;
101 SECItem *friendlyName; /* UTF-8 string */
102 SECAlgorithmID *shroudAlg;
106 SEC_BEGIN_PROTOS
108 SEC_PKCS12SafeInfo *
109 SEC_PKCS12CreatePubKeyEncryptedSafe(SEC_PKCS12ExportContext *p12ctxt,
110 CERTCertDBHandle *certDb,
111 CERTCertificate *signer,
112 CERTCertificate **recipients,
113 SECOidTag algorithm, int keysize);
115 extern SEC_PKCS12SafeInfo *
116 SEC_PKCS12CreatePasswordPrivSafe(SEC_PKCS12ExportContext *p12ctxt,
117 SECItem *pwitem, SECOidTag privAlg);
119 extern SEC_PKCS12SafeInfo *
120 SEC_PKCS12CreateUnencryptedSafe(SEC_PKCS12ExportContext *p12ctxt);
122 extern SECStatus
123 SEC_PKCS12AddPasswordIntegrity(SEC_PKCS12ExportContext *p12ctxt,
124 SECItem *pwitem, SECOidTag integAlg);
125 extern SECStatus
126 SEC_PKCS12AddPublicKeyIntegrity(SEC_PKCS12ExportContext *p12ctxt,
127 CERTCertificate *cert, CERTCertDBHandle *certDb,
128 SECOidTag algorithm, int keySize);
130 extern SEC_PKCS12ExportContext *
131 SEC_PKCS12CreateExportContext(SECKEYGetPasswordKey pwfn, void *pwfnarg,
132 PK11SlotInfo *slot, void *wincx);
134 extern SECStatus
135 SEC_PKCS12AddCert(SEC_PKCS12ExportContext *p12ctxt,
136 SEC_PKCS12SafeInfo *safe, void *nestedDest,
137 CERTCertificate *cert, CERTCertDBHandle *certDb,
138 SECItem *keyId, PRBool includeCertChain);
140 extern SECStatus
141 SEC_PKCS12AddKeyForCert(SEC_PKCS12ExportContext *p12ctxt,
142 SEC_PKCS12SafeInfo *safe,
143 void *nestedDest, CERTCertificate *cert,
144 PRBool shroudKey, SECOidTag algorithm, SECItem *pwitem,
145 SECItem *keyId, SECItem *nickName);
147 extern SECStatus
148 SEC_PKCS12AddCertOrChainAndKey(SEC_PKCS12ExportContext *p12ctxt,
149 void *certSafe, void *certNestedDest,
150 CERTCertificate *cert, CERTCertDBHandle *certDb,
151 void *keySafe, void *keyNestedDest, PRBool shroudKey,
152 SECItem *pwitem, SECOidTag algorithm,
153 PRBool includeCertChain);
156 extern SECStatus
157 SEC_PKCS12AddCertAndKey(SEC_PKCS12ExportContext *p12ctxt,
158 void *certSafe, void *certNestedDest,
159 CERTCertificate *cert, CERTCertDBHandle *certDb,
160 void *keySafe, void *keyNestedDest,
161 PRBool shroudKey, SECItem *pwitem, SECOidTag algorithm);
163 extern void *
164 SEC_PKCS12CreateNestedSafeContents(SEC_PKCS12ExportContext *p12ctxt,
165 void *baseSafe, void *nestedDest);
167 extern SECStatus
168 SEC_PKCS12Encode(SEC_PKCS12ExportContext *p12exp,
169 SEC_PKCS12EncoderOutputCallback output, void *outputarg);
171 extern void
172 SEC_PKCS12DestroyExportContext(SEC_PKCS12ExportContext *p12exp);
174 extern SEC_PKCS12DecoderContext *
175 SEC_PKCS12DecoderStart(SECItem *pwitem, PK11SlotInfo *slot, void *wincx,
176 digestOpenFn dOpen, digestCloseFn dClose,
177 digestIOFn dRead, digestIOFn dWrite, void *dArg);
179 extern SECStatus
180 SEC_PKCS12DecoderSetTargetTokenCAs(SEC_PKCS12DecoderContext *p12dcx,
181 SECPKCS12TargetTokenCAs tokenCAs);
183 extern SECStatus
184 SEC_PKCS12DecoderUpdate(SEC_PKCS12DecoderContext *p12dcx, unsigned char *data,
185 unsigned long len);
187 extern void
188 SEC_PKCS12DecoderFinish(SEC_PKCS12DecoderContext *p12dcx);
190 extern SECStatus
191 SEC_PKCS12DecoderVerify(SEC_PKCS12DecoderContext *p12dcx);
193 extern SECStatus
194 SEC_PKCS12DecoderValidateBags(SEC_PKCS12DecoderContext *p12dcx,
195 SEC_PKCS12NicknameCollisionCallback nicknameCb);
197 extern SECStatus
198 SEC_PKCS12DecoderImportBags(SEC_PKCS12DecoderContext *p12dcx);
200 CERTCertList *
201 SEC_PKCS12DecoderGetCerts(SEC_PKCS12DecoderContext *p12dcx);
203 SECStatus
204 SEC_PKCS12DecoderIterateInit(SEC_PKCS12DecoderContext *p12dcx);
206 SECStatus
207 SEC_PKCS12DecoderIterateNext(SEC_PKCS12DecoderContext *p12dcx,
208 const SEC_PKCS12DecoderItem **ipp);
210 SEC_END_PROTOS
212 #endif