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

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

Issue 2252933002: Make TrustStore into an interface, move impl to TrustStoreInMemory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
« no previous file with comments | « no previous file | components/cast_certificate/cast_crl.cc » ('j') | net/cert/internal/trust_store.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
11 #include <memory> 11 #include <memory>
12 #include <utility> 12 #include <utility>
13 13
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/memory/singleton.h" 15 #include "base/memory/singleton.h"
16 #include "net/cert/internal/cert_issuer_source_static.h" 16 #include "net/cert/internal/cert_issuer_source_static.h"
17 #include "components/cast_certificate/cast_crl.h" 17 #include "components/cast_certificate/cast_crl.h"
18 #include "net/cert/internal/certificate_policies.h" 18 #include "net/cert/internal/certificate_policies.h"
19 #include "net/cert/internal/extended_key_usage.h" 19 #include "net/cert/internal/extended_key_usage.h"
20 #include "net/cert/internal/parse_certificate.h" 20 #include "net/cert/internal/parse_certificate.h"
21 #include "net/cert/internal/parse_name.h" 21 #include "net/cert/internal/parse_name.h"
22 #include "net/cert/internal/parsed_certificate.h" 22 #include "net/cert/internal/parsed_certificate.h"
23 #include "net/cert/internal/path_builder.h" 23 #include "net/cert/internal/path_builder.h"
24 #include "net/cert/internal/signature_algorithm.h" 24 #include "net/cert/internal/signature_algorithm.h"
25 #include "net/cert/internal/signature_policy.h" 25 #include "net/cert/internal/signature_policy.h"
26 #include "net/cert/internal/trust_store.h" 26 #include "net/cert/internal/trust_store_static.h"
27 #include "net/cert/internal/verify_signed_data.h" 27 #include "net/cert/internal/verify_signed_data.h"
28 #include "net/der/encode_values.h" 28 #include "net/der/encode_values.h"
29 #include "net/der/input.h" 29 #include "net/der/input.h"
30 30
31 namespace cast_certificate { 31 namespace cast_certificate {
32 namespace { 32 namespace {
33 33
34 // ------------------------------------------------------------------------- 34 // -------------------------------------------------------------------------
35 // Cast trust anchors. 35 // Cast trust anchors.
36 // ------------------------------------------------------------------------- 36 // -------------------------------------------------------------------------
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 data, N, net::ParsedCertificate::DataSource::EXTERNAL_REFERENCE, 72 data, N, net::ParsedCertificate::DataSource::EXTERNAL_REFERENCE,
73 {}); 73 {});
74 CHECK(cert); 74 CHECK(cert);
75 // TODO(crbug.com/635200): Support anchor constraints, and initialize the 75 // TODO(crbug.com/635200): Support anchor constraints, and initialize the
76 // anchor using constraints from the self-signed certificate. 76 // anchor using constraints from the self-signed certificate.
77 scoped_refptr<net::TrustAnchor> anchor = 77 scoped_refptr<net::TrustAnchor> anchor =
78 net::TrustAnchor::CreateFromCertificateNoConstraints(std::move(cert)); 78 net::TrustAnchor::CreateFromCertificateNoConstraints(std::move(cert));
79 store_.AddTrustAnchor(std::move(anchor)); 79 store_.AddTrustAnchor(std::move(anchor));
80 } 80 }
81 81
82 net::TrustStore store_; 82 net::TrustStoreStatic store_;
83 DISALLOW_COPY_AND_ASSIGN(CastTrustStore); 83 DISALLOW_COPY_AND_ASSIGN(CastTrustStore);
84 }; 84 };
85 85
86 using ExtensionsMap = std::map<net::der::Input, net::ParsedExtension>; 86 using ExtensionsMap = std::map<net::der::Input, net::ParsedExtension>;
87 87
88 // Helper that looks up an extension by OID given a map of extensions. 88 // Helper that looks up an extension by OID given a map of extensions.
89 bool GetExtensionValue(const ExtensionsMap& extensions, 89 bool GetExtensionValue(const ExtensionsMap& extensions,
90 const net::der::Input& oid, 90 const net::der::Input& oid,
91 net::der::Input* value) { 91 net::der::Input* value) {
92 auto it = extensions.find(oid); 92 auto it = extensions.find(oid);
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 351
352 std::unique_ptr<CertVerificationContext> CertVerificationContextImplForTest( 352 std::unique_ptr<CertVerificationContext> CertVerificationContextImplForTest(
353 const base::StringPiece& spki) { 353 const base::StringPiece& spki) {
354 // Use a bogus CommonName, since this is just exposed for testing signature 354 // Use a bogus CommonName, since this is just exposed for testing signature
355 // verification by unittests. 355 // verification by unittests.
356 return base::WrapUnique( 356 return base::WrapUnique(
357 new CertVerificationContextImpl(net::der::Input(spki), "CommonName")); 357 new CertVerificationContextImpl(net::der::Input(spki), "CommonName"));
358 } 358 }
359 359
360 } // namespace cast_certificate 360 } // namespace cast_certificate
OLDNEW
« no previous file with comments | « no previous file | components/cast_certificate/cast_crl.cc » ('j') | net/cert/internal/trust_store.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698