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

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

Issue 8890073: Handle Origin Bound Certificate expiration. (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 #include "net/base/default_origin_bound_cert_store.h" 5 #include "net/base/default_origin_bound_cert_store.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 9
10 namespace net { 10 namespace net {
(...skipping 12 matching lines...) Expand all
23 23
24 if (initialized_ && store_) 24 if (initialized_ && store_)
25 store_->Flush(completion_task); 25 store_->Flush(completion_task);
26 else if (!completion_task.is_null()) 26 else if (!completion_task.is_null())
27 MessageLoop::current()->PostTask(FROM_HERE, completion_task); 27 MessageLoop::current()->PostTask(FROM_HERE, completion_task);
28 } 28 }
29 29
30 bool DefaultOriginBoundCertStore::GetOriginBoundCert( 30 bool DefaultOriginBoundCertStore::GetOriginBoundCert(
31 const std::string& origin, 31 const std::string& origin,
32 SSLClientCertType* type, 32 SSLClientCertType* type,
33 base::Time* expiration_time,
33 std::string* private_key_result, 34 std::string* private_key_result,
34 std::string* cert_result) { 35 std::string* cert_result) {
35 base::AutoLock autolock(lock_); 36 base::AutoLock autolock(lock_);
36 InitIfNecessary(); 37 InitIfNecessary();
37 38
38 OriginBoundCertMap::iterator it = origin_bound_certs_.find(origin); 39 OriginBoundCertMap::iterator it = origin_bound_certs_.find(origin);
39 40
40 if (it == origin_bound_certs_.end()) 41 if (it == origin_bound_certs_.end())
41 return false; 42 return false;
42 43
43 OriginBoundCert* cert = it->second; 44 OriginBoundCert* cert = it->second;
44 *type = cert->type(); 45 *type = cert->type();
46 *expiration_time = cert->expiration_time();
45 *private_key_result = cert->private_key(); 47 *private_key_result = cert->private_key();
46 *cert_result = cert->cert(); 48 *cert_result = cert->cert();
47 49
48 return true; 50 return true;
49 } 51 }
50 52
51 void DefaultOriginBoundCertStore::SetOriginBoundCert( 53 void DefaultOriginBoundCertStore::SetOriginBoundCert(
52 const std::string& origin, 54 const std::string& origin,
53 SSLClientCertType type, 55 SSLClientCertType type,
56 base::Time expiration_time,
54 const std::string& private_key, 57 const std::string& private_key,
55 const std::string& cert) { 58 const std::string& cert) {
56 base::AutoLock autolock(lock_); 59 base::AutoLock autolock(lock_);
57 InitIfNecessary(); 60 InitIfNecessary();
58 61
59 InternalDeleteOriginBoundCert(origin); 62 InternalDeleteOriginBoundCert(origin);
60 InternalInsertOriginBoundCert( 63 InternalInsertOriginBoundCert(
61 origin, new OriginBoundCert(origin, type, private_key, cert)); 64 origin,
65 new OriginBoundCert(origin, type, expiration_time, private_key, cert));
62 } 66 }
63 67
64 void DefaultOriginBoundCertStore::DeleteOriginBoundCert( 68 void DefaultOriginBoundCertStore::DeleteOriginBoundCert(
65 const std::string& origin) { 69 const std::string& origin) {
66 base::AutoLock autolock(lock_); 70 base::AutoLock autolock(lock_);
67 InitIfNecessary(); 71 InitIfNecessary();
68 InternalDeleteOriginBoundCert(origin); 72 InternalDeleteOriginBoundCert(origin);
69 } 73 }
70 74
71 void DefaultOriginBoundCertStore::DeleteAll() { 75 void DefaultOriginBoundCertStore::DeleteAll() {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 lock_.AssertAcquired(); 155 lock_.AssertAcquired();
152 156
153 if (store_) 157 if (store_)
154 store_->AddOriginBoundCert(*cert); 158 store_->AddOriginBoundCert(*cert);
155 origin_bound_certs_[origin] = cert; 159 origin_bound_certs_[origin] = cert;
156 } 160 }
157 161
158 DefaultOriginBoundCertStore::PersistentStore::PersistentStore() {} 162 DefaultOriginBoundCertStore::PersistentStore::PersistentStore() {}
159 163
160 } // namespace net 164 } // namespace net
OLDNEW
« no previous file with comments | « net/base/default_origin_bound_cert_store.h ('k') | net/base/default_origin_bound_cert_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698