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

Side by Side Diff: components/cast_certificate/cast_crl.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
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"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
13 #include "components/cast_certificate/proto/revocation.pb.h" 13 #include "components/cast_certificate/proto/revocation.pb.h"
14 #include "crypto/sha2.h" 14 #include "crypto/sha2.h"
15 #include "net/cert/internal/parse_certificate.h" 15 #include "net/cert/internal/parse_certificate.h"
16 #include "net/cert/internal/parsed_certificate.h" 16 #include "net/cert/internal/parsed_certificate.h"
17 #include "net/cert/internal/path_builder.h" 17 #include "net/cert/internal/path_builder.h"
18 #include "net/cert/internal/signature_algorithm.h" 18 #include "net/cert/internal/signature_algorithm.h"
19 #include "net/cert/internal/signature_policy.h" 19 #include "net/cert/internal/signature_policy.h"
20 #include "net/cert/internal/trust_store.h" 20 #include "net/cert/internal/trust_store_static.h"
21 #include "net/cert/internal/verify_certificate_chain.h" 21 #include "net/cert/internal/verify_certificate_chain.h"
22 #include "net/cert/internal/verify_signed_data.h" 22 #include "net/cert/internal/verify_signed_data.h"
23 #include "net/cert/x509_certificate.h" 23 #include "net/cert/x509_certificate.h"
24 #include "net/der/encode_values.h" 24 #include "net/der/encode_values.h"
25 #include "net/der/input.h" 25 #include "net/der/input.h"
26 #include "net/der/parser.h" 26 #include "net/der/parser.h"
27 #include "net/der/parse_values.h" 27 #include "net/der/parse_values.h"
28 28
29 namespace cast_certificate { 29 namespace cast_certificate {
30 namespace { 30 namespace {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // TODO(crbug.com/635200): Support anchor constraints, and initialize the
71 // anchor using constraints from the self-signed certificate. 71 // anchor using constraints from the self-signed certificate.
72 scoped_refptr<net::TrustAnchor> anchor = 72 scoped_refptr<net::TrustAnchor> anchor =
73 net::TrustAnchor::CreateFromCertificateNoConstraints(std::move(cert)); 73 net::TrustAnchor::CreateFromCertificateNoConstraints(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::TrustStore store_; 78 net::TrustStoreStatic store_;
79 DISALLOW_COPY_AND_ASSIGN(CastCRLTrustStore); 79 DISALLOW_COPY_AND_ASSIGN(CastCRLTrustStore);
80 }; 80 };
81 81
82 // Converts a uint64_t unix timestamp to net::der::GeneralizedTime. 82 // Converts a uint64_t unix timestamp to net::der::GeneralizedTime.
83 bool ConvertTimeSeconds(uint64_t seconds, 83 bool ConvertTimeSeconds(uint64_t seconds,
84 net::der::GeneralizedTime* generalized_time) { 84 net::der::GeneralizedTime* generalized_time) {
85 base::Time unix_timestamp = 85 base::Time unix_timestamp =
86 base::Time::UnixEpoch() + 86 base::Time::UnixEpoch() +
87 base::TimeDelta::FromSeconds(base::saturated_cast<int64_t>(seconds)); 87 base::TimeDelta::FromSeconds(base::saturated_cast<int64_t>(seconds));
88 return net::der::EncodeTimeAsGeneralizedTime(unix_timestamp, 88 return net::der::EncodeTimeAsGeneralizedTime(unix_timestamp,
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 } 353 }
354 354
355 std::unique_ptr<CastCRL> ParseAndVerifyCRLForTest( 355 std::unique_ptr<CastCRL> ParseAndVerifyCRLForTest(
356 const std::string& crl_proto, 356 const std::string& crl_proto,
357 const base::Time& time, 357 const base::Time& time,
358 net::TrustStore* trust_store) { 358 net::TrustStore* trust_store) {
359 return ParseAndVerifyCRL(crl_proto, time, trust_store); 359 return ParseAndVerifyCRL(crl_proto, time, trust_store);
360 } 360 }
361 361
362 } // namespace cast_certificate 362 } // namespace cast_certificate
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698