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

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

Issue 2000503002: Remove the fingerprint and ca_fingerprint from X509Certificate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_cache
Patch Set: Fix IDN test 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 #ifndef CONTENT_BROWSER_CERT_STORE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_CERT_STORE_IMPL_H_
6 #define CONTENT_BROWSER_CERT_STORE_IMPL_H_ 6 #define CONTENT_BROWSER_CERT_STORE_IMPL_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
9 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
10 #include "content/browser/renderer_data_memoizing_store.h" 11 #include "content/browser/renderer_data_memoizing_store.h"
11 #include "content/public/browser/cert_store.h" 12 #include "content/public/browser/cert_store.h"
13 #include "net/base/hash_value.h"
12 #include "net/cert/x509_certificate.h" 14 #include "net/cert/x509_certificate.h"
13 15
14 namespace content { 16 namespace content {
15 17
16 class CertStoreImpl : public CertStore { 18 class CertStoreImpl : public CertStore {
17 public: 19 public:
18 // Returns the singleton instance of the CertStore. 20 // Returns the singleton instance of the CertStore.
19 static CertStoreImpl* GetInstance(); 21 static CertStoreImpl* GetInstance();
20 22
21 // CertStore implementation: 23 // CertStore implementation:
22 int StoreCert(net::X509Certificate* cert, 24 int StoreCert(net::X509Certificate* cert,
23 int render_process_host_id) override; 25 int render_process_host_id) override;
24 bool RetrieveCert(int cert_id, 26 bool RetrieveCert(int cert_id,
25 scoped_refptr<net::X509Certificate>* cert) override; 27 scoped_refptr<net::X509Certificate>* cert) override;
26 28
27 protected: 29 protected:
28 CertStoreImpl(); 30 CertStoreImpl();
29 ~CertStoreImpl() override; 31 ~CertStoreImpl() override;
30 32
31 private: 33 private:
32 friend struct base::DefaultSingletonTraits<CertStoreImpl>; 34 friend struct base::DefaultSingletonTraits<CertStoreImpl>;
33 35
34 RendererDataMemoizingStore<net::X509Certificate> store_; 36 // Utility structure that allows memoization to be based on the
37 // hash of |cert|'s certificate chain, to avoid needing to compare
38 // every certificate individually. This is purely an optimization.
39 class HashAndCert : public base::RefCountedThreadSafe<HashAndCert> {
40 public:
41 HashAndCert();
42
43 // Comparator for RendererDataMemoizingStore.
44 struct LessThan {
45 bool operator()(const scoped_refptr<HashAndCert>& lhs,
46 const scoped_refptr<HashAndCert>& rhs) const;
47 };
48
49 net::SHA256HashValue chain_hash;
50 scoped_refptr<net::X509Certificate> cert;
51
52 private:
53 friend class base::RefCountedThreadSafe<HashAndCert>;
54
55 ~HashAndCert();
56
57 DISALLOW_COPY_AND_ASSIGN(HashAndCert);
58 };
59 RendererDataMemoizingStore<HashAndCert> store_;
35 60
36 DISALLOW_COPY_AND_ASSIGN(CertStoreImpl); 61 DISALLOW_COPY_AND_ASSIGN(CertStoreImpl);
37 }; 62 };
38 63
39 } // namespace content 64 } // namespace content
40 65
41 #endif // CONTENT_BROWSER_CERT_STORE_IMPL_H_ 66 #endif // CONTENT_BROWSER_CERT_STORE_IMPL_H_
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_certificate_importer_impl_unittest.cc ('k') | content/browser/cert_store_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698