michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: #ifndef _P12LOCAL_H_ michael@0: #define _P12LOCAL_H_ michael@0: michael@0: #include "plarena.h" michael@0: #include "secoidt.h" michael@0: #include "secasn1.h" michael@0: #include "secder.h" michael@0: #include "certt.h" michael@0: #include "secpkcs7.h" michael@0: #include "pkcs12.h" michael@0: #include "p12.h" michael@0: michael@0: /* helper functions */ michael@0: extern const SEC_ASN1Template * michael@0: sec_pkcs12_choose_bag_type(void *src_or_dest, PRBool encoding); michael@0: extern const SEC_ASN1Template * michael@0: sec_pkcs12_choose_cert_crl_type(void *src_or_dest, PRBool encoding); michael@0: extern const SEC_ASN1Template * michael@0: sec_pkcs12_choose_shroud_type(void *src_or_dest, PRBool encoding); michael@0: extern SECItem *sec_pkcs12_generate_salt(void); michael@0: extern SECItem *sec_pkcs12_generate_key_from_password(SECOidTag algorithm, michael@0: SECItem *salt, SECItem *password); michael@0: extern SECItem *sec_pkcs12_generate_mac(SECItem *key, SECItem *msg, michael@0: PRBool old_method); michael@0: extern SGNDigestInfo *sec_pkcs12_compute_thumbprint(SECItem *der_cert); michael@0: extern SECItem *sec_pkcs12_create_virtual_password(SECItem *password, michael@0: SECItem *salt, PRBool swapUnicodeBytes); michael@0: extern SECStatus sec_pkcs12_append_shrouded_key(SEC_PKCS12BaggageItem *bag, michael@0: SEC_PKCS12ESPVKItem *espvk); michael@0: extern void *sec_pkcs12_find_object(SEC_PKCS12SafeContents *safe, michael@0: SEC_PKCS12Baggage *baggage, SECOidTag objType, michael@0: SECItem *nickname, SGNDigestInfo *thumbprint); michael@0: extern PRBool sec_pkcs12_convert_item_to_unicode(PLArenaPool *arena, SECItem *dest, michael@0: SECItem *src, PRBool zeroTerm, michael@0: PRBool asciiConvert, PRBool toUnicode); michael@0: extern CK_MECHANISM_TYPE sec_pkcs12_algtag_to_mech(SECOidTag algtag); michael@0: michael@0: /* create functions */ michael@0: extern SEC_PKCS12PFXItem *sec_pkcs12_new_pfx(void); michael@0: extern SEC_PKCS12SafeContents *sec_pkcs12_create_safe_contents( michael@0: PLArenaPool *poolp); michael@0: extern SEC_PKCS12Baggage *sec_pkcs12_create_baggage(PLArenaPool *poolp); michael@0: extern SEC_PKCS12BaggageItem *sec_pkcs12_create_external_bag(SEC_PKCS12Baggage *luggage); michael@0: extern void SEC_PKCS12DestroyPFX(SEC_PKCS12PFXItem *pfx); michael@0: extern SEC_PKCS12AuthenticatedSafe *sec_pkcs12_new_asafe(PLArenaPool *poolp); michael@0: michael@0: /* conversion from old to new */ michael@0: extern SEC_PKCS12DecoderContext * michael@0: sec_PKCS12ConvertOldSafeToNew(PLArenaPool *arena, PK11SlotInfo *slot, michael@0: PRBool swapUnicode, SECItem *pwitem, michael@0: void *wincx, SEC_PKCS12SafeContents *safe, michael@0: SEC_PKCS12Baggage *baggage); michael@0: michael@0: #endif