Chromium Code Reviews| 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 NET_SSL_CHANNEL_ID_STORE_H_ | 5 #ifndef NET_SSL_CHANNEL_ID_STORE_H_ |
| 6 #define NET_SSL_CHANNEL_ID_STORE_H_ | 6 #define NET_SSL_CHANNEL_ID_STORE_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 // for deleting it. | 25 // for deleting it. |
| 26 class NET_EXPORT ChannelIDStore | 26 class NET_EXPORT ChannelIDStore |
| 27 : NON_EXPORTED_BASE(public base::NonThreadSafe) { | 27 : NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 28 public: | 28 public: |
| 29 // The ChannelID class contains a private key in addition to the cert. | 29 // The ChannelID class contains a private key in addition to the cert. |
| 30 class NET_EXPORT ChannelID { | 30 class NET_EXPORT ChannelID { |
| 31 public: | 31 public: |
| 32 ChannelID(); | 32 ChannelID(); |
| 33 ChannelID(const std::string& server_identifier, | 33 ChannelID(const std::string& server_identifier, |
| 34 base::Time creation_time, | 34 base::Time creation_time, |
| 35 base::Time expiration_time, | |
| 36 const std::string& private_key, | 35 const std::string& private_key, |
| 37 const std::string& cert); | 36 const std::string& public_key); |
| 38 ~ChannelID(); | 37 ~ChannelID(); |
| 39 | 38 |
| 40 // Server identifier. For domain bound certs, for instance "verisign.com". | 39 // Server identifier. For domain bound certs, for instance "verisign.com". |
| 41 const std::string& server_identifier() const { return server_identifier_; } | 40 const std::string& server_identifier() const { return server_identifier_; } |
| 42 // The time the certificate was created, also the start of the certificate | 41 // The time the certificate was created. |
|
mattm
2015/04/10 01:00:28
key
nharper
2015/04/25 02:59:19
Done.
| |
| 43 // validity period. | |
| 44 base::Time creation_time() const { return creation_time_; } | 42 base::Time creation_time() const { return creation_time_; } |
| 45 // The time after which this certificate is no longer valid. | |
| 46 base::Time expiration_time() const { return expiration_time_; } | |
| 47 // The encoding of the private key depends on the type. | 43 // The encoding of the private key depends on the type. |
| 48 // rsa_sign: DER-encoded PrivateKeyInfo struct. | 44 // rsa_sign: DER-encoded PrivateKeyInfo struct. |
| 49 // ecdsa_sign: DER-encoded EncryptedPrivateKeyInfo struct. | 45 // ecdsa_sign: DER-encoded EncryptedPrivateKeyInfo struct. |
| 50 const std::string& private_key() const { return private_key_; } | 46 const std::string& private_key() const { return private_key_; } |
| 51 // DER-encoded certificate. | 47 // DER-encoded public key. |
| 52 const std::string& cert() const { return cert_; } | 48 const std::string& public_key() const { return public_key_; } |
| 53 | 49 |
| 54 private: | 50 private: |
| 55 std::string server_identifier_; | 51 std::string server_identifier_; |
| 56 base::Time creation_time_; | 52 base::Time creation_time_; |
| 57 base::Time expiration_time_; | |
| 58 std::string private_key_; | 53 std::string private_key_; |
| 59 std::string cert_; | 54 std::string public_key_; |
| 60 }; | 55 }; |
| 61 | 56 |
| 62 typedef std::list<ChannelID> ChannelIDList; | 57 typedef std::list<ChannelID> ChannelIDList; |
| 63 | 58 |
| 64 typedef base::Callback<void( | 59 typedef base::Callback<void( |
| 65 int, | 60 int, |
| 66 const std::string&, | 61 const std::string&, |
| 67 base::Time, | |
| 68 const std::string&, | 62 const std::string&, |
| 69 const std::string&)> GetChannelIDCallback; | 63 const std::string&)> GetChannelIDCallback; |
| 70 typedef base::Callback<void(const ChannelIDList&)> GetChannelIDListCallback; | 64 typedef base::Callback<void(const ChannelIDList&)> GetChannelIDListCallback; |
| 71 | 65 |
| 72 virtual ~ChannelIDStore() {} | 66 virtual ~ChannelIDStore() {} |
| 73 | 67 |
| 74 // GetChannelID may return the result synchronously through the | 68 // GetChannelID may return the result synchronously through the |
| 75 // output parameters, in which case it will return either OK if a cert is | 69 // 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 | 70 // found in the store, or ERR_FILE_NOT_FOUND if none is found. If the |
| 77 // result cannot be returned synchronously, GetChannelID will | 71 // result cannot be returned synchronously, GetChannelID will |
| 78 // return ERR_IO_PENDING and the callback will be called with the result | 72 // return ERR_IO_PENDING and the callback will be called with the result |
| 79 // asynchronously. | 73 // asynchronously. |
| 80 virtual int GetChannelID( | 74 virtual int GetChannelID( |
| 81 const std::string& server_identifier, | 75 const std::string& server_identifier, |
| 82 base::Time* expiration_time, | |
| 83 std::string* private_key_result, | 76 std::string* private_key_result, |
| 84 std::string* cert_result, | 77 std::string* cert_result, |
| 85 const GetChannelIDCallback& callback) = 0; | 78 const GetChannelIDCallback& callback) = 0; |
| 86 | 79 |
| 87 // Adds a server bound cert and the corresponding private key to the store. | 80 // Adds a server bound cert and the corresponding private key to the store. |
| 88 virtual void SetChannelID( | 81 virtual void SetChannelID( |
| 89 const std::string& server_identifier, | 82 const std::string& server_identifier, |
| 90 base::Time creation_time, | 83 base::Time creation_time, |
| 91 base::Time expiration_time, | |
| 92 const std::string& private_key, | 84 const std::string& private_key, |
| 93 const std::string& cert) = 0; | 85 const std::string& cert) = 0; |
| 94 | 86 |
| 95 // Removes a server bound cert and the corresponding private key from the | 87 // Removes a server bound cert and the corresponding private key from the |
| 96 // store. | 88 // store. |
| 97 virtual void DeleteChannelID( | 89 virtual void DeleteChannelID( |
| 98 const std::string& server_identifier, | 90 const std::string& server_identifier, |
| 99 const base::Closure& completion_callback) = 0; | 91 const base::Closure& completion_callback) = 0; |
| 100 | 92 |
| 101 // Deletes all of the server bound certs that have a creation_date greater | 93 // Deletes all of the server bound certs that have a creation_date greater |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 122 virtual int GetChannelIDCount() = 0; | 114 virtual int GetChannelIDCount() = 0; |
| 123 | 115 |
| 124 // When invoked, instructs the store to keep session related data on | 116 // When invoked, instructs the store to keep session related data on |
| 125 // destruction. | 117 // destruction. |
| 126 virtual void SetForceKeepSessionState() = 0; | 118 virtual void SetForceKeepSessionState() = 0; |
| 127 }; | 119 }; |
| 128 | 120 |
| 129 } // namespace net | 121 } // namespace net |
| 130 | 122 |
| 131 #endif // NET_SSL_CHANNEL_ID_STORE_H_ | 123 #endif // NET_SSL_CHANNEL_ID_STORE_H_ |
| OLD | NEW |