OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SERVER_BOUND_CERT_SERVICE_H_ | 5 #ifndef NET_SSL_SERVER_BOUND_CERT_SERVICE_H_ |
6 #define NET_SSL_SERVER_BOUND_CERT_SERVICE_H_ | 6 #define NET_SSL_SERVER_BOUND_CERT_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 11 matching lines...) Expand all Loading... |
22 namespace base { | 22 namespace base { |
23 class TaskRunner; | 23 class TaskRunner; |
24 } | 24 } |
25 | 25 |
26 namespace net { | 26 namespace net { |
27 | 27 |
28 class ServerBoundCertServiceJob; | 28 class ServerBoundCertServiceJob; |
29 class ServerBoundCertServiceRequest; | 29 class ServerBoundCertServiceRequest; |
30 class ServerBoundCertServiceWorker; | 30 class ServerBoundCertServiceWorker; |
31 | 31 |
32 // A class for creating and fetching server bound certs. | 32 // A class for creating and fetching server bound certs. These certs are used |
| 33 // to identify users' machines; their public keys are used as channel IDs in |
| 34 // http://tools.ietf.org/html/draft-balfanz-tls-channelid-00. |
| 35 // As a result although certs are set to be invalid after one year, we don't |
| 36 // actually expire them. Once generated, certs are valid as long as the users |
| 37 // want. Users can delete existing certs, and new certs will be generated |
| 38 // automatically. |
| 39 |
33 // Inherits from NonThreadSafe in order to use the function | 40 // Inherits from NonThreadSafe in order to use the function |
34 // |CalledOnValidThread|. | 41 // |CalledOnValidThread|. |
35 class NET_EXPORT ServerBoundCertService | 42 class NET_EXPORT ServerBoundCertService |
36 : NON_EXPORTED_BASE(public base::NonThreadSafe) { | 43 : NON_EXPORTED_BASE(public base::NonThreadSafe) { |
37 public: | 44 public: |
38 class NET_EXPORT RequestHandle { | 45 class NET_EXPORT RequestHandle { |
39 public: | 46 public: |
40 RequestHandle(); | 47 RequestHandle(); |
41 ~RequestHandle(); | 48 ~RequestHandle(); |
42 | 49 |
(...skipping 29 matching lines...) Expand all Loading... |
72 ServerBoundCertStore* server_bound_cert_store, | 79 ServerBoundCertStore* server_bound_cert_store, |
73 const scoped_refptr<base::TaskRunner>& task_runner); | 80 const scoped_refptr<base::TaskRunner>& task_runner); |
74 | 81 |
75 ~ServerBoundCertService(); | 82 ~ServerBoundCertService(); |
76 | 83 |
77 // Returns the domain to be used for |host|. The domain is the | 84 // Returns the domain to be used for |host|. The domain is the |
78 // "registry controlled domain", or the "ETLD + 1" where one exists, or | 85 // "registry controlled domain", or the "ETLD + 1" where one exists, or |
79 // the origin otherwise. | 86 // the origin otherwise. |
80 static std::string GetDomainForHost(const std::string& host); | 87 static std::string GetDomainForHost(const std::string& host); |
81 | 88 |
82 // Tests whether the system time is within the supported range for | |
83 // certificate generation. This value is cached when ServerBoundCertService | |
84 // is created, so if the system time is changed by a huge amount, this may no | |
85 // longer hold. | |
86 bool IsSystemTimeValid() const { return is_system_time_valid_; } | |
87 | |
88 // Fetches the domain bound cert for the specified origin of the specified | 89 // Fetches the domain bound cert for the specified origin of the specified |
89 // type if one exists and creates one otherwise. Returns OK if successful or | 90 // type if one exists and creates one otherwise. Returns OK if successful or |
90 // an error code upon failure. | 91 // an error code upon failure. |
91 // | 92 // |
92 // |requested_types| is a list of the TLS ClientCertificateTypes the site will | 93 // |requested_types| is a list of the TLS ClientCertificateTypes the site will |
93 // accept, ordered from most preferred to least preferred. Types we don't | 94 // accept, ordered from most preferred to least preferred. Types we don't |
94 // support will be ignored. See ssl_client_cert_type.h. | 95 // support will be ignored. See ssl_client_cert_type.h. |
95 // | 96 // |
96 // On successful completion, |private_key| stores a DER-encoded | 97 // On successful completion, |private_key| stores a DER-encoded |
97 // PrivateKeyInfo struct, and |cert| stores a DER-encoded certificate, and | 98 // PrivateKeyInfo struct, and |cert| stores a DER-encoded certificate, and |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 149 |
149 // inflight_ maps from a server to an active generation which is taking | 150 // inflight_ maps from a server to an active generation which is taking |
150 // place. | 151 // place. |
151 std::map<std::string, ServerBoundCertServiceJob*> inflight_; | 152 std::map<std::string, ServerBoundCertServiceJob*> inflight_; |
152 base::WeakPtrFactory<ServerBoundCertService> weak_ptr_factory_; | 153 base::WeakPtrFactory<ServerBoundCertService> weak_ptr_factory_; |
153 | 154 |
154 uint64 requests_; | 155 uint64 requests_; |
155 uint64 cert_store_hits_; | 156 uint64 cert_store_hits_; |
156 uint64 inflight_joins_; | 157 uint64 inflight_joins_; |
157 | 158 |
158 bool is_system_time_valid_; | |
159 | |
160 DISALLOW_COPY_AND_ASSIGN(ServerBoundCertService); | 159 DISALLOW_COPY_AND_ASSIGN(ServerBoundCertService); |
161 }; | 160 }; |
162 | 161 |
163 } // namespace net | 162 } // namespace net |
164 | 163 |
165 #endif // NET_SSL_SERVER_BOUND_CERT_SERVICE_H_ | 164 #endif // NET_SSL_SERVER_BOUND_CERT_SERVICE_H_ |
OLD | NEW |