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 | 4 |
5 #ifndef _SECPKCS5_H_ | 5 #ifndef _SECPKCS5_H_ |
6 #define _SECPKCS5_H_ | 6 #define _SECPKCS5_H_ |
7 | 7 |
8 #include "plarena.h" | 8 #include "plarena.h" |
9 #include "secitem.h" | 9 #include "secitem.h" |
10 #include "seccomon.h" | 10 #include "seccomon.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 typedef enum { | 24 typedef enum { |
25 NSSPKCS5_PBKDF1 = 0, | 25 NSSPKCS5_PBKDF1 = 0, |
26 NSSPKCS5_PBKDF2 = 1, | 26 NSSPKCS5_PBKDF2 = 1, |
27 NSSPKCS5_PKCS12_V2 = 2 | 27 NSSPKCS5_PKCS12_V2 = 2 |
28 } NSSPKCS5PBEType; | 28 } NSSPKCS5PBEType; |
29 | 29 |
30 typedef struct NSSPKCS5PBEParameterStr NSSPKCS5PBEParameter; | 30 typedef struct NSSPKCS5PBEParameterStr NSSPKCS5PBEParameter; |
31 | 31 |
32 struct NSSPKCS5PBEParameterStr { | 32 struct NSSPKCS5PBEParameterStr { |
33 PRArenaPool *poolp; | 33 PLArenaPool *poolp; |
34 SECItem salt; /* octet string */ | 34 SECItem salt; /* octet string */ |
35 SECItem iteration; /* integer */ | 35 SECItem iteration; /* integer */ |
36 SECItem keyLength; /* integer */ | 36 SECItem keyLength; /* integer */ |
37 | 37 |
38 /* used locally */ | 38 /* used locally */ |
39 int iter; | 39 int iter; |
40 int keyLen; | 40 int keyLen; |
41 int ivLen; | 41 int ivLen; |
42 unsigned char *ivData; | 42 unsigned char *ivData; |
43 HASH_HashType hashType; | 43 HASH_HashType hashType; |
44 NSSPKCS5PBEType pbeType; | 44 NSSPKCS5PBEType pbeType; |
45 SECAlgorithmID prfAlg; | 45 SECAlgorithmID prfAlg; |
46 PBEBitGenID keyID; | 46 PBEBitGenID keyID; |
47 SECOidTag encAlg; | 47 SECOidTag encAlg; |
48 PRBool is2KeyDES; | 48 PRBool is2KeyDES; |
49 }; | 49 }; |
50 | 50 |
51 | 51 |
52 SEC_BEGIN_PROTOS | 52 SEC_BEGIN_PROTOS |
53 /* Create a PKCS5 Algorithm ID | 53 /* Create a PKCS5 Algorithm ID |
54 * The algorithm ID is set up using the PKCS #5 parameter structure | 54 * The algorithm ID is set up using the PKCS #5 parameter structure |
55 * algorithm is the PBE algorithm ID for the desired algorithm | 55 * algorithm is the PBE algorithm ID for the desired algorithm |
56 * pbe is a pbe param block with all the info needed to create the | 56 * pbe is a pbe param block with all the info needed to create the |
57 * algorithm id. | 57 * algorithm id. |
58 * If an error occurs or the algorithm specified is not supported | 58 * If an error occurs or the algorithm specified is not supported |
59 * or is not a password based encryption algorithm, NULL is returned. | 59 * or is not a password based encryption algorithm, NULL is returned. |
60 * Otherwise, a pointer to the algorithm id is returned. | 60 * Otherwise, a pointer to the algorithm id is returned. |
61 */ | 61 */ |
62 extern SECAlgorithmID * | 62 extern SECAlgorithmID * |
63 nsspkcs5_CreateAlgorithmID(PRArenaPool *arena, SECOidTag algorithm, | 63 nsspkcs5_CreateAlgorithmID(PLArenaPool *arena, SECOidTag algorithm, |
64 NSSPKCS5PBEParameter *pbe); | 64 NSSPKCS5PBEParameter *pbe); |
65 | 65 |
66 /* | 66 /* |
67 * Convert an Algorithm ID to a PBE Param. | 67 * Convert an Algorithm ID to a PBE Param. |
68 * NOTE: this does not suppport PKCS 5 v2 because it's only used for the | 68 * NOTE: this does not suppport PKCS 5 v2 because it's only used for the |
69 * keyDB which only support PKCS 5 v1, PFX, and PKCS 12. | 69 * keyDB which only support PKCS 5 v1, PFX, and PKCS 12. |
70 */ | 70 */ |
71 NSSPKCS5PBEParameter * | 71 NSSPKCS5PBEParameter * |
72 nsspkcs5_AlgidToParam(SECAlgorithmID *algid); | 72 nsspkcs5_AlgidToParam(SECAlgorithmID *algid); |
73 | 73 |
(...skipping 25 matching lines...) Expand all Loading... |
99 | 99 |
100 /* Destroys PBE parameter */ | 100 /* Destroys PBE parameter */ |
101 extern void | 101 extern void |
102 nsspkcs5_DestroyPBEParameter(NSSPKCS5PBEParameter *param); | 102 nsspkcs5_DestroyPBEParameter(NSSPKCS5PBEParameter *param); |
103 | 103 |
104 HASH_HashType HASH_FromHMACOid(SECOidTag oid); | 104 HASH_HashType HASH_FromHMACOid(SECOidTag oid); |
105 | 105 |
106 SEC_END_PROTOS | 106 SEC_END_PROTOS |
107 | 107 |
108 #endif | 108 #endif |
OLD | NEW |