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