| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <rpc.h> | 8 #include <rpc.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/base64.h" | 14 #include "base/base64.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/strings/string_piece.h" | 16 #include "base/strings/string_piece.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "crypto/capi_util.h" | 19 #include "crypto/capi_util.h" |
| 20 #include "crypto/scoped_capi_types.h" | 20 #include "crypto/scoped_capi_types.h" |
| 21 #include "crypto/wincrypt_shim.h" | 21 #include "crypto/wincrypt_shim.h" |
| 22 | 22 |
| 23 #pragma comment(lib, "crypt32.lib") | |
| 24 #pragma comment(lib, "rpcrt4.lib") | |
| 25 | |
| 26 namespace net { | 23 namespace net { |
| 27 | 24 |
| 28 // Assigns the contents of a CERT_PUBLIC_KEY_INFO structure for the signing | 25 // Assigns the contents of a CERT_PUBLIC_KEY_INFO structure for the signing |
| 29 // key in |prov| to |output|. Returns true if encoding was successful. | 26 // key in |prov| to |output|. Returns true if encoding was successful. |
| 30 bool GetSubjectPublicKeyInfo(HCRYPTPROV prov, std::vector<BYTE>* output) { | 27 bool GetSubjectPublicKeyInfo(HCRYPTPROV prov, std::vector<BYTE>* output) { |
| 31 BOOL ok; | 28 BOOL ok; |
| 32 DWORD size = 0; | 29 DWORD size = 0; |
| 33 | 30 |
| 34 // From the private key stored in HCRYPTPROV, obtain the public key, stored | 31 // From the private key stored in HCRYPTPROV, obtain the public key, stored |
| 35 // as a CERT_PUBLIC_KEY_INFO structure. Currently, only RSA public keys are | 32 // as a CERT_PUBLIC_KEY_INFO structure. Currently, only RSA public keys are |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 209 |
| 213 std::string result; | 210 std::string result; |
| 214 base::Base64Encode(spkac, &result); | 211 base::Base64Encode(spkac, &result); |
| 215 | 212 |
| 216 VLOG(1) << "Keygen succeeded"; | 213 VLOG(1) << "Keygen succeeded"; |
| 217 return result; | 214 return result; |
| 218 } | 215 } |
| 219 } | 216 } |
| 220 | 217 |
| 221 } // namespace net | 218 } // namespace net |
| OLD | NEW |