| 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 private: | 60 private: |
| 61 friend struct base::DefaultSingletonTraits<CastCRLTrustStore>; | 61 friend struct base::DefaultSingletonTraits<CastCRLTrustStore>; |
| 62 | 62 |
| 63 CastCRLTrustStore() { | 63 CastCRLTrustStore() { |
| 64 // Initialize the trust store with the root certificate. | 64 // Initialize the trust store with the root certificate. |
| 65 scoped_refptr<net::ParsedCertificate> cert = | 65 scoped_refptr<net::ParsedCertificate> cert = |
| 66 net::ParsedCertificate::CreateFromCertificateData( | 66 net::ParsedCertificate::CreateFromCertificateData( |
| 67 kCastCRLRootCaDer, sizeof(kCastCRLRootCaDer), | 67 kCastCRLRootCaDer, sizeof(kCastCRLRootCaDer), |
| 68 net::ParsedCertificate::DataSource::EXTERNAL_REFERENCE, {}); | 68 net::ParsedCertificate::DataSource::EXTERNAL_REFERENCE, {}); |
| 69 CHECK(cert); | 69 CHECK(cert); |
| 70 // TODO(crbug.com/635200): Support anchor constraints, and initialize the | 70 // Enforce pathlen constraints and policies defined on the root certificate. |
| 71 // anchor using constraints from the self-signed certificate. | |
| 72 scoped_refptr<net::TrustAnchor> anchor = | 71 scoped_refptr<net::TrustAnchor> anchor = |
| 73 net::TrustAnchor::CreateFromCertificateNoConstraints(std::move(cert)); | 72 net::TrustAnchor::CreateFromCertificateWithConstraints(std::move(cert)); |
| 74 CHECK(anchor); | 73 CHECK(anchor); |
| 75 store_.AddTrustAnchor(std::move(anchor)); | 74 store_.AddTrustAnchor(std::move(anchor)); |
| 76 } | 75 } |
| 77 | 76 |
| 78 net::TrustStore store_; | 77 net::TrustStore store_; |
| 79 DISALLOW_COPY_AND_ASSIGN(CastCRLTrustStore); | 78 DISALLOW_COPY_AND_ASSIGN(CastCRLTrustStore); |
| 80 }; | 79 }; |
| 81 | 80 |
| 82 // Converts a uint64_t unix timestamp to net::der::GeneralizedTime. | 81 // Converts a uint64_t unix timestamp to net::der::GeneralizedTime. |
| 83 bool ConvertTimeSeconds(uint64_t seconds, | 82 bool ConvertTimeSeconds(uint64_t seconds, |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 } | 352 } |
| 354 | 353 |
| 355 std::unique_ptr<CastCRL> ParseAndVerifyCRLForTest( | 354 std::unique_ptr<CastCRL> ParseAndVerifyCRLForTest( |
| 356 const std::string& crl_proto, | 355 const std::string& crl_proto, |
| 357 const base::Time& time, | 356 const base::Time& time, |
| 358 net::TrustStore* trust_store) { | 357 net::TrustStore* trust_store) { |
| 359 return ParseAndVerifyCRL(crl_proto, time, trust_store); | 358 return ParseAndVerifyCRL(crl_proto, time, trust_store); |
| 360 } | 359 } |
| 361 | 360 |
| 362 } // namespace cast_certificate | 361 } // namespace cast_certificate |
| OLD | NEW |