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

Unified Diff: net/cert/internal/trust_store_collection.cc

Issue 2832703002: Allow the TrustStore interface to return matching intermediates, and identify distrusted certs. (Closed)
Patch Set: fix cert_verify_tool 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 side-by-side diff with in-line comments
Download patch
Index: net/cert/internal/trust_store_collection.cc
diff --git a/net/cert/internal/trust_store_collection.cc b/net/cert/internal/trust_store_collection.cc
index 7e004ae1b726b195f7b0012cfba7ccf25c197dc6..3687081632cc7f913c2075cef9ad26ce133a9f59 100644
--- a/net/cert/internal/trust_store_collection.cc
+++ b/net/cert/internal/trust_store_collection.cc
@@ -14,12 +14,34 @@ void TrustStoreCollection::AddTrustStore(TrustStore* store) {
stores_.push_back(store);
}
-void TrustStoreCollection::FindTrustAnchorsForCert(
+void TrustStoreCollection::SyncGetIssuersOf(const ParsedCertificate* cert,
+ ParsedCertificateList* issuers) {
+ for (auto* store : stores_) {
+ store->SyncGetIssuersOf(cert, issuers);
+ }
+}
+
+void TrustStoreCollection::GetTrust(
const scoped_refptr<ParsedCertificate>& cert,
- TrustAnchors* matches) const {
+ CertificateTrust* out_trust) const {
+ // The current aggregate result.
+ CertificateTrust result = CertificateTrust::Unspecified();
+
for (auto* store : stores_) {
- store->FindTrustAnchorsForCert(cert, matches);
+ CertificateTrust cur_trust;
+ store->GetTrust(cert, &cur_trust);
+
+ // * If any stores distrust the certificate, consider it untrusted.
+ // * If multiple stores consider it trusted, use the trust result from first
mattm 2017/04/28 20:26:47 doesn't it use the result from the last one?
eroman 2017/04/28 21:48:03 You are correct. Updated the comment.
+ // one.
+ if (!cur_trust.HasUnspecifiedTrust()) {
+ result = cur_trust;
+ if (result.IsDistrusted())
+ break;
+ }
}
+
+ *out_trust = result;
}
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698