p12local.h (3811B)
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 #ifndef _P12LOCAL_H_ 6 #define _P12LOCAL_H_ 7 8 #include "plarena.h" 9 #include "secoidt.h" 10 #include "secasn1.h" 11 #include "secder.h" 12 #include "certt.h" 13 #include "secpkcs7.h" 14 #include "pkcs12.h" 15 #include "p12.h" 16 17 /* helper functions */ 18 extern const SEC_ASN1Template * 19 sec_pkcs12_choose_bag_type(void *src_or_dest, PRBool encoding); 20 extern const SEC_ASN1Template * 21 sec_pkcs12_choose_cert_crl_type(void *src_or_dest, PRBool encoding); 22 extern const SEC_ASN1Template * 23 sec_pkcs12_choose_shroud_type(void *src_or_dest, PRBool encoding); 24 extern SECItem *sec_pkcs12_generate_salt(void); 25 extern SECItem *sec_pkcs12_generate_key_from_password(SECOidTag algorithm, 26 SECItem *salt, SECItem *password); 27 extern SECItem *sec_pkcs12_generate_mac(SECItem *key, SECItem *msg, 28 PRBool old_method); 29 PK11SymKey *sec_pkcs12_integrity_key(PK11SlotInfo *slot, 30 sec_PKCS12MacData *macData, 31 SECItem *pwitem, 32 CK_MECHANISM_TYPE *hmacMech, 33 PRBool isDecrypt, 34 void *pwarg); 35 extern SGNDigestInfo *sec_pkcs12_compute_thumbprint(SECItem *der_cert); 36 extern SECItem *sec_pkcs12_create_virtual_password(SECItem *password, 37 SECItem *salt, PRBool swapUnicodeBytes); 38 extern SECStatus sec_pkcs12_append_shrouded_key(SEC_PKCS12BaggageItem *bag, 39 SEC_PKCS12ESPVKItem *espvk); 40 extern void *sec_pkcs12_find_object(SEC_PKCS12SafeContents *safe, 41 SEC_PKCS12Baggage *baggage, SECOidTag objType, 42 SECItem *nickname, SGNDigestInfo *thumbprint); 43 extern PRBool sec_pkcs12_convert_item_to_unicode(PLArenaPool *arena, SECItem *dest, 44 SECItem *src, PRBool zeroTerm, 45 PRBool asciiConvert, PRBool toUnicode); 46 extern CK_MECHANISM_TYPE sec_pkcs12_algtag_to_mech(SECOidTag algtag); 47 extern CK_MECHANISM_TYPE sec_pkcs12_algtag_to_keygen_mech(SECOidTag algtag); 48 49 /* create functions */ 50 extern SEC_PKCS12PFXItem *sec_pkcs12_new_pfx(void); 51 extern SEC_PKCS12SafeContents *sec_pkcs12_create_safe_contents( 52 PLArenaPool *poolp); 53 extern SEC_PKCS12Baggage *sec_pkcs12_create_baggage(PLArenaPool *poolp); 54 extern SEC_PKCS12BaggageItem *sec_pkcs12_create_external_bag(SEC_PKCS12Baggage *luggage); 55 extern void SEC_PKCS12DestroyPFX(SEC_PKCS12PFXItem *pfx); 56 extern SEC_PKCS12AuthenticatedSafe *sec_pkcs12_new_asafe(PLArenaPool *poolp); 57 58 /* conversion from old to new */ 59 extern SEC_PKCS12DecoderContext * 60 sec_PKCS12ConvertOldSafeToNew(PLArenaPool *arena, PK11SlotInfo *slot, 61 PRBool swapUnicode, SECItem *pwitem, 62 void *wincx, SEC_PKCS12SafeContents *safe, 63 SEC_PKCS12Baggage *baggage); 64 65 extern PRBool sec_pkcs12_is_pkcs12_pbe_algorithm(SECOidTag algorithm); 66 67 extern PRBool sec_pkcs12_decode_password(PLArenaPool *arena, 68 SECItem *result, 69 SECOidTag algorithm, 70 const SECItem *pwitem); 71 extern PRBool sec_pkcs12_encode_password(PLArenaPool *arena, 72 SECItem *result, 73 SECOidTag algorithm, 74 const SECItem *pwitem); 75 76 #endif