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

Unified Diff: components/cast_certificate/cast_cert_validator_test_helpers.cc

Issue 2303673004: Hook up Chrome Cast sender to Cast CRL. (Closed)
Patch Set: VerifyDeviceCertUsingCustomTrustStore and ParseAndVerifyCRLUsingCustomTrustStore Created 4 years, 3 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: components/cast_certificate/cast_cert_validator_test_helpers.cc
diff --git a/components/cast_certificate/cast_cert_validator_test_helpers.cc b/components/cast_certificate/cast_cert_validator_test_helpers.cc
index a854abd8c185058a0ef64c4009b0872566d20a82..47fa4ad577e6142099c1f6ee6d00d014c23696c4 100644
--- a/components/cast_certificate/cast_cert_validator_test_helpers.cc
+++ b/components/cast_certificate/cast_cert_validator_test_helpers.cc
@@ -80,6 +80,28 @@ SignatureTestData ReadSignatureTestData(const base::StringPiece& file_name) {
return result;
}
+std::unique_ptr<net::TrustStoreInMemory> CreateTrustStoreFromFile(
+ const std::string& path) {
+ std::unique_ptr<net::TrustStoreInMemory> trust_store(
+ new net::TrustStoreInMemory());
+ const auto trusted_test_roots =
+ cast_certificate::testing::ReadCertificateChainFromFile(path);
+ for (const auto& trusted_root : trusted_test_roots) {
+ scoped_refptr<net::ParsedCertificate> cert(
+ net::ParsedCertificate::CreateFromCertificateCopy(trusted_root, {}));
+ EXPECT_TRUE(cert);
+ scoped_refptr<net::TrustAnchor> anchor =
+ net::TrustAnchor::CreateFromCertificateWithConstraints(std::move(cert));
+ trust_store->AddTrustAnchor(std::move(anchor));
+ }
+ return trust_store;
+}
+
+base::Time ConvertUnixTimestampSeconds(uint64_t time) {
+ return base::Time::UnixEpoch() +
+ base::TimeDelta::FromMilliseconds(time * 1000);
eroman 2016/09/10 01:03:23 Use FromSeconds(). (It also avoids doing the over
ryanchung 2016/09/14 18:53:39 Done.
+}
+
} // namespace testing
} // namespace cast_certificate

Powered by Google App Engine
This is Rietveld 408576698