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

Side by Side Diff: net/cert/internal/trust_store_static.h

Issue 2126803004: WIP: NSS trust store integration for path builder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert-command-line-path-builder-add_certpathbuilder
Patch Set: . Created 4 years, 4 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/cert/internal/trust_store_nss_unittest.cc ('k') | net/cert/internal/trust_store_static.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_CERT_INTERNAL_TRUST_STORE_STATIC_H_
6 #define NET_CERT_INTERNAL_TRUST_STORE_STATIC_H_
7
8 #include <map>
9
10 #include "base/memory/ref_counted.h"
11 #include "base/strings/string_piece.h"
12 #include "net/base/net_export.h"
13 #include "net/cert/internal/cert_issuer_source_static.h"
14 #include "net/cert/internal/parsed_certificate.h"
15 #include "net/cert/internal/trust_store.h"
16
17 namespace net {
18
19 namespace der {
20 class Input;
21 }
22
23 // A very simple implementation of a TrustStoreStatic, which contains a set of
24 // trusted certificates.
25 class NET_EXPORT TrustStoreStatic : public TrustStore {
26 public:
27 TrustStoreStatic();
28 ~TrustStoreStatic() override;
29
30 // Adds a trusted certificate to the store.
31 void AddTrustedCertificate(scoped_refptr<ParsedCertificate> anchor);
32
33 // TrustStore implementation:
34 void IsTrustedCertificate(
35 scoped_refptr<ParsedCertificate> cert,
36 const TrustCallback& callback,
37 bool* out_trusted,
38 std::unique_ptr<TrustStore::Request>* out_req) const override;
39
40 // CertIssuerSource implementation:
41 void SyncGetIssuersOf(const ParsedCertificate* cert,
42 ParsedCertificateList* issuers) override;
43 void AsyncGetIssuersOf(
44 scoped_refptr<ParsedCertificate> cert,
45 const IssuerCallback& callback,
46 std::unique_ptr<CertIssuerSource::Request>* out_req) override;
47
48 private:
49 using Key = std::tuple<base::StringPiece, base::StringPiece>;
50
51 static Key GetKey(const ParsedCertificate* cert);
52
53 // TODO(mattm): use unordered_map. Requires making a hash function for Key.
54 // Multimap from (normalized subject, SPKI) -> ParsedCertificate.
55 std::map<Key, scoped_refptr<ParsedCertificate>> anchors_;
56
57 CertIssuerSourceStatic cert_source_;
58
59 DISALLOW_COPY_AND_ASSIGN(TrustStoreStatic);
60 };
61
62 } // namespace net
63
64 #endif // NET_CERT_INTERNAL_TRUST_STORE_STATIC_H_
OLDNEW
« no previous file with comments | « net/cert/internal/trust_store_nss_unittest.cc ('k') | net/cert/internal/trust_store_static.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698