Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: net/base/default_origin_bound_cert_store.h

Issue 8662036: Support EC certs in OriginBoundCertService and OriginBoundCertStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review changes Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_DEFAULT_ORIGIN_BOUND_CERT_STORE_H_ 5 #ifndef NET_BASE_DEFAULT_ORIGIN_BOUND_CERT_STORE_H_
6 #define NET_BASE_DEFAULT_ORIGIN_BOUND_CERT_STORE_H_ 6 #define NET_BASE_DEFAULT_ORIGIN_BOUND_CERT_STORE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 virtual ~DefaultOriginBoundCertStore(); 48 virtual ~DefaultOriginBoundCertStore();
49 49
50 // Flush the backing store (if any) to disk and post the given task when done. 50 // Flush the backing store (if any) to disk and post the given task when done.
51 // WARNING: THE CALLBACK WILL RUN ON A RANDOM THREAD. IT MUST BE THREAD SAFE. 51 // WARNING: THE CALLBACK WILL RUN ON A RANDOM THREAD. IT MUST BE THREAD SAFE.
52 // It may be posted to the current thread, or it may run on the thread that 52 // It may be posted to the current thread, or it may run on the thread that
53 // actually does the flushing. Your Task should generally post a notification 53 // actually does the flushing. Your Task should generally post a notification
54 // to the thread you actually want to be notified on. 54 // to the thread you actually want to be notified on.
55 void FlushStore(const base::Closure& completion_task); 55 void FlushStore(const base::Closure& completion_task);
56 56
57 // OriginBoundCertStore implementation. 57 // OriginBoundCertStore implementation.
58 virtual bool GetOriginBoundCert(const std::string& origin, 58 virtual bool GetOriginBoundCert(
59 std::string* private_key_result, 59 const std::string& origin,
60 std::string* cert_result) OVERRIDE; 60 SSLClientCertType* type,
61 virtual void SetOriginBoundCert(const std::string& origin, 61 std::string* private_key_result,
62 const std::string& private_key, 62 std::string* cert_result) OVERRIDE;
63 const std::string& cert) OVERRIDE; 63 virtual void SetOriginBoundCert(
64 const std::string& origin,
65 SSLClientCertType type,
66 const std::string& private_key,
67 const std::string& cert) OVERRIDE;
64 virtual void DeleteOriginBoundCert(const std::string& origin) OVERRIDE; 68 virtual void DeleteOriginBoundCert(const std::string& origin) OVERRIDE;
65 virtual void DeleteAll() OVERRIDE; 69 virtual void DeleteAll() OVERRIDE;
66 virtual void GetAllOriginBoundCerts( 70 virtual void GetAllOriginBoundCerts(
67 std::vector<OriginBoundCertInfo>* origin_bound_certs) OVERRIDE; 71 std::vector<OriginBoundCertInfo>* origin_bound_certs) OVERRIDE;
68 virtual int GetCertCount() OVERRIDE; 72 virtual int GetCertCount() OVERRIDE;
69 73
70 private: 74 private:
71 static const size_t kMaxCerts; 75 static const size_t kMaxCerts;
72 76
73 // Deletes all of the certs. Does not delete them from |store_|. 77 // Deletes all of the certs. Does not delete them from |store_|.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 116
113 DISALLOW_COPY_AND_ASSIGN(DefaultOriginBoundCertStore); 117 DISALLOW_COPY_AND_ASSIGN(DefaultOriginBoundCertStore);
114 }; 118 };
115 119
116 // The OriginBoundCert class contains a private key in addition to the origin 120 // The OriginBoundCert class contains a private key in addition to the origin
117 // and the cert. 121 // and the cert.
118 class NET_EXPORT DefaultOriginBoundCertStore::OriginBoundCert { 122 class NET_EXPORT DefaultOriginBoundCertStore::OriginBoundCert {
119 public: 123 public:
120 OriginBoundCert(); 124 OriginBoundCert();
121 OriginBoundCert(const std::string& origin, 125 OriginBoundCert(const std::string& origin,
126 SSLClientCertType type,
122 const std::string& privatekey, 127 const std::string& privatekey,
123 const std::string& cert); 128 const std::string& cert);
124 129
125 const std::string& origin() const { return origin_; } 130 const std::string& origin() const { return origin_; }
131 SSLClientCertType type() const { return type_; }
126 const std::string& private_key() const { return private_key_; } 132 const std::string& private_key() const { return private_key_; }
127 const std::string& cert() const { return cert_; } 133 const std::string& cert() const { return cert_; }
128 134
129 private: 135 private:
130 std::string origin_; 136 std::string origin_;
137 SSLClientCertType type_;
131 std::string private_key_; 138 std::string private_key_;
132 std::string cert_; 139 std::string cert_;
133 }; 140 };
134 141
135 typedef base::RefCountedThreadSafe<DefaultOriginBoundCertStore::PersistentStore> 142 typedef base::RefCountedThreadSafe<DefaultOriginBoundCertStore::PersistentStore>
136 RefcountedPersistentStore; 143 RefcountedPersistentStore;
137 144
138 class NET_EXPORT DefaultOriginBoundCertStore::PersistentStore 145 class NET_EXPORT DefaultOriginBoundCertStore::PersistentStore
139 : public RefcountedPersistentStore { 146 : public RefcountedPersistentStore {
140 public: 147 public:
(...skipping 19 matching lines...) Expand all
160 protected: 167 protected:
161 PersistentStore(); 168 PersistentStore();
162 169
163 private: 170 private:
164 DISALLOW_COPY_AND_ASSIGN(PersistentStore); 171 DISALLOW_COPY_AND_ASSIGN(PersistentStore);
165 }; 172 };
166 173
167 } // namespace net 174 } // namespace net
168 175
169 #endif // NET_DEFAULT_ORIGIN_BOUND_CERT_STORE_H_ 176 #endif // NET_DEFAULT_ORIGIN_BOUND_CERT_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698