OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef NET_SSL_SSL_PLATFORM_KEY_WIN_H_ | 5 #ifndef NET_SSL_SSL_PLATFORM_KEY_WIN_H_ |
6 #define NET_SSL_SSL_PLATFORM_KEY_WIN_H_ | 6 #define NET_SSL_SSL_PLATFORM_KEY_WIN_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 // Must be after windows.h. | 10 // Must be after windows.h. |
11 #include <NCrypt.h> | 11 #include <NCrypt.h> |
12 | 12 |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "crypto/wincrypt_shim.h" | 14 #include "crypto/wincrypt_shim.h" |
15 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 class SSLPrivateKey; | 19 class SSLPrivateKey; |
20 class X509Certificate; | 20 class X509Certificate; |
21 | 21 |
| 22 // Returns an SSLPrivateKey backed by the platform private key for |
| 23 // |cert_context| which must correspond to |certificate|. |
| 24 scoped_refptr<SSLPrivateKey> FetchClientCertPrivateKey( |
| 25 const X509Certificate* certificate, |
| 26 PCCERT_CONTEXT cert_context); |
| 27 |
22 // Returns an SSLPrivateKey backed by |prov| and |key_spec|, which must | 28 // Returns an SSLPrivateKey backed by |prov| and |key_spec|, which must |
23 // correspond to |certificate|'s public key. Takes ownership of |prov|. | 29 // correspond to |certificate|'s public key. Takes ownership of |prov|. |
24 NET_EXPORT_PRIVATE scoped_refptr<SSLPrivateKey> WrapCAPIPrivateKey( | 30 NET_EXPORT_PRIVATE scoped_refptr<SSLPrivateKey> WrapCAPIPrivateKey( |
25 const X509Certificate* certificate, | 31 const X509Certificate* certificate, |
26 HCRYPTPROV prov, | 32 HCRYPTPROV prov, |
27 DWORD key_spec); | 33 DWORD key_spec); |
28 | 34 |
29 // Returns an SSLPrivateKey backed by |key|, which must correspond to | 35 // Returns an SSLPrivateKey backed by |key|, which must correspond to |
30 // |certificate|'s public key, or nullptr on error. Takes ownership of |key| in | 36 // |certificate|'s public key, or nullptr on error. Takes ownership of |key| in |
31 // both cases. | 37 // both cases. |
32 NET_EXPORT_PRIVATE scoped_refptr<SSLPrivateKey> WrapCNGPrivateKey( | 38 NET_EXPORT_PRIVATE scoped_refptr<SSLPrivateKey> WrapCNGPrivateKey( |
33 const X509Certificate* certificate, | 39 const X509Certificate* certificate, |
34 NCRYPT_KEY_HANDLE key); | 40 NCRYPT_KEY_HANDLE key); |
35 | 41 |
36 } // namespace net | 42 } // namespace net |
37 | 43 |
38 #endif // NET_SSL_SSL_PLATFORM_KEY_WIN_H_ | 44 #endif // NET_SSL_SSL_PLATFORM_KEY_WIN_H_ |
OLD | NEW |