| OLD | NEW |
| 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_crl.h" | 5 #include "components/cast_certificate/cast_crl.h" |
| 6 | 6 |
| 7 #include <unordered_map> | 7 #include <unordered_map> |
| 8 #include <unordered_set> | 8 #include <unordered_set> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 friend struct base::DefaultSingletonTraits<CastCRLTrustStore>; | 62 friend struct base::DefaultSingletonTraits<CastCRLTrustStore>; |
| 63 | 63 |
| 64 CastCRLTrustStore() { | 64 CastCRLTrustStore() { |
| 65 // Initialize the trust store with the root certificate. | 65 // Initialize the trust store with the root certificate. |
| 66 net::CertErrors errors; | 66 net::CertErrors errors; |
| 67 scoped_refptr<net::ParsedCertificate> cert = | 67 scoped_refptr<net::ParsedCertificate> cert = |
| 68 net::ParsedCertificate::CreateWithoutCopyingUnsafe( | 68 net::ParsedCertificate::CreateWithoutCopyingUnsafe( |
| 69 kCastCRLRootCaDer, sizeof(kCastCRLRootCaDer), {}, &errors); | 69 kCastCRLRootCaDer, sizeof(kCastCRLRootCaDer), {}, &errors); |
| 70 CHECK(cert) << errors.ToDebugString(); | 70 CHECK(cert); |
| 71 // Enforce pathlen constraints and policies defined on the root certificate. | 71 // Enforce pathlen constraints and policies defined on the root certificate. |
| 72 scoped_refptr<net::TrustAnchor> anchor = | 72 scoped_refptr<net::TrustAnchor> anchor = |
| 73 net::TrustAnchor::CreateFromCertificateWithConstraints(std::move(cert)); | 73 net::TrustAnchor::CreateFromCertificateWithConstraints(std::move(cert)); |
| 74 CHECK(anchor); | 74 CHECK(anchor); |
| 75 store_.AddTrustAnchor(std::move(anchor)); | 75 store_.AddTrustAnchor(std::move(anchor)); |
| 76 } | 76 } |
| 77 | 77 |
| 78 net::TrustStoreInMemory store_; | 78 net::TrustStoreInMemory store_; |
| 79 DISALLOW_COPY_AND_ASSIGN(CastCRLTrustStore); | 79 DISALLOW_COPY_AND_ASSIGN(CastCRLTrustStore); |
| 80 }; | 80 }; |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 LOG(ERROR) << "CRL - Verification failed."; | 349 LOG(ERROR) << "CRL - Verification failed."; |
| 350 return nullptr; | 350 return nullptr; |
| 351 } | 351 } |
| 352 return base::MakeUnique<CastCRLImpl>(tbs_crl, overall_not_after); | 352 return base::MakeUnique<CastCRLImpl>(tbs_crl, overall_not_after); |
| 353 } | 353 } |
| 354 LOG(ERROR) << "No supported version of revocation data."; | 354 LOG(ERROR) << "No supported version of revocation data."; |
| 355 return nullptr; | 355 return nullptr; |
| 356 } | 356 } |
| 357 | 357 |
| 358 } // namespace cast_certificate | 358 } // namespace cast_certificate |
| OLD | NEW |