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

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

Issue 2245643004: Support trust anchor constraints, by specifying them as a certificate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: checkpoint Created 4 years, 4 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_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
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
71 // anchor using constraints from the self-signed certificate.
72 scoped_refptr<net::TrustAnchor> anchor = 70 scoped_refptr<net::TrustAnchor> anchor =
73 net::TrustAnchor::CreateFromCertificateNoConstraints(std::move(cert)); 71 net::TrustAnchor::CreateFromCertificateWithConstraints(std::move(cert));
74 CHECK(anchor); 72 CHECK(anchor);
75 store_.AddTrustAnchor(std::move(anchor)); 73 store_.AddTrustAnchor(std::move(anchor));
76 } 74 }
77 75
78 net::TrustStore store_; 76 net::TrustStore store_;
79 DISALLOW_COPY_AND_ASSIGN(CastCRLTrustStore); 77 DISALLOW_COPY_AND_ASSIGN(CastCRLTrustStore);
80 }; 78 };
81 79
82 // Converts a uint64_t unix timestamp to net::der::GeneralizedTime. 80 // Converts a uint64_t unix timestamp to net::der::GeneralizedTime.
83 bool ConvertTimeSeconds(uint64_t seconds, 81 bool ConvertTimeSeconds(uint64_t seconds,
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 } 351 }
354 352
355 std::unique_ptr<CastCRL> ParseAndVerifyCRLForTest( 353 std::unique_ptr<CastCRL> ParseAndVerifyCRLForTest(
356 const std::string& crl_proto, 354 const std::string& crl_proto,
357 const base::Time& time, 355 const base::Time& time,
358 net::TrustStore* trust_store) { 356 net::TrustStore* trust_store) {
359 return ParseAndVerifyCRL(crl_proto, time, trust_store); 357 return ParseAndVerifyCRL(crl_proto, time, trust_store);
360 } 358 }
361 359
362 } // namespace cast_certificate 360 } // namespace cast_certificate
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698