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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 */ | 70 */ |
71 NSSPKCS5PBEParameter * | 71 NSSPKCS5PBEParameter * |
72 nsspkcs5_AlgidToParam(SECAlgorithmID *algid); | 72 nsspkcs5_AlgidToParam(SECAlgorithmID *algid); |
73 | 73 |
74 /* | 74 /* |
75 * Convert an Algorithm ID to a PBE Param. | 75 * Convert an Algorithm ID to a PBE Param. |
76 * NOTE: this does not suppport PKCS 5 v2 because it's only used for the | 76 * NOTE: this does not suppport PKCS 5 v2 because it's only used for the |
77 * keyDB which only support PKCS 5 v1, PFX, and PKCS 12. | 77 * keyDB which only support PKCS 5 v1, PFX, and PKCS 12. |
78 */ | 78 */ |
79 NSSPKCS5PBEParameter * | 79 NSSPKCS5PBEParameter * |
80 nsspkcs5_NewParam(SECOidTag alg, SECItem *salt, int iterator); | 80 nsspkcs5_NewParam(SECOidTag alg, HASH_HashType hashType, SECItem *salt, |
| 81 int iterationCount); |
81 | 82 |
82 | 83 |
83 /* Encrypt/Decrypt data using password based encryption. | 84 /* Encrypt/Decrypt data using password based encryption. |
84 * algid is the PBE algorithm identifier, | 85 * algid is the PBE algorithm identifier, |
85 * pwitem is the password, | 86 * pwitem is the password, |
86 * src is the source for encryption/decryption, | 87 * src is the source for encryption/decryption, |
87 * encrypt is PR_TRUE for encryption, PR_FALSE for decryption. | 88 * encrypt is PR_TRUE for encryption, PR_FALSE for decryption. |
88 * The key and iv are generated based upon PKCS #5 then the src | 89 * The key and iv are generated based upon PKCS #5 then the src |
89 * is either encrypted or decrypted. If an error occurs, NULL | 90 * is either encrypted or decrypted. If an error occurs, NULL |
90 * is returned, otherwise the ciphered contents is returned. | 91 * is returned, otherwise the ciphered contents is returned. |
91 */ | 92 */ |
92 extern SECItem * | 93 extern SECItem * |
93 nsspkcs5_CipherData(NSSPKCS5PBEParameter *, SECItem *pwitem, | 94 nsspkcs5_CipherData(NSSPKCS5PBEParameter *, SECItem *pwitem, |
94 SECItem *src, PRBool encrypt, PRBool *update); | 95 SECItem *src, PRBool encrypt, PRBool *update); |
95 | 96 |
96 extern SECItem * | 97 extern SECItem * |
97 nsspkcs5_ComputeKeyAndIV(NSSPKCS5PBEParameter *, SECItem *pwitem, | 98 nsspkcs5_ComputeKeyAndIV(NSSPKCS5PBEParameter *, SECItem *pwitem, |
98 SECItem *iv, PRBool faulty3DES); | 99 SECItem *iv, PRBool faulty3DES); |
99 | 100 |
100 /* Destroys PBE parameter */ | 101 /* Destroys PBE parameter */ |
101 extern void | 102 extern void |
102 nsspkcs5_DestroyPBEParameter(NSSPKCS5PBEParameter *param); | 103 nsspkcs5_DestroyPBEParameter(NSSPKCS5PBEParameter *param); |
103 | 104 |
104 HASH_HashType HASH_FromHMACOid(SECOidTag oid); | 105 HASH_HashType HASH_FromHMACOid(SECOidTag oid); |
105 | 106 |
106 SEC_END_PROTOS | 107 SEC_END_PROTOS |
107 | 108 |
108 #endif | 109 #endif |
OLD | NEW |