OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 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 | 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/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 #ifndef _SECPKCS5_H_ | 4 #ifndef _SECPKCS5_H_ |
5 #define _SECPKCS5_H_ | 5 #define _SECPKCS5_H_ |
6 #include "seccomon.h" | 6 #include "seccomon.h" |
7 #include "secmodt.h" | 7 #include "secmodt.h" |
8 | 8 |
9 /* used for V2 PKCS 12 Draft Spec */ | 9 /* used for V2 PKCS 12 Draft Spec */ |
10 typedef enum { | 10 typedef enum { |
11 pbeBitGenIDNull = 0, | 11 pbeBitGenIDNull = 0, |
12 pbeBitGenCipherKey = 0x01, | 12 pbeBitGenCipherKey = 0x01, |
13 pbeBitGenCipherIV = 0x02, | 13 pbeBitGenCipherIV = 0x02, |
14 pbeBitGenIntegrityKey = 0x03 | 14 pbeBitGenIntegrityKey = 0x03 |
15 } PBEBitGenID; | 15 } PBEBitGenID; |
16 | 16 |
17 typedef struct PBEBitGenContextStr PBEBitGenContext; | 17 typedef struct PBEBitGenContextStr PBEBitGenContext; |
18 | 18 |
19 SEC_BEGIN_PROTOS | 19 SEC_BEGIN_PROTOS |
20 | 20 |
21 /* private */ | 21 /* private */ |
22 SECAlgorithmID * | 22 SECAlgorithmID *sec_pkcs5CreateAlgorithmID( |
23 sec_pkcs5CreateAlgorithmID(SECOidTag algorithm, SECOidTag cipherAlgorithm, | 23 SECOidTag algorithm, SECOidTag cipherAlgorithm, SECOidTag prfAlg, |
24 » » » SECOidTag prfAlg, SECOidTag *pPbeAlgorithm, | 24 SECOidTag *pPbeAlgorithm, int keyLengh, SECItem *salt, int iteration); |
25 » » » int keyLengh, SECItem *salt, int iteration); | |
26 | 25 |
27 /* Get the initialization vector. The password is passed in, hashing | 26 /* Get the initialization vector. The password is passed in, hashing |
28 * is performed, and the initialization vector is returned. | 27 * is performed, and the initialization vector is returned. |
29 * algid is a pointer to a PBE algorithm ID | 28 * algid is a pointer to a PBE algorithm ID |
30 * pwitem is the password | 29 * pwitem is the password |
31 * If an error occurs or the algorithm id is not a PBE algrithm, | 30 * If an error occurs or the algorithm id is not a PBE algrithm, |
32 * NULL is returned. Otherwise, the iv is returned in a secitem. | 31 * NULL is returned. Otherwise, the iv is returned in a secitem. |
33 */ | 32 */ |
34 SECItem * | 33 SECItem *SEC_PKCS5GetIV(SECAlgorithmID *algid, SECItem *pwitem, |
35 SEC_PKCS5GetIV(SECAlgorithmID *algid, SECItem *pwitem, PRBool faulty3DES); | 34 PRBool faulty3DES); |
36 | 35 |
37 SECOidTag SEC_PKCS5GetCryptoAlgorithm(SECAlgorithmID *algid); | 36 SECOidTag SEC_PKCS5GetCryptoAlgorithm(SECAlgorithmID *algid); |
38 PRBool SEC_PKCS5IsAlgorithmPBEAlg(SECAlgorithmID *algid); | 37 PRBool SEC_PKCS5IsAlgorithmPBEAlg(SECAlgorithmID *algid); |
39 PRBool SEC_PKCS5IsAlgorithmPBEAlgTag(SECOidTag algTag); | 38 PRBool SEC_PKCS5IsAlgorithmPBEAlgTag(SECOidTag algTag); |
40 SECOidTag SEC_PKCS5GetPBEAlgorithm(SECOidTag algTag, int keyLen); | 39 SECOidTag SEC_PKCS5GetPBEAlgorithm(SECOidTag algTag, int keyLen); |
41 int SEC_PKCS5GetKeyLength(SECAlgorithmID *algid); | 40 int SEC_PKCS5GetKeyLength(SECAlgorithmID *algid); |
42 | 41 |
43 /********************************************************************** | 42 /********************************************************************** |
44 * Deprecated PBE functions. Use the PBE functions in pk11func.h | 43 * Deprecated PBE functions. Use the PBE functions in pk11func.h |
45 * instead. | 44 * instead. |
46 **********************************************************************/ | 45 **********************************************************************/ |
47 | 46 |
48 PBEBitGenContext * | 47 PBEBitGenContext *PBE_CreateContext(SECOidTag hashAlgorithm, |
49 PBE_CreateContext(SECOidTag hashAlgorithm, PBEBitGenID bitGenPurpose, | 48 PBEBitGenID bitGenPurpose, SECItem *pwitem, |
50 SECItem *pwitem, SECItem *salt, unsigned int bitsNeeded, | 49 SECItem *salt, unsigned int bitsNeeded, |
51 unsigned int iterations); | 50 unsigned int iterations); |
52 | 51 |
53 void | 52 void PBE_DestroyContext(PBEBitGenContext *context); |
54 PBE_DestroyContext(PBEBitGenContext *context); | |
55 | 53 |
56 | 54 SECItem *PBE_GenerateBits(PBEBitGenContext *context); |
57 SECItem * | |
58 PBE_GenerateBits(PBEBitGenContext *context); | |
59 | 55 |
60 SEC_END_PROTOS | 56 SEC_END_PROTOS |
61 | 57 |
62 #endif /* _SECPKS5_H_ */ | 58 #endif /* _SECPKS5_H_ */ |
OLD | NEW |