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
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.
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 ***** */
50 /* helper functions */
51 extern const SEC_ASN1Template
*
52 sec_pkcs12_choose_bag_type(void *src_or_dest
, PRBool encoding
);
53 extern const SEC_ASN1Template
*
54 sec_pkcs12_choose_cert_crl_type(void *src_or_dest
, PRBool encoding
);
55 extern const SEC_ASN1Template
*
56 sec_pkcs12_choose_shroud_type(void *src_or_dest
, PRBool encoding
);
57 extern SECItem
*sec_pkcs12_generate_salt(void);
58 extern SECItem
*sec_pkcs12_generate_key_from_password(SECOidTag algorithm
,
59 SECItem
*salt
, SECItem
*password
);
60 extern SECItem
*sec_pkcs12_generate_mac(SECItem
*key
, SECItem
*msg
,
62 extern SGNDigestInfo
*sec_pkcs12_compute_thumbprint(SECItem
*der_cert
);
63 extern SECItem
*sec_pkcs12_create_virtual_password(SECItem
*password
,
64 SECItem
*salt
, PRBool swapUnicodeBytes
);
65 extern SECStatus
sec_pkcs12_append_shrouded_key(SEC_PKCS12BaggageItem
*bag
,
66 SEC_PKCS12ESPVKItem
*espvk
);
67 extern void *sec_pkcs12_find_object(SEC_PKCS12SafeContents
*safe
,
68 SEC_PKCS12Baggage
*baggage
, SECOidTag objType
,
69 SECItem
*nickname
, SGNDigestInfo
*thumbprint
);
70 extern PRBool
sec_pkcs12_convert_item_to_unicode(PRArenaPool
*arena
, SECItem
*dest
,
71 SECItem
*src
, PRBool zeroTerm
,
72 PRBool asciiConvert
, PRBool toUnicode
);
73 extern CK_MECHANISM_TYPE
sec_pkcs12_algtag_to_mech(SECOidTag algtag
);
75 /* create functions */
76 extern SEC_PKCS12PFXItem
*sec_pkcs12_new_pfx(void);
77 extern SEC_PKCS12SafeContents
*sec_pkcs12_create_safe_contents(
79 extern SEC_PKCS12Baggage
*sec_pkcs12_create_baggage(PRArenaPool
*poolp
);
80 extern SEC_PKCS12BaggageItem
*sec_pkcs12_create_external_bag(SEC_PKCS12Baggage
*luggage
);
81 extern void SEC_PKCS12DestroyPFX(SEC_PKCS12PFXItem
*pfx
);
82 extern SEC_PKCS12AuthenticatedSafe
*sec_pkcs12_new_asafe(PRArenaPool
*poolp
);
84 /* conversion from old to new */
85 extern SEC_PKCS12DecoderContext
*
86 sec_PKCS12ConvertOldSafeToNew(PRArenaPool
*arena
, PK11SlotInfo
*slot
,
87 PRBool swapUnicode
, SECItem
*pwitem
,
88 void *wincx
, SEC_PKCS12SafeContents
*safe
,
89 SEC_PKCS12Baggage
*baggage
);