OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "net/cert/x509_certificate.h" | 15 #include "net/cert/x509_certificate.h" |
16 #include "net/ssl/ssl_client_cert_type.h" | |
17 | 16 |
18 namespace content { | 17 namespace content { |
19 class BrowserContext; | 18 class BrowserContext; |
20 } | 19 } |
21 | 20 |
22 namespace chromeos { | 21 namespace chromeos { |
23 | 22 |
24 namespace platform_keys { | 23 namespace platform_keys { |
25 | 24 |
26 // A token is a store for keys or certs and can provide cryptographic | 25 // A token is a store for keys or certs and can provide cryptographic |
(...skipping 13 matching lines...) Expand all Loading... |
40 HASH_ALGORITHM_SHA384, | 39 HASH_ALGORITHM_SHA384, |
41 HASH_ALGORITHM_SHA512 | 40 HASH_ALGORITHM_SHA512 |
42 }; | 41 }; |
43 | 42 |
44 struct ClientCertificateRequest { | 43 struct ClientCertificateRequest { |
45 ClientCertificateRequest(); | 44 ClientCertificateRequest(); |
46 ~ClientCertificateRequest(); | 45 ~ClientCertificateRequest(); |
47 | 46 |
48 // The list of the types of certificates requested, sorted in order of the | 47 // The list of the types of certificates requested, sorted in order of the |
49 // server's preference. | 48 // server's preference. |
50 std::vector<net::SSLClientCertType> certificate_key_types; | 49 std::vector<net::X509Certificate::PublicKeyType> certificate_key_types; |
51 | 50 |
52 // List of distinguished names of certificate authorities allowed by the | 51 // List of distinguished names of certificate authorities allowed by the |
53 // server. Each entry must be a DER-encoded X.509 DistinguishedName. | 52 // server. Each entry must be a DER-encoded X.509 DistinguishedName. |
54 std::vector<std::string> certificate_authorities; | 53 std::vector<std::string> certificate_authorities; |
55 }; | 54 }; |
56 | 55 |
57 namespace subtle { | 56 namespace subtle { |
58 // Functions of this namespace shouldn't be called directly from the context of | 57 // Functions of this namespace shouldn't be called directly from the context of |
59 // an extension. Instead use PlatformKeysService which enforces restrictions | 58 // an extension. Instead use PlatformKeysService which enforces restrictions |
60 // upon extensions. | 59 // upon extensions. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 content::BrowserContext* browser_context); | 97 content::BrowserContext* browser_context); |
99 | 98 |
100 // If the certificate request could be processed successfully, |matches| will | 99 // If the certificate request could be processed successfully, |matches| will |
101 // contain the list of matching certificates (which may be empty) and | 100 // contain the list of matching certificates (which may be empty) and |
102 // |error_message| will be empty. If an error occurred, |matches| will be null | 101 // |error_message| will be empty. If an error occurred, |matches| will be null |
103 // and |error_message| contain an error message. | 102 // and |error_message| contain an error message. |
104 typedef base::Callback<void(scoped_ptr<net::CertificateList> matches, | 103 typedef base::Callback<void(scoped_ptr<net::CertificateList> matches, |
105 const std::string& error_message)> | 104 const std::string& error_message)> |
106 SelectCertificatesCallback; | 105 SelectCertificatesCallback; |
107 | 106 |
108 // Returns the list of all certificates that match |request|. |callback| will be | 107 // Returns the list of all certificates that were issued by one of the |
109 // invoked with these matches or an error message. | 108 // |certificate_authorities|. If |certificate_authorities| is empty, all |
110 void SelectClientCertificates(const ClientCertificateRequest& request, | 109 // certificates will be returned. |callback| will be invoked with the matches or |
111 const SelectCertificatesCallback& callback, | 110 // an error message. |
112 content::BrowserContext* browser_context); | 111 void SelectClientCertificates( |
| 112 const std::vector<std::string>& certificate_authorities, |
| 113 const SelectCertificatesCallback& callback, |
| 114 content::BrowserContext* browser_context); |
113 | 115 |
114 } // namespace subtle | 116 } // namespace subtle |
115 | 117 |
116 // Returns the DER encoding of the X.509 Subject Public Key Info of the public | 118 // Returns the DER encoding of the X.509 Subject Public Key Info of the public |
117 // key in |certificate|. | 119 // key in |certificate|. |
118 std::string GetSubjectPublicKeyInfo( | 120 std::string GetSubjectPublicKeyInfo( |
119 const scoped_refptr<net::X509Certificate>& certificate); | 121 const scoped_refptr<net::X509Certificate>& certificate); |
120 | 122 |
121 // Obtains information about the public key in |certificate|. | 123 // Obtains information about the public key in |certificate|. |
122 // If |certificate| contains an RSA key, sets |key_size_bits| to the modulus | 124 // If |certificate| contains an RSA key, sets |key_size_bits| to the modulus |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // of available tokens is determined, possibly with an error message. | 187 // of available tokens is determined, possibly with an error message. |
186 // Must be called and calls |callback| on the UI thread. | 188 // Must be called and calls |callback| on the UI thread. |
187 void GetTokens(const GetTokensCallback& callback, | 189 void GetTokens(const GetTokensCallback& callback, |
188 content::BrowserContext* browser_context); | 190 content::BrowserContext* browser_context); |
189 | 191 |
190 } // namespace platform_keys | 192 } // namespace platform_keys |
191 | 193 |
192 } // namespace chromeos | 194 } // namespace chromeos |
193 | 195 |
194 #endif // CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_H_ | 196 #endif // CHROME_BROWSER_CHROMEOS_PLATFORM_KEYS_PLATFORM_KEYS_H_ |
OLD | NEW |