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

Side by Side Diff: net/ssl/default_channel_id_store.h

Issue 1076063002: Remove certificates from Channel ID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Udpate KeysEqual to fail if preconditions fail Created 5 years, 7 months 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
« no previous file with comments | « net/ssl/channel_id_store.cc ('k') | net/ssl/default_channel_id_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_DEFAULT_CHANNEL_ID_STORE_H_ 5 #ifndef NET_SSL_DEFAULT_CHANNEL_ID_STORE_H_
6 #define NET_SSL_DEFAULT_CHANNEL_ID_STORE_H_ 6 #define NET_SSL_DEFAULT_CHANNEL_ID_STORE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/scoped_vector.h" 16 #include "base/memory/scoped_vector.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "net/base/net_export.h" 18 #include "net/base/net_export.h"
19 #include "net/ssl/channel_id_store.h" 19 #include "net/ssl/channel_id_store.h"
20 20
21 namespace crypto {
22 class ECPrivateKey;
23 } // namespace crypto
24
21 namespace net { 25 namespace net {
22 26
23 // This class is the system for storing and retrieving server bound certs. 27 // This class is the system for storing and retrieving server bound certs.
24 // Modeled after the CookieMonster class, it has an in-memory cert store, 28 // Modeled after the CookieMonster class, it has an in-memory cert store,
25 // and synchronizes server bound certs to an optional permanent storage that 29 // and synchronizes server bound certs to an optional permanent storage that
26 // implements the PersistentStore interface. The use case is described in 30 // implements the PersistentStore interface. The use case is described in
27 // http://balfanz.github.com/tls-obc-spec/draft-balfanz-tls-obc-00.html 31 // http://balfanz.github.com/tls-obc-spec/draft-balfanz-tls-obc-00.html
28 // TODO(wtc): Update this comment. 32 // TODO(wtc): Update this comment.
29 class NET_EXPORT DefaultChannelIDStore : public ChannelIDStore { 33 class NET_EXPORT DefaultChannelIDStore : public ChannelIDStore {
30 public: 34 public:
31 class PersistentStore; 35 class PersistentStore;
32 36
33 // The key for each ChannelID* in ChannelIDMap is the 37 // The key for each ChannelID* in ChannelIDMap is the
34 // corresponding server. 38 // corresponding server.
35 typedef std::map<std::string, ChannelID*> ChannelIDMap; 39 typedef std::map<std::string, ChannelID*> ChannelIDMap;
36 40
37 // The store passed in should not have had Init() called on it yet. This 41 // The store passed in should not have had Init() called on it yet. This
38 // class will take care of initializing it. The backing store is NOT owned by 42 // class will take care of initializing it. The backing store is NOT owned by
39 // this class, but it must remain valid for the duration of the 43 // this class, but it must remain valid for the duration of the
40 // DefaultChannelIDStore's existence. If |store| is NULL, then no 44 // DefaultChannelIDStore's existence. If |store| is NULL, then no
41 // backing store will be updated. 45 // backing store will be updated.
42 explicit DefaultChannelIDStore(PersistentStore* store); 46 explicit DefaultChannelIDStore(PersistentStore* store);
43 47
44 ~DefaultChannelIDStore() override; 48 ~DefaultChannelIDStore() override;
45 49
46 // ChannelIDStore implementation. 50 // ChannelIDStore implementation.
47 int GetChannelID(const std::string& server_identifier, 51 int GetChannelID(const std::string& server_identifier,
48 base::Time* expiration_time, 52 scoped_ptr<crypto::ECPrivateKey>* key_result,
49 std::string* private_key_result,
50 std::string* cert_result,
51 const GetChannelIDCallback& callback) override; 53 const GetChannelIDCallback& callback) override;
52 void SetChannelID(const std::string& server_identifier, 54 void SetChannelID(scoped_ptr<ChannelID> channel_id) override;
53 base::Time creation_time,
54 base::Time expiration_time,
55 const std::string& private_key,
56 const std::string& cert) override;
57 void DeleteChannelID(const std::string& server_identifier, 55 void DeleteChannelID(const std::string& server_identifier,
58 const base::Closure& callback) override; 56 const base::Closure& callback) override;
59 void DeleteAllCreatedBetween(base::Time delete_begin, 57 void DeleteAllCreatedBetween(base::Time delete_begin,
60 base::Time delete_end, 58 base::Time delete_end,
61 const base::Closure& callback) override; 59 const base::Closure& callback) override;
62 void DeleteAll(const base::Closure& callback) override; 60 void DeleteAll(const base::Closure& callback) override;
63 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override; 61 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override;
64 int GetChannelIDCount() override; 62 int GetChannelIDCount() override;
65 void SetForceKeepSessionState() override; 63 void SetForceKeepSessionState() override;
66 64
(...skipping 26 matching lines...) Expand all
93 91
94 // Initializes the backing store and reads existing certs from it. 92 // Initializes the backing store and reads existing certs from it.
95 // Should only be called by InitIfNecessary(). 93 // Should only be called by InitIfNecessary().
96 void InitStore(); 94 void InitStore();
97 95
98 // Callback for backing store loading completion. 96 // Callback for backing store loading completion.
99 void OnLoaded(scoped_ptr<ScopedVector<ChannelID> > certs); 97 void OnLoaded(scoped_ptr<ScopedVector<ChannelID> > certs);
100 98
101 // Syncronous methods which do the actual work. Can only be called after 99 // Syncronous methods which do the actual work. Can only be called after
102 // initialization is complete. 100 // initialization is complete.
103 void SyncSetChannelID( 101 void SyncSetChannelID(scoped_ptr<ChannelID> channel_id);
104 const std::string& server_identifier,
105 base::Time creation_time,
106 base::Time expiration_time,
107 const std::string& private_key,
108 const std::string& cert);
109 void SyncDeleteChannelID(const std::string& server_identifier); 102 void SyncDeleteChannelID(const std::string& server_identifier);
110 void SyncDeleteAllCreatedBetween(base::Time delete_begin, 103 void SyncDeleteAllCreatedBetween(base::Time delete_begin,
111 base::Time delete_end); 104 base::Time delete_end);
112 void SyncGetAllChannelIDs(ChannelIDList* channel_id_list); 105 void SyncGetAllChannelIDs(ChannelIDList* channel_id_list);
113 106
114 // Add |task| to |waiting_tasks_|. 107 // Add |task| to |waiting_tasks_|.
115 void EnqueueTask(scoped_ptr<Task> task); 108 void EnqueueTask(scoped_ptr<Task> task);
116 // If already initialized, run |task| immediately. Otherwise add it to 109 // If already initialized, run |task| immediately. Otherwise add it to
117 // |waiting_tasks_|. 110 // |waiting_tasks_|.
118 void RunOrEnqueueTask(scoped_ptr<Task> task); 111 void RunOrEnqueueTask(scoped_ptr<Task> task);
119 112
120 // Deletes the channel id for the specified server, if such a channel id 113 // Deletes the channel id for the specified server, if such a channel id
121 // exists, from the in-memory store. Deletes it from |store_| if |store_| 114 // exists, from the in-memory store. Deletes it from |store_| if |store_|
122 // is not NULL. 115 // is not NULL.
123 void InternalDeleteChannelID(const std::string& server); 116 void InternalDeleteChannelID(const std::string& server);
124 117
125 // Takes ownership of *channel_id. 118 // Adds the channel id to the in-memory store and adds it to |store_| if
126 // Adds the channel id for the specified server to the in-memory store. 119 // |store_| is not NULL.
127 // Deletes it from |store_| if |store_| is not NULL. 120 void InternalInsertChannelID(scoped_ptr<ChannelID> channel_id);
128 void InternalInsertChannelID(const std::string& server_identifier,
129 ChannelID* channel_id);
130 121
131 // Indicates whether the channel id store has been initialized. This happens 122 // Indicates whether the channel id store has been initialized. This happens
132 // lazily in InitIfNecessary(). 123 // lazily in InitIfNecessary().
133 bool initialized_; 124 bool initialized_;
134 125
135 // Indicates whether loading from the backend store is completed and 126 // Indicates whether loading from the backend store is completed and
136 // calls may be immediately processed. 127 // calls may be immediately processed.
137 bool loaded_; 128 bool loaded_;
138 129
139 // Tasks that are waiting to be run once we finish loading. 130 // Tasks that are waiting to be run once we finish loading.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 PersistentStore(); 169 PersistentStore();
179 virtual ~PersistentStore(); 170 virtual ~PersistentStore();
180 171
181 private: 172 private:
182 DISALLOW_COPY_AND_ASSIGN(PersistentStore); 173 DISALLOW_COPY_AND_ASSIGN(PersistentStore);
183 }; 174 };
184 175
185 } // namespace net 176 } // namespace net
186 177
187 #endif // NET_SSL_DEFAULT_CHANNEL_ID_STORE_H_ 178 #endif // NET_SSL_DEFAULT_CHANNEL_ID_STORE_H_
OLDNEW
« no previous file with comments | « net/ssl/channel_id_store.cc ('k') | net/ssl/default_channel_id_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698