|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 |
|
6 #ifndef _P12LOCAL_H_ |
|
7 #define _P12LOCAL_H_ |
|
8 |
|
9 #include "plarena.h" |
|
10 #include "secoidt.h" |
|
11 #include "secasn1.h" |
|
12 #include "secder.h" |
|
13 #include "certt.h" |
|
14 #include "secpkcs7.h" |
|
15 #include "pkcs12.h" |
|
16 #include "p12.h" |
|
17 |
|
18 /* helper functions */ |
|
19 extern const SEC_ASN1Template * |
|
20 sec_pkcs12_choose_bag_type(void *src_or_dest, PRBool encoding); |
|
21 extern const SEC_ASN1Template * |
|
22 sec_pkcs12_choose_cert_crl_type(void *src_or_dest, PRBool encoding); |
|
23 extern const SEC_ASN1Template * |
|
24 sec_pkcs12_choose_shroud_type(void *src_or_dest, PRBool encoding); |
|
25 extern SECItem *sec_pkcs12_generate_salt(void); |
|
26 extern SECItem *sec_pkcs12_generate_key_from_password(SECOidTag algorithm, |
|
27 SECItem *salt, SECItem *password); |
|
28 extern SECItem *sec_pkcs12_generate_mac(SECItem *key, SECItem *msg, |
|
29 PRBool old_method); |
|
30 extern SGNDigestInfo *sec_pkcs12_compute_thumbprint(SECItem *der_cert); |
|
31 extern SECItem *sec_pkcs12_create_virtual_password(SECItem *password, |
|
32 SECItem *salt, PRBool swapUnicodeBytes); |
|
33 extern SECStatus sec_pkcs12_append_shrouded_key(SEC_PKCS12BaggageItem *bag, |
|
34 SEC_PKCS12ESPVKItem *espvk); |
|
35 extern void *sec_pkcs12_find_object(SEC_PKCS12SafeContents *safe, |
|
36 SEC_PKCS12Baggage *baggage, SECOidTag objType, |
|
37 SECItem *nickname, SGNDigestInfo *thumbprint); |
|
38 extern PRBool sec_pkcs12_convert_item_to_unicode(PLArenaPool *arena, SECItem *dest, |
|
39 SECItem *src, PRBool zeroTerm, |
|
40 PRBool asciiConvert, PRBool toUnicode); |
|
41 extern CK_MECHANISM_TYPE sec_pkcs12_algtag_to_mech(SECOidTag algtag); |
|
42 |
|
43 /* create functions */ |
|
44 extern SEC_PKCS12PFXItem *sec_pkcs12_new_pfx(void); |
|
45 extern SEC_PKCS12SafeContents *sec_pkcs12_create_safe_contents( |
|
46 PLArenaPool *poolp); |
|
47 extern SEC_PKCS12Baggage *sec_pkcs12_create_baggage(PLArenaPool *poolp); |
|
48 extern SEC_PKCS12BaggageItem *sec_pkcs12_create_external_bag(SEC_PKCS12Baggage *luggage); |
|
49 extern void SEC_PKCS12DestroyPFX(SEC_PKCS12PFXItem *pfx); |
|
50 extern SEC_PKCS12AuthenticatedSafe *sec_pkcs12_new_asafe(PLArenaPool *poolp); |
|
51 |
|
52 /* conversion from old to new */ |
|
53 extern SEC_PKCS12DecoderContext * |
|
54 sec_PKCS12ConvertOldSafeToNew(PLArenaPool *arena, PK11SlotInfo *slot, |
|
55 PRBool swapUnicode, SECItem *pwitem, |
|
56 void *wincx, SEC_PKCS12SafeContents *safe, |
|
57 SEC_PKCS12Baggage *baggage); |
|
58 |
|
59 #endif |