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

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

Issue 2832703002: Allow the TrustStore interface to return matching intermediates, and identify distrusted certs. (Closed)
Patch Set: mac fix Created 3 years, 8 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
OLDNEW
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;
11 11
12 void TrustStoreInMemory::Clear() { 12 void TrustStoreInMemory::Clear() {
13 anchors_.clear(); 13 anchors_.clear();
14 } 14 }
15 15
16 void TrustStoreInMemory::AddTrustAnchor(scoped_refptr<TrustAnchor> anchor) { 16 void TrustStoreInMemory::AddTrustAnchor(scoped_refptr<TrustAnchor> anchor) {
17 // TODO(mattm): should this check for duplicate anchors? 17 // TODO(mattm): should this check for duplicate anchors?
18 anchors_.insert(std::make_pair(anchor->normalized_subject().AsStringPiece(), 18 anchors_.insert(std::make_pair(anchor->normalized_subject().AsStringPiece(),
19 std::move(anchor))); 19 std::move(anchor)));
20 } 20 }
21 21
22 void TrustStoreInMemory::FindTrustAnchorsForCert( 22 void TrustStoreInMemory::FindIssuers(
23 const scoped_refptr<ParsedCertificate>& cert, 23 const scoped_refptr<ParsedCertificate>& cert,
24 TrustAnchors* matches) const { 24 TrustAnchors* trust_anchors,
25 ParsedCertificateList* intermediates) const {
25 auto range = anchors_.equal_range(cert->normalized_issuer().AsStringPiece()); 26 auto range = anchors_.equal_range(cert->normalized_issuer().AsStringPiece());
26 for (auto it = range.first; it != range.second; ++it) 27 for (auto it = range.first; it != range.second; ++it)
27 matches->push_back(it->second); 28 trust_anchors->push_back(it->second);
29 }
30
31 bool TrustStoreInMemory::IsBlacklisted(
32 const scoped_refptr<ParsedCertificate>& cert) const {
33 return false;
28 } 34 }
29 35
30 bool TrustStoreInMemory::Contains(const TrustAnchor* anchor) const { 36 bool TrustStoreInMemory::Contains(const TrustAnchor* anchor) const {
31 for (const auto& it : anchors_) { 37 for (const auto& it : anchors_) {
32 if (anchor == it.second.get()) 38 if (anchor == it.second.get())
33 return true; 39 return true;
34 } 40 }
35 return false; 41 return false;
36 } 42 }
37 43
38 } // namespace net 44 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698