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

Side by Side Diff: content/browser/cert_store_impl.cc

Issue 2000503002: Remove the fingerprint and ca_fingerprint from X509Certificate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_cache
Patch Set: Feedback Created 4 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/cert_store_impl.h" 5 #include "content/browser/cert_store_impl.h"
6 6
7 namespace content { 7 namespace content {
8 8
9 // static 9 // static
10 CertStore* CertStore::GetInstance() { 10 CertStore* CertStore::GetInstance() {
11 return CertStoreImpl::GetInstance(); 11 return CertStoreImpl::GetInstance();
12 } 12 }
13 13
14 // static 14 // static
15 CertStoreImpl* CertStoreImpl::GetInstance() { 15 CertStoreImpl* CertStoreImpl::GetInstance() {
16 return base::Singleton<CertStoreImpl>::get(); 16 return base::Singleton<CertStoreImpl>::get();
17 } 17 }
18 18
19 CertStoreImpl::CertStoreImpl() {} 19 CertStoreImpl::CertStoreImpl() {}
20 20
21 CertStoreImpl::~CertStoreImpl() {} 21 CertStoreImpl::~CertStoreImpl() {}
22 22
23 CertStoreImpl::HashAndCert::HashAndCert() = default;
24
25 bool CertStoreImpl::HashAndCert::LessThan::operator()(
26 const scoped_refptr<HashAndCert>& lhs,
27 const scoped_refptr<HashAndCert>& rhs) const {
28 return net::SHA256HashValueLessThan()(lhs->chain_hash, rhs->chain_hash);
29 }
30
31 CertStoreImpl::HashAndCert::~HashAndCert() = default;
32
23 int CertStoreImpl::StoreCert(net::X509Certificate* cert, int process_id) { 33 int CertStoreImpl::StoreCert(net::X509Certificate* cert, int process_id) {
24 return store_.Store(cert, process_id); 34 scoped_refptr<HashAndCert> hash_and_cert(new HashAndCert);
35 hash_and_cert->chain_hash =
eroman 2016/06/09 22:18:25 I would say make HashAndCert's ctor take |cert| an
Ryan Sleevi 2016/06/09 22:59:36 That doesn't meaningfully work, because std::map r
36 net::X509Certificate::CalculateChainFingerprint256(
37 cert->os_cert_handle(), cert->GetIntermediateCertificates());
38 hash_and_cert->cert = cert;
39 return store_.Store(hash_and_cert.get(), process_id);
25 } 40 }
26 41
27 bool CertStoreImpl::RetrieveCert(int cert_id, 42 bool CertStoreImpl::RetrieveCert(int cert_id,
28 scoped_refptr<net::X509Certificate>* cert) { 43 scoped_refptr<net::X509Certificate>* cert) {
29 return store_.Retrieve(cert_id, cert); 44 scoped_refptr<HashAndCert> hash_and_cert;
45 if (store_.Retrieve(cert_id, &hash_and_cert)) {
46 *cert = hash_and_cert->cert;
47 return true;
48 }
49 return false;
30 } 50 }
31 51
32 } // namespace content 52 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698