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

Side by Side Diff: net/base/keygen_handler_nss.cc

Issue 1535016: We should also delete the underlying persistent public key... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Make albertb's suggested changes. Created 10 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/base/keygen_handler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/keygen_handler.h" 5 #include "net/base/keygen_handler.h"
6 6
7 #include <pk11pub.h> 7 #include <pk11pub.h>
8 #include <secmod.h> 8 #include <secmod.h>
9 #include <ssl.h> 9 #include <ssl.h>
10 #include <secder.h> // DER_Encode() 10 #include <secder.h> // DER_Encode()
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 if (privateKey) { 222 if (privateKey) {
223 // On successful keygen we need to keep the private key, of course, 223 // On successful keygen we need to keep the private key, of course,
224 // or we won't be able to use the client certificate. 224 // or we won't be able to use the client certificate.
225 if (!isSuccess || !stores_key_) { 225 if (!isSuccess || !stores_key_) {
226 PK11_DestroyTokenObject(privateKey->pkcs11Slot, privateKey->pkcs11ID); 226 PK11_DestroyTokenObject(privateKey->pkcs11Slot, privateKey->pkcs11ID);
227 } 227 }
228 SECKEY_DestroyPrivateKey(privateKey); 228 SECKEY_DestroyPrivateKey(privateKey);
229 } 229 }
230 230
231 if (publicKey) { 231 if (publicKey) {
232 PK11_DestroyTokenObject(publicKey->pkcs11Slot, publicKey->pkcs11ID); 232 if (!isSuccess || !stores_key_) {
233 PK11_DestroyTokenObject(publicKey->pkcs11Slot, publicKey->pkcs11ID);
234 }
235 SECKEY_DestroyPublicKey(publicKey);
233 } 236 }
234 if (spkInfo) { 237 if (spkInfo) {
235 SECKEY_DestroySubjectPublicKeyInfo(spkInfo); 238 SECKEY_DestroySubjectPublicKeyInfo(spkInfo);
236 } 239 }
237 if (publicKey) {
238 SECKEY_DestroyPublicKey(publicKey);
239 }
240 if (arena) { 240 if (arena) {
241 PORT_FreeArena(arena, PR_TRUE); 241 PORT_FreeArena(arena, PR_TRUE);
242 } 242 }
243 if (slot != NULL) { 243 if (slot != NULL) {
244 PK11_FreeSlot(slot); 244 PK11_FreeSlot(slot);
245 } 245 }
246 if (pkac.challenge.data) { 246 if (pkac.challenge.data) {
247 free(pkac.challenge.data); 247 free(pkac.challenge.data);
248 } 248 }
249 249
250 return (isSuccess ? result_blob : std::string()); 250 return (isSuccess ? result_blob : std::string());
251 } 251 }
252 252
253 } // namespace net 253 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/base/keygen_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698