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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/trust_store_static.cc
diff --git a/net/cert/internal/trust_store_static.cc b/net/cert/internal/trust_store_static.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9702b9d7a04e4835c254ac4888642245015915de
--- /dev/null
+++ b/net/cert/internal/trust_store_static.cc
@@ -0,0 +1,47 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/cert/internal/trust_store_static.h"
+
+namespace net {
+
+TrustStoreStatic::TrustStoreStatic() = default;
+TrustStoreStatic::~TrustStoreStatic() = default;
+
+void TrustStoreStatic::AddTrustedCertificate(
+ scoped_refptr<ParsedCertificate> anchor) {
+ cert_source_.AddCert(anchor);
+
+ ParsedCertificate* anchor_ptr = anchor.get();
+ anchors_.insert(std::make_pair(GetKey(anchor_ptr), std::move(anchor)));
+}
+
+// static
+TrustStoreStatic::Key TrustStoreStatic::GetKey(const ParsedCertificate* cert) {
+ return Key(cert->normalized_subject().AsStringPiece(),
+ cert->tbs().spki_tlv.AsStringPiece());
+}
+
+void TrustStoreStatic::IsTrustedCertificate(
+ scoped_refptr<ParsedCertificate> cert,
+ const TrustCallback& callback,
+ bool* out_trusted,
+ std::unique_ptr<TrustStore::Request>* out_req) const {
+ out_req->reset();
+ *out_trusted = anchors_.find(GetKey(cert.get())) != anchors_.end();
+}
+
+void TrustStoreStatic::SyncGetIssuersOf(const ParsedCertificate* cert,
+ ParsedCertificateList* issuers) {
+ cert_source_.SyncGetIssuersOf(std::move(cert), issuers);
+}
+
+void TrustStoreStatic::AsyncGetIssuersOf(
+ scoped_refptr<ParsedCertificate> cert,
+ const IssuerCallback& callback,
+ std::unique_ptr<CertIssuerSource::Request>* out_req) {
+ cert_source_.AsyncGetIssuersOf(std::move(cert), callback, out_req);
+}
+
+} // namespace net
« 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