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> |
10 | 10 |
11 #include "net/base/net_api.h" | 11 #include "net/base/net_export.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_EXPORT OriginBoundCertStore { |
23 public: | 23 public: |
24 virtual ~OriginBoundCertStore() {} | 24 virtual ~OriginBoundCertStore() {} |
25 | 25 |
26 // TODO(rkn): Specify certificate type (RSA or DSA). | 26 // TODO(rkn): Specify certificate type (RSA or DSA). |
27 // TODO(rkn): File I/O may be required, so this should have an asynchronous | 27 // TODO(rkn): File I/O may be required, so this should have an asynchronous |
28 // interface. | 28 // interface. |
29 // Returns true on success. |private_key_result| stores a DER-encoded | 29 // Returns true on success. |private_key_result| stores a DER-encoded |
30 // PrivateKeyInfo struct and |cert_result| stores a DER-encoded | 30 // PrivateKeyInfo struct and |cert_result| stores a DER-encoded |
31 // certificate. Returns false if no origin bound cert exists for the | 31 // certificate. Returns false if no origin bound cert exists for the |
32 // specified origin. | 32 // specified origin. |
33 virtual bool GetOriginBoundCert(const std::string& origin, | 33 virtual bool GetOriginBoundCert(const std::string& origin, |
34 std::string* private_key_result, | 34 std::string* private_key_result, |
35 std::string* cert_result) = 0; | 35 std::string* cert_result) = 0; |
36 | 36 |
37 // Adds an origin bound cert to the store. | 37 // Adds an origin bound cert to the store. |
38 virtual bool SetOriginBoundCert(const std::string& origin, | 38 virtual bool SetOriginBoundCert(const std::string& origin, |
39 const std::string& private_key, | 39 const std::string& private_key, |
40 const std::string& cert) = 0; | 40 const std::string& cert) = 0; |
41 | 41 |
42 // Returns the number of certs in the store. | 42 // Returns the number of certs in the store. |
43 // Public only for unit testing. | 43 // Public only for unit testing. |
44 virtual int GetCertCount() = 0; | 44 virtual int GetCertCount() = 0; |
45 }; | 45 }; |
46 | 46 |
47 } // namespace net | 47 } // namespace net |
48 | 48 |
49 #endif // NET_BASE_ORIGIN_BOUND_CERT_STORE_H_ | 49 #endif // NET_BASE_ORIGIN_BOUND_CERT_STORE_H_ |
OLD | NEW |