Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BASE_ORIGIN_BOUND_CERT_STORE_H_ | 5 #ifndef NET_BASE_ORIGIN_BOUND_CERT_STORE_H_ |
| 6 #define NET_BASE_ORIGIN_BOUND_CERT_STORE_H_ | 6 #define NET_BASE_ORIGIN_BOUND_CERT_STORE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
|
wtc
2011/08/10 21:35:59
We should include <vector>.
| |
| 10 | 10 |
| 11 #include "net/base/net_api.h" | 11 #include "net/base/net_api.h" |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 | 14 |
| 15 // An interface for storing and retrieving origin bound certs. Origin bound | 15 // An interface for storing and retrieving origin bound certs. Origin bound |
| 16 // certificates are specified in | 16 // certificates are specified in |
| 17 // http://balfanz.github.com/tls-obc-spec/draft-balfanz-tls-obc-00.html. | 17 // http://balfanz.github.com/tls-obc-spec/draft-balfanz-tls-obc-00.html. |
| 18 | 18 |
| 19 // Owned only by a single OriginBoundCertService object, which is responsible | 19 // Owned only by a single OriginBoundCertService object, which is responsible |
| 20 // for deleting it. | 20 // for deleting it. |
| 21 | 21 |
| 22 class NET_API OriginBoundCertStore { | 22 class NET_API OriginBoundCertStore { |
| 23 public: | 23 public: |
| 24 struct OriginBoundCertInfo { | |
| 25 std::string origin; | |
| 26 std::string private_key; | |
| 27 std::string cert; | |
| 28 }; | |
|
rkn
2011/08/09 20:58:24
The need for this struct suggests that we ought to
wtc
2011/08/10 21:35:59
Please document this struct.
| |
| 29 | |
| 24 virtual ~OriginBoundCertStore() {} | 30 virtual ~OriginBoundCertStore() {} |
| 25 | 31 |
| 26 // TODO(rkn): Specify certificate type (RSA or DSA). | 32 // TODO(rkn): Specify certificate type (RSA or DSA). |
| 27 // TODO(rkn): File I/O may be required, so this should have an asynchronous | 33 // TODO(rkn): File I/O may be required, so this should have an asynchronous |
| 28 // interface. | 34 // interface. |
| 29 // Returns true on success. |private_key_result| stores a DER-encoded | 35 // Returns true on success. |private_key_result| stores a DER-encoded |
| 30 // PrivateKeyInfo struct and |cert_result| stores a DER-encoded | 36 // PrivateKeyInfo struct and |cert_result| stores a DER-encoded |
| 31 // certificate. Returns false if no origin bound cert exists for the | 37 // certificate. Returns false if no origin bound cert exists for the |
| 32 // specified origin. | 38 // specified origin. |
| 33 virtual bool GetOriginBoundCert(const std::string& origin, | 39 virtual bool GetOriginBoundCert(const std::string& origin, |
| 34 std::string* private_key_result, | 40 std::string* private_key_result, |
| 35 std::string* cert_result) = 0; | 41 std::string* cert_result) = 0; |
| 36 | 42 |
| 37 // Adds an origin bound cert to the store. | 43 // Adds an origin bound cert to the store. |
| 38 virtual bool SetOriginBoundCert(const std::string& origin, | 44 virtual bool SetOriginBoundCert(const std::string& origin, |
| 39 const std::string& private_key, | 45 const std::string& private_key, |
| 40 const std::string& cert) = 0; | 46 const std::string& cert) = 0; |
|
wtc
2011/08/10 21:35:59
Add "and the corresponding private key" to the com
| |
| 41 | 47 |
| 48 // Removes an origin bound cert from the store. | |
|
wtc
2011/08/10 21:35:59
The new methods probably should all return a succe
| |
| 49 virtual void DeleteOriginBoundCert(const std::string& origin) = 0; | |
| 50 | |
| 51 // Removes all origin bound certs from the store. | |
| 52 virtual void DeleteAll() = 0; | |
| 53 | |
| 54 // Returns all origin bound certs. | |
| 55 virtual void GetAllOriginBoundCerts( | |
| 56 std::vector<OriginBoundCertInfo>* origin_bound_certs) = 0; | |
| 57 | |
| 42 // Returns the number of certs in the store. | 58 // Returns the number of certs in the store. |
| 43 // Public only for unit testing. | 59 // Public only for unit testing. |
| 44 virtual int GetCertCount() = 0; | 60 virtual int GetCertCount() = 0; |
| 45 }; | 61 }; |
| 46 | 62 |
| 47 } // namespace net | 63 } // namespace net |
| 48 | 64 |
| 49 #endif // NET_BASE_ORIGIN_BOUND_CERT_STORE_H_ | 65 #endif // NET_BASE_ORIGIN_BOUND_CERT_STORE_H_ |
| OLD | NEW |