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

Side by Side Diff: components/cast_certificate/cast_cert_validator_test_helpers.cc

Issue 2832703002: Allow the TrustStore interface to return matching intermediates, and identify distrusted certs. (Closed)
Patch Set: address comments Created 3 years, 7 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 "components/cast_certificate/cast_cert_validator_test_helpers.h" 5 #include "components/cast_certificate/cast_cert_validator_test_helpers.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "net/cert/internal/cert_errors.h" 9 #include "net/cert/internal/cert_errors.h"
10 #include "net/cert/pem_tokenizer.h" 10 #include "net/cert/pem_tokenizer.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 const std::string& path) { 86 const std::string& path) {
87 std::unique_ptr<net::TrustStoreInMemory> trust_store( 87 std::unique_ptr<net::TrustStoreInMemory> trust_store(
88 new net::TrustStoreInMemory()); 88 new net::TrustStoreInMemory());
89 const auto trusted_test_roots = 89 const auto trusted_test_roots =
90 cast_certificate::testing::ReadCertificateChainFromFile(path); 90 cast_certificate::testing::ReadCertificateChainFromFile(path);
91 for (const auto& trusted_root : trusted_test_roots) { 91 for (const auto& trusted_root : trusted_test_roots) {
92 net::CertErrors errors; 92 net::CertErrors errors;
93 scoped_refptr<net::ParsedCertificate> cert(net::ParsedCertificate::Create( 93 scoped_refptr<net::ParsedCertificate> cert(net::ParsedCertificate::Create(
94 net::x509_util::CreateCryptoBuffer(trusted_root), {}, &errors)); 94 net::x509_util::CreateCryptoBuffer(trusted_root), {}, &errors));
95 EXPECT_TRUE(cert) << errors.ToDebugString(); 95 EXPECT_TRUE(cert) << errors.ToDebugString();
96 scoped_refptr<net::TrustAnchor> anchor = 96 trust_store->AddTrustAnchorWithConstraints(cert);
ryanchung 2017/04/28 23:11:30 nit: std:move(cert) ?
eroman 2017/04/28 23:51:06 AddTrustAnchorWithConstraints() in this case takes
ryanchung 2017/04/28 23:57:37 Isn't it AddTrustAnchorWithConstraints(scoped_refp
97 net::TrustAnchor::CreateFromCertificateWithConstraints(std::move(cert));
98 trust_store->AddTrustAnchor(std::move(anchor));
99 } 97 }
100 return trust_store; 98 return trust_store;
101 } 99 }
102 100
103 base::Time ConvertUnixTimestampSeconds(uint64_t time) { 101 base::Time ConvertUnixTimestampSeconds(uint64_t time) {
104 return base::Time::UnixEpoch() + base::TimeDelta::FromSeconds(time); 102 return base::Time::UnixEpoch() + base::TimeDelta::FromSeconds(time);
105 } 103 }
106 104
107 } // namespace testing 105 } // namespace testing
108 106
109 } // namespace cast_certificate 107 } // namespace cast_certificate
OLDNEW
« no previous file with comments | « components/cast_certificate/cast_cert_validator.cc ('k') | components/cast_certificate/cast_cert_validator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698