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

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

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_static.h ('k') | net/cert/internal/trust_store_test_helpers.h » ('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 #include "net/cert/internal/trust_store_static.h"
6
7 namespace net {
8
9 TrustStoreStatic::TrustStoreStatic() = default;
10 TrustStoreStatic::~TrustStoreStatic() = default;
11
12 void TrustStoreStatic::AddTrustedCertificate(
13 scoped_refptr<ParsedCertificate> anchor) {
14 cert_source_.AddCert(anchor);
15
16 ParsedCertificate* anchor_ptr = anchor.get();
17 anchors_.insert(std::make_pair(GetKey(anchor_ptr), std::move(anchor)));
18 }
19
20 // static
21 TrustStoreStatic::Key TrustStoreStatic::GetKey(const ParsedCertificate* cert) {
22 return Key(cert->normalized_subject().AsStringPiece(),
23 cert->tbs().spki_tlv.AsStringPiece());
24 }
25
26 void TrustStoreStatic::IsTrustedCertificate(
27 scoped_refptr<ParsedCertificate> cert,
28 const TrustCallback& callback,
29 bool* out_trusted,
30 std::unique_ptr<TrustStore::Request>* out_req) const {
31 out_req->reset();
32 *out_trusted = anchors_.find(GetKey(cert.get())) != anchors_.end();
33 }
34
35 void TrustStoreStatic::SyncGetIssuersOf(const ParsedCertificate* cert,
36 ParsedCertificateList* issuers) {
37 cert_source_.SyncGetIssuersOf(std::move(cert), issuers);
38 }
39
40 void TrustStoreStatic::AsyncGetIssuersOf(
41 scoped_refptr<ParsedCertificate> cert,
42 const IssuerCallback& callback,
43 std::unique_ptr<CertIssuerSource::Request>* out_req) {
44 cert_source_.AsyncGetIssuersOf(std::move(cert), callback, out_req);
45 }
46
47 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/internal/trust_store_static.h ('k') | net/cert/internal/trust_store_test_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698