Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: nss/lib/softoken/lowpbe.h

Issue 2078763002: Delete bundled copy of NSS and replace with README. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss@master
Patch Set: Delete bundled copy of NSS and replace with README. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « nss/lib/softoken/lowkeyti.h ('k') | nss/lib/softoken/lowpbe.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #ifndef _SECPKCS5_H_
6 #define _SECPKCS5_H_
7
8 #include "plarena.h"
9 #include "secitem.h"
10 #include "seccomon.h"
11 #include "secoidt.h"
12 #include "hasht.h"
13
14 typedef SECItem * (* SEC_PKCS5GetPBEPassword)(void *arg);
15
16 /* used for V2 PKCS 12 Draft Spec */
17 typedef enum {
18 pbeBitGenIDNull = 0,
19 pbeBitGenCipherKey = 0x01,
20 pbeBitGenCipherIV = 0x02,
21 pbeBitGenIntegrityKey = 0x03
22 } PBEBitGenID;
23
24 typedef enum {
25 NSSPKCS5_PBKDF1 = 0,
26 NSSPKCS5_PBKDF2 = 1,
27 NSSPKCS5_PKCS12_V2 = 2
28 } NSSPKCS5PBEType;
29
30 typedef struct NSSPKCS5PBEParameterStr NSSPKCS5PBEParameter;
31
32 struct NSSPKCS5PBEParameterStr {
33 PLArenaPool *poolp;
34 SECItem salt; /* octet string */
35 SECItem iteration; /* integer */
36 SECItem keyLength; /* integer */
37
38 /* used locally */
39 int iter;
40 int keyLen;
41 int ivLen;
42 unsigned char *ivData;
43 HASH_HashType hashType;
44 NSSPKCS5PBEType pbeType;
45 SECAlgorithmID prfAlg;
46 PBEBitGenID keyID;
47 SECOidTag encAlg;
48 PRBool is2KeyDES;
49 };
50
51
52 SEC_BEGIN_PROTOS
53 /* Create a PKCS5 Algorithm ID
54 * The algorithm ID is set up using the PKCS #5 parameter structure
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
57 * algorithm id.
58 * If an error occurs or the algorithm specified is not supported
59 * or is not a password based encryption algorithm, NULL is returned.
60 * Otherwise, a pointer to the algorithm id is returned.
61 */
62 extern SECAlgorithmID *
63 nsspkcs5_CreateAlgorithmID(PLArenaPool *arena, SECOidTag algorithm,
64 NSSPKCS5PBEParameter *pbe);
65
66 /*
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
69 * keyDB which only support PKCS 5 v1, PFX, and PKCS 12.
70 */
71 NSSPKCS5PBEParameter *
72 nsspkcs5_AlgidToParam(SECAlgorithmID *algid);
73
74 /*
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
77 * keyDB which only support PKCS 5 v1, PFX, and PKCS 12.
78 */
79 NSSPKCS5PBEParameter *
80 nsspkcs5_NewParam(SECOidTag alg, HASH_HashType hashType, SECItem *salt,
81 int iterationCount);
82
83
84 /* Encrypt/Decrypt data using password based encryption.
85 * algid is the PBE algorithm identifier,
86 * pwitem is the password,
87 * src is the source for encryption/decryption,
88 * encrypt is PR_TRUE for encryption, PR_FALSE for decryption.
89 * The key and iv are generated based upon PKCS #5 then the src
90 * is either encrypted or decrypted. If an error occurs, NULL
91 * is returned, otherwise the ciphered contents is returned.
92 */
93 extern SECItem *
94 nsspkcs5_CipherData(NSSPKCS5PBEParameter *, SECItem *pwitem,
95 SECItem *src, PRBool encrypt, PRBool *update);
96
97 extern SECItem *
98 nsspkcs5_ComputeKeyAndIV(NSSPKCS5PBEParameter *, SECItem *pwitem,
99 SECItem *iv, PRBool faulty3DES);
100
101 /* Destroys PBE parameter */
102 extern void
103 nsspkcs5_DestroyPBEParameter(NSSPKCS5PBEParameter *param);
104
105 HASH_HashType HASH_FromHMACOid(SECOidTag oid);
106
107 SEC_END_PROTOS
108
109 #endif
OLDNEW
« no previous file with comments | « nss/lib/softoken/lowkeyti.h ('k') | nss/lib/softoken/lowpbe.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698