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

Side by Side Diff: net/base/keygen_handler_win.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 | « net/base/keygen_handler_unittest.cc ('k') | no next file » | 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 <windows.h> 7 #include <windows.h>
8 #include <wincrypt.h> 8 #include <wincrypt.h>
9 #pragma comment(lib, "crypt32.lib") 9 #pragma comment(lib, "crypt32.lib")
10 #include <rpc.h> 10 #include <rpc.h>
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 return true; 79 return true;
80 } 80 }
81 81
82 // Appends a DER IA5String containing |challenge| to |output|. 82 // Appends a DER IA5String containing |challenge| to |output|.
83 // Returns true if encoding was successful. 83 // Returns true if encoding was successful.
84 bool EncodeChallenge(const std::string& challenge, std::vector<BYTE>* output) { 84 bool EncodeChallenge(const std::string& challenge, std::vector<BYTE>* output) {
85 CERT_NAME_VALUE challenge_nv; 85 CERT_NAME_VALUE challenge_nv;
86 challenge_nv.dwValueType = CERT_RDN_IA5_STRING; 86 challenge_nv.dwValueType = CERT_RDN_IA5_STRING;
87 challenge_nv.Value.pbData = const_cast<BYTE*>( 87 challenge_nv.Value.pbData = const_cast<BYTE*>(
88 reinterpret_cast<const BYTE*>(challenge.c_str())); 88 reinterpret_cast<const BYTE*>(challenge.data()));
89 challenge_nv.Value.cbData = challenge.size(); 89 challenge_nv.Value.cbData = challenge.size();
90 90
91 return EncodeAndAppendType(X509_ANY_STRING, &challenge_nv, output); 91 return EncodeAndAppendType(X509_ANY_STRING, &challenge_nv, output);
92 } 92 }
93 93
94 // Appends a DER SubjectPublicKeyInfo structure for the signing key in |prov| 94 // Appends a DER SubjectPublicKeyInfo structure for the signing key in |prov|
95 // to |output|. 95 // to |output|.
96 // Returns true if encoding was successful. 96 // Returns true if encoding was successful.
97 bool EncodeSubjectPublicKeyInfo(HCRYPTPROV prov, std::vector<BYTE>* output) { 97 bool EncodeSubjectPublicKeyInfo(HCRYPTPROV prov, std::vector<BYTE>* output) {
98 BOOL ok; 98 BOOL ok;
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 // Fully destroys any of the keys that were created and releases prov. 359 // Fully destroys any of the keys that were created and releases prov.
360 CryptAcquireContext(&prov, new_key_id.c_str(), NULL, PROV_RSA_FULL, 360 CryptAcquireContext(&prov, new_key_id.c_str(), NULL, PROV_RSA_FULL,
361 CRYPT_SILENT | CRYPT_DELETEKEYSET); 361 CRYPT_SILENT | CRYPT_DELETEKEYSET);
362 } 362 }
363 } 363 }
364 364
365 return result; 365 return result;
366 } 366 }
367 367
368 } // namespace net 368 } // namespace net
OLDNEW
« no previous file with comments | « net/base/keygen_handler_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698