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: #ifndef _SECPKCS5_H_ michael@0: #define _SECPKCS5_H_ michael@0: #include "seccomon.h" michael@0: #include "secmodt.h" michael@0: michael@0: /* used for V2 PKCS 12 Draft Spec */ michael@0: typedef enum { michael@0: pbeBitGenIDNull = 0, michael@0: pbeBitGenCipherKey = 0x01, michael@0: pbeBitGenCipherIV = 0x02, michael@0: pbeBitGenIntegrityKey = 0x03 michael@0: } PBEBitGenID; michael@0: michael@0: typedef struct PBEBitGenContextStr PBEBitGenContext; michael@0: michael@0: SEC_BEGIN_PROTOS michael@0: michael@0: /* private */ michael@0: SECAlgorithmID * michael@0: sec_pkcs5CreateAlgorithmID(SECOidTag algorithm, SECOidTag cipherAlgorithm, michael@0: SECOidTag prfAlg, SECOidTag *pPbeAlgorithm, michael@0: int keyLengh, SECItem *salt, int iteration); michael@0: michael@0: /* Get the initialization vector. The password is passed in, hashing michael@0: * is performed, and the initialization vector is returned. michael@0: * algid is a pointer to a PBE algorithm ID michael@0: * pwitem is the password michael@0: * If an error occurs or the algorithm id is not a PBE algrithm, michael@0: * NULL is returned. Otherwise, the iv is returned in a secitem. michael@0: */ michael@0: SECItem * michael@0: SEC_PKCS5GetIV(SECAlgorithmID *algid, SECItem *pwitem, PRBool faulty3DES); michael@0: michael@0: SECOidTag SEC_PKCS5GetCryptoAlgorithm(SECAlgorithmID *algid); michael@0: PRBool SEC_PKCS5IsAlgorithmPBEAlg(SECAlgorithmID *algid); michael@0: PRBool SEC_PKCS5IsAlgorithmPBEAlgTag(SECOidTag algTag); michael@0: SECOidTag SEC_PKCS5GetPBEAlgorithm(SECOidTag algTag, int keyLen); michael@0: int SEC_PKCS5GetKeyLength(SECAlgorithmID *algid); michael@0: michael@0: /********************************************************************** michael@0: * Deprecated PBE functions. Use the PBE functions in pk11func.h michael@0: * instead. michael@0: **********************************************************************/ michael@0: michael@0: PBEBitGenContext * michael@0: PBE_CreateContext(SECOidTag hashAlgorithm, PBEBitGenID bitGenPurpose, michael@0: SECItem *pwitem, SECItem *salt, unsigned int bitsNeeded, michael@0: unsigned int iterations); michael@0: michael@0: void michael@0: PBE_DestroyContext(PBEBitGenContext *context); michael@0: michael@0: michael@0: SECItem * michael@0: PBE_GenerateBits(PBEBitGenContext *context); michael@0: michael@0: SEC_END_PROTOS michael@0: michael@0: #endif /* _SECPKS5_H_ */