OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_CERTIFICATE_PROVIDER_CERTIFICATE_PROVIDER_SERVIC
E_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CERTIFICATE_PROVIDER_CERTIFICATE_PROVIDER_SERVIC
E_H_ |
6 #define CHROME_BROWSER_CHROMEOS_CERTIFICATE_PROVIDER_CERTIFICATE_PROVIDER_SERVIC
E_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CERTIFICATE_PROVIDER_CERTIFICATE_PROVIDER_SERVIC
E_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // id) is unambiguous. | 120 // id) is unambiguous. |
121 // If the signature could be calculated by the extension, |signature| is | 121 // If the signature could be calculated by the extension, |signature| is |
122 // provided in the reply and should be the signature of the digest sent in the | 122 // provided in the reply and should be the signature of the digest sent in the |
123 // sign request. Otherwise, in case of a failure, |signature| must be empty. | 123 // sign request. Otherwise, in case of a failure, |signature| must be empty. |
124 // The call is ignored if |sign_request_id| is not referring to a pending | 124 // The call is ignored if |sign_request_id| is not referring to a pending |
125 // request. | 125 // request. |
126 void ReplyToSignRequest(const std::string& extension_id, | 126 void ReplyToSignRequest(const std::string& extension_id, |
127 int sign_request_id, | 127 int sign_request_id, |
128 const std::vector<uint8_t>& signature); | 128 const std::vector<uint8_t>& signature); |
129 | 129 |
| 130 // Returns whether this certificate was provided by any extension during the |
| 131 // lifetime of this service. If this certificate is currently provided by an |
| 132 // extension, sets |is_currently_provided| to true and |extension_id| to that |
| 133 // extension's id. If this certificate was provided before but not anymore, |
| 134 // |is_currently_provided| will be set to false and |extension_id| will not be |
| 135 // modified. |
| 136 bool LookUpCertificate(const net::X509Certificate& cert, |
| 137 bool* is_currently_provided, |
| 138 std::string* extension_id); |
| 139 |
130 // Returns a CertificateProvider that always returns the latest list of | 140 // Returns a CertificateProvider that always returns the latest list of |
131 // certificates that are provided by all registered extensions. Therefore, it | 141 // certificates that are provided by all registered extensions. Therefore, it |
132 // is sufficient to create the CertificateProvider once and then repeatedly | 142 // is sufficient to create the CertificateProvider once and then repeatedly |
133 // call its |GetCertificates()|. The returned provider is valid even after the | 143 // call its |GetCertificates()|. The returned provider is valid even after the |
134 // destruction of this service. | 144 // destruction of this service. |
135 // The returned provider can be used on any thread. | 145 // The returned provider can be used on any thread. |
136 scoped_ptr<CertificateProvider> CreateCertificateProvider(); | 146 scoped_ptr<CertificateProvider> CreateCertificateProvider(); |
137 | 147 |
138 // Must be called if extension with id |extension_id| is unloaded and cannot | 148 // Must be called if extension with id |extension_id| is unloaded and cannot |
139 // serve certificates anymore. This should be called everytime the | 149 // serve certificates anymore. This should be called everytime the |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // An instance of net::ClientKeyStore::CertKeyProvider that is registered at | 190 // An instance of net::ClientKeyStore::CertKeyProvider that is registered at |
181 // the net::ClientKeyStore singleton. | 191 // the net::ClientKeyStore singleton. |
182 scoped_ptr<CertKeyProviderImpl> cert_key_provider_; | 192 scoped_ptr<CertKeyProviderImpl> cert_key_provider_; |
183 | 193 |
184 // State about all pending sign requests. | 194 // State about all pending sign requests. |
185 certificate_provider::SignRequests sign_requests_; | 195 certificate_provider::SignRequests sign_requests_; |
186 | 196 |
187 // Contains all pending certificate requests. | 197 // Contains all pending certificate requests. |
188 certificate_provider::CertificateRequests certificate_requests_; | 198 certificate_provider::CertificateRequests certificate_requests_; |
189 | 199 |
190 // Contains all certificates that the extensions returned in response to the | 200 // Contains all certificates that the extensions returned during the lifetime |
191 // most recent certificate request. | 201 // of this service. Each certificate is associated with the extension that |
| 202 // reported the certificate in response to the most recent certificate |
| 203 // request. If a certificate was reported previously but in the most recent |
| 204 // responses, it is still cached but not loses it's association with any |
| 205 // extension. This ensures that a certificate can't magically appear as |
| 206 // platform certificate (e.g. in the client certificate selection dialog) |
| 207 // after an extension doesn't report it anymore. |
192 certificate_provider::ThreadSafeCertificateMap certificate_map_; | 208 certificate_provider::ThreadSafeCertificateMap certificate_map_; |
193 | 209 |
194 base::ThreadChecker thread_checker_; | 210 base::ThreadChecker thread_checker_; |
195 base::WeakPtrFactory<CertificateProviderService> weak_factory_; | 211 base::WeakPtrFactory<CertificateProviderService> weak_factory_; |
196 | 212 |
197 DISALLOW_COPY_AND_ASSIGN(CertificateProviderService); | 213 DISALLOW_COPY_AND_ASSIGN(CertificateProviderService); |
198 }; | 214 }; |
199 | 215 |
200 } // namespace chromeos | 216 } // namespace chromeos |
201 | 217 |
202 #endif // CHROME_BROWSER_CHROMEOS_CERTIFICATE_PROVIDER_CERTIFICATE_PROVIDER_SER
VICE_H_ | 218 #endif // CHROME_BROWSER_CHROMEOS_CERTIFICATE_PROVIDER_CERTIFICATE_PROVIDER_SER
VICE_H_ |
OLD | NEW |