| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #include "net/cert/internal/trust_store_in_memory.h" | 5 #include "net/cert/internal/trust_store_in_memory.h" |
| 6 | 6 |
| 7 namespace net { | 7 namespace net { |
| 8 | 8 |
| 9 TrustStoreInMemory::TrustStoreInMemory() = default; | 9 TrustStoreInMemory::TrustStoreInMemory() = default; |
| 10 TrustStoreInMemory::~TrustStoreInMemory() = default; | 10 TrustStoreInMemory::~TrustStoreInMemory() = default; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 scoped_refptr<ParsedCertificate> cert) { | 21 scoped_refptr<ParsedCertificate> cert) { |
| 22 AddCertificate(std::move(cert), | 22 AddCertificate(std::move(cert), |
| 23 CertificateTrust::ForTrustAnchorEnforcingConstraints()); | 23 CertificateTrust::ForTrustAnchorEnforcingConstraints()); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void TrustStoreInMemory::AddDistrustedCertificateForTest( | 26 void TrustStoreInMemory::AddDistrustedCertificateForTest( |
| 27 scoped_refptr<ParsedCertificate> cert) { | 27 scoped_refptr<ParsedCertificate> cert) { |
| 28 AddCertificate(std::move(cert), CertificateTrust::ForDistrusted()); | 28 AddCertificate(std::move(cert), CertificateTrust::ForDistrusted()); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void TrustStoreInMemory::AddCertificateWithUnspecifiedTrust( |
| 32 scoped_refptr<ParsedCertificate> cert) { |
| 33 AddCertificate(std::move(cert), CertificateTrust::ForUnspecified()); |
| 34 } |
| 35 |
| 31 void TrustStoreInMemory::SyncGetIssuersOf(const ParsedCertificate* cert, | 36 void TrustStoreInMemory::SyncGetIssuersOf(const ParsedCertificate* cert, |
| 32 ParsedCertificateList* issuers) { | 37 ParsedCertificateList* issuers) { |
| 33 auto range = entries_.equal_range(cert->normalized_issuer().AsStringPiece()); | 38 auto range = entries_.equal_range(cert->normalized_issuer().AsStringPiece()); |
| 34 for (auto it = range.first; it != range.second; ++it) | 39 for (auto it = range.first; it != range.second; ++it) |
| 35 issuers->push_back(it->second.cert); | 40 issuers->push_back(it->second.cert); |
| 36 } | 41 } |
| 37 | 42 |
| 38 void TrustStoreInMemory::GetTrust(const scoped_refptr<ParsedCertificate>& cert, | 43 void TrustStoreInMemory::GetTrust(const scoped_refptr<ParsedCertificate>& cert, |
| 39 CertificateTrust* trust) const { | 44 CertificateTrust* trust) const { |
| 40 auto range = entries_.equal_range(cert->normalized_subject().AsStringPiece()); | 45 auto range = entries_.equal_range(cert->normalized_subject().AsStringPiece()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 66 Entry entry; | 71 Entry entry; |
| 67 entry.cert = std::move(cert); | 72 entry.cert = std::move(cert); |
| 68 entry.trust = trust; | 73 entry.trust = trust; |
| 69 | 74 |
| 70 // TODO(mattm): should this check for duplicate certificates? | 75 // TODO(mattm): should this check for duplicate certificates? |
| 71 entries_.insert( | 76 entries_.insert( |
| 72 std::make_pair(entry.cert->normalized_subject().AsStringPiece(), entry)); | 77 std::make_pair(entry.cert->normalized_subject().AsStringPiece(), entry)); |
| 73 } | 78 } |
| 74 | 79 |
| 75 } // namespace net | 80 } // namespace net |
| OLD | NEW |