OLD | NEW |
(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 |
OLD | NEW |