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_STORE_H_ | 5 #ifndef NET_SSL_SERVER_BOUND_CERT_STORE_H_ |
6 #define NET_SSL_SERVER_BOUND_CERT_STORE_H_ | 6 #define NET_SSL_SERVER_BOUND_CERT_STORE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 private: | 54 private: |
55 std::string server_identifier_; | 55 std::string server_identifier_; |
56 base::Time creation_time_; | 56 base::Time creation_time_; |
57 base::Time expiration_time_; | 57 base::Time expiration_time_; |
58 std::string private_key_; | 58 std::string private_key_; |
59 std::string cert_; | 59 std::string cert_; |
60 }; | 60 }; |
61 | 61 |
62 typedef std::list<ServerBoundCert> ServerBoundCertList; | 62 typedef std::list<ServerBoundCert> ServerBoundCertList; |
63 | 63 |
64 typedef base::Callback<void( | 64 typedef base::Callback<void(int, |
65 int, | 65 const std::string&, |
66 const std::string&, | 66 base::Time, |
67 base::Time, | 67 const std::string&, |
68 const std::string&, | 68 const std::string&)> GetCertCallback; |
69 const std::string&)> GetCertCallback; | |
70 typedef base::Callback<void(const ServerBoundCertList&)> GetCertListCallback; | 69 typedef base::Callback<void(const ServerBoundCertList&)> GetCertListCallback; |
71 | 70 |
72 virtual ~ServerBoundCertStore() {} | 71 virtual ~ServerBoundCertStore() {} |
73 | 72 |
74 // GetServerBoundCert may return the result synchronously through the | 73 // GetServerBoundCert may return the result synchronously through the |
75 // output parameters, in which case it will return either OK if a cert is | 74 // output parameters, in which case it will return either OK if a cert is |
76 // found in the store, or ERR_FILE_NOT_FOUND if none is found. If the | 75 // found in the store, or ERR_FILE_NOT_FOUND if none is found. If the |
77 // result cannot be returned synchronously, GetServerBoundCert will | 76 // result cannot be returned synchronously, GetServerBoundCert will |
78 // return ERR_IO_PENDING and the callback will be called with the result | 77 // return ERR_IO_PENDING and the callback will be called with the result |
79 // asynchronously. | 78 // asynchronously. |
80 virtual int GetServerBoundCert( | 79 virtual int GetServerBoundCert(const std::string& server_identifier, |
81 const std::string& server_identifier, | 80 base::Time* expiration_time, |
82 base::Time* expiration_time, | 81 std::string* private_key_result, |
83 std::string* private_key_result, | 82 std::string* cert_result, |
84 std::string* cert_result, | 83 const GetCertCallback& callback) = 0; |
85 const GetCertCallback& callback) = 0; | |
86 | 84 |
87 // Adds a server bound cert and the corresponding private key to the store. | 85 // Adds a server bound cert and the corresponding private key to the store. |
88 virtual void SetServerBoundCert( | 86 virtual void SetServerBoundCert(const std::string& server_identifier, |
89 const std::string& server_identifier, | 87 base::Time creation_time, |
90 base::Time creation_time, | 88 base::Time expiration_time, |
91 base::Time expiration_time, | 89 const std::string& private_key, |
92 const std::string& private_key, | 90 const std::string& cert) = 0; |
93 const std::string& cert) = 0; | |
94 | 91 |
95 // Removes a server bound cert and the corresponding private key from the | 92 // Removes a server bound cert and the corresponding private key from the |
96 // store. | 93 // store. |
97 virtual void DeleteServerBoundCert( | 94 virtual void DeleteServerBoundCert( |
98 const std::string& server_identifier, | 95 const std::string& server_identifier, |
99 const base::Closure& completion_callback) = 0; | 96 const base::Closure& completion_callback) = 0; |
100 | 97 |
101 // Deletes all of the server bound certs that have a creation_date greater | 98 // Deletes all of the server bound certs that have a creation_date greater |
102 // than or equal to |delete_begin| and less than |delete_end|. If a | 99 // than or equal to |delete_begin| and less than |delete_end|. If a |
103 // base::Time value is_null, that side of the comparison is unbounded. | 100 // base::Time value is_null, that side of the comparison is unbounded. |
(...skipping 18 matching lines...) Expand all Loading... |
122 virtual int GetCertCount() = 0; | 119 virtual int GetCertCount() = 0; |
123 | 120 |
124 // When invoked, instructs the store to keep session related data on | 121 // When invoked, instructs the store to keep session related data on |
125 // destruction. | 122 // destruction. |
126 virtual void SetForceKeepSessionState() = 0; | 123 virtual void SetForceKeepSessionState() = 0; |
127 }; | 124 }; |
128 | 125 |
129 } // namespace net | 126 } // namespace net |
130 | 127 |
131 #endif // NET_SSL_SERVER_BOUND_CERT_STORE_H_ | 128 #endif // NET_SSL_SERVER_BOUND_CERT_STORE_H_ |
OLD | NEW |