1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/pk11wrap/secpkcs5.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 +#ifndef _SECPKCS5_H_ 1.8 +#define _SECPKCS5_H_ 1.9 +#include "seccomon.h" 1.10 +#include "secmodt.h" 1.11 + 1.12 +/* used for V2 PKCS 12 Draft Spec */ 1.13 +typedef enum { 1.14 + pbeBitGenIDNull = 0, 1.15 + pbeBitGenCipherKey = 0x01, 1.16 + pbeBitGenCipherIV = 0x02, 1.17 + pbeBitGenIntegrityKey = 0x03 1.18 +} PBEBitGenID; 1.19 + 1.20 +typedef struct PBEBitGenContextStr PBEBitGenContext; 1.21 + 1.22 +SEC_BEGIN_PROTOS 1.23 + 1.24 +/* private */ 1.25 +SECAlgorithmID * 1.26 +sec_pkcs5CreateAlgorithmID(SECOidTag algorithm, SECOidTag cipherAlgorithm, 1.27 + SECOidTag prfAlg, SECOidTag *pPbeAlgorithm, 1.28 + int keyLengh, SECItem *salt, int iteration); 1.29 + 1.30 +/* Get the initialization vector. The password is passed in, hashing 1.31 + * is performed, and the initialization vector is returned. 1.32 + * algid is a pointer to a PBE algorithm ID 1.33 + * pwitem is the password 1.34 + * If an error occurs or the algorithm id is not a PBE algrithm, 1.35 + * NULL is returned. Otherwise, the iv is returned in a secitem. 1.36 + */ 1.37 +SECItem * 1.38 +SEC_PKCS5GetIV(SECAlgorithmID *algid, SECItem *pwitem, PRBool faulty3DES); 1.39 + 1.40 +SECOidTag SEC_PKCS5GetCryptoAlgorithm(SECAlgorithmID *algid); 1.41 +PRBool SEC_PKCS5IsAlgorithmPBEAlg(SECAlgorithmID *algid); 1.42 +PRBool SEC_PKCS5IsAlgorithmPBEAlgTag(SECOidTag algTag); 1.43 +SECOidTag SEC_PKCS5GetPBEAlgorithm(SECOidTag algTag, int keyLen); 1.44 +int SEC_PKCS5GetKeyLength(SECAlgorithmID *algid); 1.45 + 1.46 +/********************************************************************** 1.47 + * Deprecated PBE functions. Use the PBE functions in pk11func.h 1.48 + * instead. 1.49 + **********************************************************************/ 1.50 + 1.51 +PBEBitGenContext * 1.52 +PBE_CreateContext(SECOidTag hashAlgorithm, PBEBitGenID bitGenPurpose, 1.53 + SECItem *pwitem, SECItem *salt, unsigned int bitsNeeded, 1.54 + unsigned int iterations); 1.55 + 1.56 +void 1.57 +PBE_DestroyContext(PBEBitGenContext *context); 1.58 + 1.59 + 1.60 +SECItem * 1.61 +PBE_GenerateBits(PBEBitGenContext *context); 1.62 + 1.63 +SEC_END_PROTOS 1.64 + 1.65 +#endif /* _SECPKS5_H_ */