andre@0: /* This Source Code Form is subject to the terms of the Mozilla Public andre@0: * License, v. 2.0. If a copy of the MPL was not distributed with this andre@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ andre@0: #ifndef _SECPKCS5_H_ andre@0: #define _SECPKCS5_H_ andre@0: #include "seccomon.h" andre@0: #include "secmodt.h" andre@0: andre@0: /* used for V2 PKCS 12 Draft Spec */ andre@0: typedef enum { andre@0: pbeBitGenIDNull = 0, andre@0: pbeBitGenCipherKey = 0x01, andre@0: pbeBitGenCipherIV = 0x02, andre@0: pbeBitGenIntegrityKey = 0x03 andre@0: } PBEBitGenID; andre@0: andre@0: typedef struct PBEBitGenContextStr PBEBitGenContext; andre@0: andre@0: SEC_BEGIN_PROTOS andre@0: andre@0: /* private */ andre@0: SECAlgorithmID * andre@0: sec_pkcs5CreateAlgorithmID(SECOidTag algorithm, SECOidTag cipherAlgorithm, andre@0: SECOidTag prfAlg, SECOidTag *pPbeAlgorithm, andre@0: int keyLengh, SECItem *salt, int iteration); andre@0: andre@0: /* Get the initialization vector. The password is passed in, hashing andre@0: * is performed, and the initialization vector is returned. andre@0: * algid is a pointer to a PBE algorithm ID andre@0: * pwitem is the password andre@0: * If an error occurs or the algorithm id is not a PBE algrithm, andre@0: * NULL is returned. Otherwise, the iv is returned in a secitem. andre@0: */ andre@0: SECItem * andre@0: SEC_PKCS5GetIV(SECAlgorithmID *algid, SECItem *pwitem, PRBool faulty3DES); andre@0: andre@0: SECOidTag SEC_PKCS5GetCryptoAlgorithm(SECAlgorithmID *algid); andre@0: PRBool SEC_PKCS5IsAlgorithmPBEAlg(SECAlgorithmID *algid); andre@0: PRBool SEC_PKCS5IsAlgorithmPBEAlgTag(SECOidTag algTag); andre@0: SECOidTag SEC_PKCS5GetPBEAlgorithm(SECOidTag algTag, int keyLen); andre@0: int SEC_PKCS5GetKeyLength(SECAlgorithmID *algid); andre@0: andre@0: /********************************************************************** andre@0: * Deprecated PBE functions. Use the PBE functions in pk11func.h andre@0: * instead. andre@0: **********************************************************************/ andre@0: andre@0: PBEBitGenContext * andre@0: PBE_CreateContext(SECOidTag hashAlgorithm, PBEBitGenID bitGenPurpose, andre@0: SECItem *pwitem, SECItem *salt, unsigned int bitsNeeded, andre@0: unsigned int iterations); andre@0: andre@0: void andre@0: PBE_DestroyContext(PBEBitGenContext *context); andre@0: andre@0: andre@0: SECItem * andre@0: PBE_GenerateBits(PBEBitGenContext *context); andre@0: andre@0: SEC_END_PROTOS andre@0: andre@0: #endif /* _SECPKS5_H_ */