OLD | NEW |
1 | 1 |
2 /* This Source Code Form is subject to the terms of the Mozilla Public | 2 /* This Source Code Form is subject to the terms of the Mozilla Public |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 /* | 5 /* |
6 * This file PKCS #12 fuctions that should really be moved to the | 6 * This file PKCS #12 fuctions that should really be moved to the |
7 * PKCS #12 directory, however we can't do that in a point release | 7 * PKCS #12 directory, however we can't do that in a point release |
8 * because that will break binary compatibility, so we keep them here for now. | 8 * because that will break binary compatibility, so we keep them here for now. |
9 */ | 9 */ |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 /* These data structures should move to a common .h file shared between the | 24 /* These data structures should move to a common .h file shared between the |
25 * wrappers and the pkcs 12 code. */ | 25 * wrappers and the pkcs 12 code. */ |
26 | 26 |
27 /* | 27 /* |
28 ** RSA Raw Private Key structures | 28 ** RSA Raw Private Key structures |
29 */ | 29 */ |
30 | 30 |
31 /* member names from PKCS#1, section 7.2 */ | 31 /* member names from PKCS#1, section 7.2 */ |
32 struct SECKEYRSAPrivateKeyStr { | 32 struct SECKEYRSAPrivateKeyStr { |
33 PRArenaPool * arena; | 33 PLArenaPool * arena; |
34 SECItem version; | 34 SECItem version; |
35 SECItem modulus; | 35 SECItem modulus; |
36 SECItem publicExponent; | 36 SECItem publicExponent; |
37 SECItem privateExponent; | 37 SECItem privateExponent; |
38 SECItem prime1; | 38 SECItem prime1; |
39 SECItem prime2; | 39 SECItem prime2; |
40 SECItem exponent1; | 40 SECItem exponent1; |
41 SECItem exponent2; | 41 SECItem exponent2; |
42 SECItem coefficient; | 42 SECItem coefficient; |
43 }; | 43 }; |
44 typedef struct SECKEYRSAPrivateKeyStr SECKEYRSAPrivateKey; | 44 typedef struct SECKEYRSAPrivateKeyStr SECKEYRSAPrivateKey; |
45 | 45 |
46 | 46 |
47 /* | 47 /* |
48 ** DSA Raw Private Key structures | 48 ** DSA Raw Private Key structures |
49 */ | 49 */ |
50 | 50 |
51 struct SECKEYDSAPrivateKeyStr { | 51 struct SECKEYDSAPrivateKeyStr { |
52 SECKEYPQGParams params; | 52 SECKEYPQGParams params; |
53 SECItem privateValue; | 53 SECItem privateValue; |
54 }; | 54 }; |
55 typedef struct SECKEYDSAPrivateKeyStr SECKEYDSAPrivateKey; | 55 typedef struct SECKEYDSAPrivateKeyStr SECKEYDSAPrivateKey; |
56 | 56 |
57 /* | 57 /* |
58 ** Diffie-Hellman Raw Private Key structures | 58 ** Diffie-Hellman Raw Private Key structures |
59 ** Structure member names suggested by PKCS#3. | 59 ** Structure member names suggested by PKCS#3. |
60 */ | 60 */ |
61 struct SECKEYDHPrivateKeyStr { | 61 struct SECKEYDHPrivateKeyStr { |
62 PRArenaPool * arena; | 62 PLArenaPool * arena; |
63 SECItem prime; | 63 SECItem prime; |
64 SECItem base; | 64 SECItem base; |
65 SECItem privateValue; | 65 SECItem privateValue; |
66 }; | 66 }; |
67 typedef struct SECKEYDHPrivateKeyStr SECKEYDHPrivateKey; | 67 typedef struct SECKEYDHPrivateKeyStr SECKEYDHPrivateKey; |
68 | 68 |
69 /* | 69 /* |
70 ** raw private key object | 70 ** raw private key object |
71 */ | 71 */ |
72 struct SECKEYRawPrivateKeyStr { | 72 struct SECKEYRawPrivateKeyStr { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 nickname, publicValue, isPerm, isPrivate, keyUsage, NULL, wincx); | 210 nickname, publicValue, isPerm, isPrivate, keyUsage, NULL, wincx); |
211 } | 211 } |
212 | 212 |
213 SECStatus | 213 SECStatus |
214 PK11_ImportDERPrivateKeyInfoAndReturnKey(PK11SlotInfo *slot, SECItem *derPKI, | 214 PK11_ImportDERPrivateKeyInfoAndReturnKey(PK11SlotInfo *slot, SECItem *derPKI, |
215 SECItem *nickname, SECItem *publicValue, PRBool isPerm, | 215 SECItem *nickname, SECItem *publicValue, PRBool isPerm, |
216 PRBool isPrivate, unsigned int keyUsage, SECKEYPrivateKey** privk, | 216 PRBool isPrivate, unsigned int keyUsage, SECKEYPrivateKey** privk, |
217 void *wincx) | 217 void *wincx) |
218 { | 218 { |
219 SECKEYPrivateKeyInfo *pki = NULL; | 219 SECKEYPrivateKeyInfo *pki = NULL; |
220 PRArenaPool *temparena = NULL; | 220 PLArenaPool *temparena = NULL; |
221 SECStatus rv = SECFailure; | 221 SECStatus rv = SECFailure; |
222 | 222 |
223 temparena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); | 223 temparena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); |
224 if (!temparena) | 224 if (!temparena) |
225 return rv; | 225 return rv; |
226 pki = PORT_ArenaZNew(temparena, SECKEYPrivateKeyInfo); | 226 pki = PORT_ArenaZNew(temparena, SECKEYPrivateKeyInfo); |
227 if (!pki) { | 227 if (!pki) { |
228 PORT_FreeArena(temparena, PR_FALSE); | 228 PORT_FreeArena(temparena, PR_FALSE); |
229 return rv; | 229 return rv; |
230 } | 230 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 PK11_ImportPrivateKeyInfoAndReturnKey(PK11SlotInfo *slot, | 419 PK11_ImportPrivateKeyInfoAndReturnKey(PK11SlotInfo *slot, |
420 SECKEYPrivateKeyInfo *pki, SECItem *nickname, SECItem *publicValue, | 420 SECKEYPrivateKeyInfo *pki, SECItem *nickname, SECItem *publicValue, |
421 PRBool isPerm, PRBool isPrivate, unsigned int keyUsage, | 421 PRBool isPerm, PRBool isPrivate, unsigned int keyUsage, |
422 SECKEYPrivateKey **privk, void *wincx) | 422 SECKEYPrivateKey **privk, void *wincx) |
423 { | 423 { |
424 CK_KEY_TYPE keyType = CKK_RSA; | 424 CK_KEY_TYPE keyType = CKK_RSA; |
425 SECStatus rv = SECFailure; | 425 SECStatus rv = SECFailure; |
426 SECKEYRawPrivateKey *lpk = NULL; | 426 SECKEYRawPrivateKey *lpk = NULL; |
427 const SEC_ASN1Template *keyTemplate, *paramTemplate; | 427 const SEC_ASN1Template *keyTemplate, *paramTemplate; |
428 void *paramDest = NULL; | 428 void *paramDest = NULL; |
429 PRArenaPool *arena = NULL; | 429 PLArenaPool *arena = NULL; |
430 | 430 |
431 arena = PORT_NewArena(2048); | 431 arena = PORT_NewArena(2048); |
432 if(!arena) { | 432 if(!arena) { |
433 return SECFailure; | 433 return SECFailure; |
434 } | 434 } |
435 | 435 |
436 /* need to change this to use RSA/DSA keys */ | 436 /* need to change this to use RSA/DSA keys */ |
437 lpk = (SECKEYRawPrivateKey *)PORT_ArenaZAlloc(arena, | 437 lpk = (SECKEYRawPrivateKey *)PORT_ArenaZAlloc(arena, |
438 sizeof(SECKEYRawPrivateKey)); | 438 sizeof(SECKEYRawPrivateKey)); |
439 if(lpk == NULL) { | 439 if(lpk == NULL) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 SECStatus | 509 SECStatus |
510 PK11_ImportPrivateKeyInfo(PK11SlotInfo *slot, SECKEYPrivateKeyInfo *pki, | 510 PK11_ImportPrivateKeyInfo(PK11SlotInfo *slot, SECKEYPrivateKeyInfo *pki, |
511 SECItem *nickname, SECItem *publicValue, PRBool isPerm, | 511 SECItem *nickname, SECItem *publicValue, PRBool isPerm, |
512 PRBool isPrivate, unsigned int keyUsage, void *wincx) | 512 PRBool isPrivate, unsigned int keyUsage, void *wincx) |
513 { | 513 { |
514 return PK11_ImportPrivateKeyInfoAndReturnKey(slot, pki, nickname, | 514 return PK11_ImportPrivateKeyInfoAndReturnKey(slot, pki, nickname, |
515 publicValue, isPerm, isPrivate, keyUsage, NULL, wincx); | 515 publicValue, isPerm, isPrivate, keyUsage, NULL, wincx); |
516 | 516 |
517 } | 517 } |
518 | 518 |
OLD | NEW |