Chromium Code Reviews| 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 * This file contains functions to manage asymetric keys, (public and | 5 * This file contains functions to manage asymetric keys, (public and |
| 6 * private keys). | 6 * private keys). |
| 7 */ | 7 */ |
| 8 #include "seccomon.h" | 8 #include "seccomon.h" |
| 9 #include "secmod.h" | 9 #include "secmod.h" |
| 10 #include "secmodi.h" | 10 #include "secmodi.h" |
| (...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1696 if(key != NULL) { | 1696 if(key != NULL) { |
| 1697 PK11_FreeSymKey(key); | 1697 PK11_FreeSymKey(key); |
| 1698 } | 1698 } |
| 1699 | 1699 |
| 1700 return rv; | 1700 return rv; |
| 1701 } | 1701 } |
| 1702 | 1702 |
| 1703 SECKEYPrivateKeyInfo * | 1703 SECKEYPrivateKeyInfo * |
| 1704 PK11_ExportPrivateKeyInfo(CERTCertificate *cert, void *wincx) | 1704 PK11_ExportPrivateKeyInfo(CERTCertificate *cert, void *wincx) |
| 1705 { | 1705 { |
| 1706 return NULL; | 1706 SECKEYPrivateKeyInfo *pki = NULL; |
| 1707 SECKEYPrivateKey *pk = PK11_FindKeyByAnyCert(cert, wincx); | |
| 1708 if (pk != NULL) { | |
| 1709 » pki = PK11_ExportPrivKeyInfo(pk, wincx); | |
|
eroman
2014/03/20 00:12:04
FYI this looks like it is mixing tabs and spaces.
wtc
2014/03/22 01:08:00
You're right. Unfortunately in several directories
| |
| 1710 » SECKEY_DestroyPrivateKey(pk); | |
| 1711 } | |
| 1712 return pki; | |
| 1707 } | 1713 } |
| 1708 | 1714 |
| 1709 SECKEYEncryptedPrivateKeyInfo * | 1715 SECKEYEncryptedPrivateKeyInfo * |
| 1710 PK11_ExportEncryptedPrivKeyInfo( | 1716 PK11_ExportEncryptedPrivKeyInfo( |
| 1711 PK11SlotInfo *slot, /* optional, encrypt key in this slot */ | 1717 PK11SlotInfo *slot, /* optional, encrypt key in this slot */ |
| 1712 SECOidTag algTag, /* encrypt key with this algorithm */ | 1718 SECOidTag algTag, /* encrypt key with this algorithm */ |
| 1713 SECItem *pwitem, /* password for PBE encryption */ | 1719 SECItem *pwitem, /* password for PBE encryption */ |
| 1714 SECKEYPrivateKey *pk, /* encrypt this private key */ | 1720 SECKEYPrivateKey *pk, /* encrypt this private key */ |
| 1715 int iteration, /* interations for PBE alg */ | 1721 int iteration, /* interations for PBE alg */ |
| 1716 void *wincx) /* context for password callback ? */ | 1722 void *wincx) /* context for password callback ? */ |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2368 for (i=0; i < objCount ; i++) { | 2374 for (i=0; i < objCount ; i++) { |
| 2369 SECKEYPrivateKey *privKey = | 2375 SECKEYPrivateKey *privKey = |
| 2370 PK11_MakePrivKey(slot,nullKey,PR_TRUE,key_ids[i],wincx); | 2376 PK11_MakePrivKey(slot,nullKey,PR_TRUE,key_ids[i],wincx); |
| 2371 SECKEY_AddPrivateKeyToListTail(keys, privKey); | 2377 SECKEY_AddPrivateKeyToListTail(keys, privKey); |
| 2372 } | 2378 } |
| 2373 | 2379 |
| 2374 PORT_Free(key_ids); | 2380 PORT_Free(key_ids); |
| 2375 return keys; | 2381 return keys; |
| 2376 } | 2382 } |
| 2377 | 2383 |
| OLD | NEW |