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

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

Issue 2225493003: Don't treat trust anchors as certificates during path building. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix components_unittests compile (hopefully) 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_cert_validator.h" 5 #include "components/cast_certificate/cast_cert_validator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 CastTrustStore() { 61 CastTrustStore() {
62 AddAnchor(kCastRootCaDer); 62 AddAnchor(kCastRootCaDer);
63 AddAnchor(kEurekaRootCaDer); 63 AddAnchor(kEurekaRootCaDer);
64 } 64 }
65 65
66 // Adds a trust anchor given a DER-encoded certificate from static 66 // Adds a trust anchor given a DER-encoded certificate from static
67 // storage. 67 // storage.
68 template <size_t N> 68 template <size_t N>
69 void AddAnchor(const uint8_t (&data)[N]) { 69 void AddAnchor(const uint8_t (&data)[N]) {
70 scoped_refptr<net::ParsedCertificate> root = 70 scoped_refptr<net::ParsedCertificate> cert =
71 net::ParsedCertificate::CreateFromCertificateData( 71 net::ParsedCertificate::CreateFromCertificateData(
72 data, N, net::ParsedCertificate::DataSource::EXTERNAL_REFERENCE, 72 data, N, net::ParsedCertificate::DataSource::EXTERNAL_REFERENCE,
73 {}); 73 {});
74 CHECK(root); 74 CHECK(cert);
75 store_.AddTrustedCertificate(std::move(root)); 75 // TODO(crbug.com/635200): Support anchor constraints.
76 auto anchor =
mattm 2016/08/09 00:59:21 I think using auto for these Foo::Create calls don
eroman 2016/08/09 01:37:20 Done.
mattm 2016/08/09 19:51:04 There are a few in other files too (cast_crl.cc, c
eroman 2016/08/09 23:42:07 Done.
77 net::TrustAnchor::CreateFromCertificateNoConstraints(std::move(cert));
78 store_.AddTrustAnchor(std::move(anchor));
76 } 79 }
77 80
78 net::TrustStore store_; 81 net::TrustStore store_;
79 DISALLOW_COPY_AND_ASSIGN(CastTrustStore); 82 DISALLOW_COPY_AND_ASSIGN(CastTrustStore);
80 }; 83 };
81 84
82 using ExtensionsMap = std::map<net::der::Input, net::ParsedExtension>; 85 using ExtensionsMap = std::map<net::der::Input, net::ParsedExtension>;
83 86
84 // Helper that looks up an extension by OID given a map of extensions. 87 // Helper that looks up an extension by OID given a map of extensions.
85 bool GetExtensionValue(const ExtensionsMap& extensions, 88 bool GetExtensionValue(const ExtensionsMap& extensions,
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 350
348 std::unique_ptr<CertVerificationContext> CertVerificationContextImplForTest( 351 std::unique_ptr<CertVerificationContext> CertVerificationContextImplForTest(
349 const base::StringPiece& spki) { 352 const base::StringPiece& spki) {
350 // Use a bogus CommonName, since this is just exposed for testing signature 353 // Use a bogus CommonName, since this is just exposed for testing signature
351 // verification by unittests. 354 // verification by unittests.
352 return base::WrapUnique( 355 return base::WrapUnique(
353 new CertVerificationContextImpl(net::der::Input(spki), "CommonName")); 356 new CertVerificationContextImpl(net::der::Input(spki), "CommonName"));
354 } 357 }
355 358
356 } // namespace cast_certificate 359 } // namespace cast_certificate
OLDNEW
« no previous file with comments | « no previous file | components/cast_certificate/cast_crl.h » ('j') | net/cert/internal/path_builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698