Index: components/cast_certificate/cast_crl.cc |
diff --git a/components/cast_certificate/cast_crl.cc b/components/cast_certificate/cast_crl.cc |
index 7efd90b127b60d4ec1804d31753ad81ea03e4681..b2025d18527c625981fd7a66eface0897f93ba05 100644 |
--- a/components/cast_certificate/cast_crl.cc |
+++ b/components/cast_certificate/cast_crl.cc |
@@ -57,18 +57,22 @@ class CastCRLTrustStore { |
static net::TrustStore& Get() { return GetInstance()->store_; } |
+ static void Reinitialize() { GetInstance()->Initialize(); } |
+ |
private: |
friend struct base::DefaultSingletonTraits<CastCRLTrustStore>; |
- CastCRLTrustStore() { |
+ CastCRLTrustStore() { Initialize(); } |
+ |
+ void Initialize() { |
+ store_.Clear(); |
// Initialize the trust store with the root certificate. |
- // TODO(ryanchung): Add official Cast CRL Root here |
- // scoped_refptr<net::ParsedCertificate> root = net::ParsedCertificate:: |
- // net::ParsedCertificate::CreateFromCertificateData( |
- // kCastCRLRootCaDer, sizeof(kCastCRLRootCaDer), |
- // net::ParsedCertificate::DataSource::EXTERNAL_REFERENCE, {}); |
- // CHECK(root); |
- // store_.AddTrustedCertificate(std::move(root)); |
+ scoped_refptr<net::ParsedCertificate> root = |
+ net::ParsedCertificate::CreateFromCertificateData( |
+ kCastCRLRootCaDer, sizeof(kCastCRLRootCaDer), |
+ net::ParsedCertificate::DataSource::EXTERNAL_REFERENCE, {}); |
+ CHECK(root); |
+ store_.AddTrustedCertificate(std::move(root)); |
} |
net::TrustStore store_; |
@@ -337,4 +341,8 @@ bool SetCRLTrustAnchorForTest(const std::string& cert) { |
return true; |
} |
+void ResetCRLTrustAnchorForTest() { |
+ CastCRLTrustStore::Reinitialize(); |
+} |
+ |
} // namespace cast_certificate |