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

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: update cast_cert_validator_unittest.cc 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_in_memory.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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Enforce pathlen constraints and policies defined on the root certificate. 70 // Enforce pathlen constraints and policies defined on the root certificate.
71 scoped_refptr<net::TrustAnchor> anchor = 71 scoped_refptr<net::TrustAnchor> anchor =
72 net::TrustAnchor::CreateFromCertificateWithConstraints(std::move(cert)); 72 net::TrustAnchor::CreateFromCertificateWithConstraints(std::move(cert));
73 CHECK(anchor); 73 CHECK(anchor);
74 store_.AddTrustAnchor(std::move(anchor)); 74 store_.AddTrustAnchor(std::move(anchor));
75 } 75 }
76 76
77 net::TrustStore store_; 77 net::TrustStoreInMemory store_;
78 DISALLOW_COPY_AND_ASSIGN(CastCRLTrustStore); 78 DISALLOW_COPY_AND_ASSIGN(CastCRLTrustStore);
79 }; 79 };
80 80
81 // Converts a uint64_t unix timestamp to net::der::GeneralizedTime. 81 // Converts a uint64_t unix timestamp to net::der::GeneralizedTime.
82 bool ConvertTimeSeconds(uint64_t seconds, 82 bool ConvertTimeSeconds(uint64_t seconds,
83 net::der::GeneralizedTime* generalized_time) { 83 net::der::GeneralizedTime* generalized_time) {
84 base::Time unix_timestamp = 84 base::Time unix_timestamp =
85 base::Time::UnixEpoch() + 85 base::Time::UnixEpoch() +
86 base::TimeDelta::FromSeconds(base::saturated_cast<int64_t>(seconds)); 86 base::TimeDelta::FromSeconds(base::saturated_cast<int64_t>(seconds));
87 return net::der::EncodeTimeAsGeneralizedTime(unix_timestamp, 87 return net::der::EncodeTimeAsGeneralizedTime(unix_timestamp,
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 } 352 }
353 353
354 std::unique_ptr<CastCRL> ParseAndVerifyCRLForTest( 354 std::unique_ptr<CastCRL> ParseAndVerifyCRLForTest(
355 const std::string& crl_proto, 355 const std::string& crl_proto,
356 const base::Time& time, 356 const base::Time& time,
357 net::TrustStore* trust_store) { 357 net::TrustStore* trust_store) {
358 return ParseAndVerifyCRL(crl_proto, time, trust_store); 358 return ParseAndVerifyCRL(crl_proto, time, trust_store);
359 } 359 }
360 360
361 } // namespace cast_certificate 361 } // namespace cast_certificate
OLDNEW
« no previous file with comments | « components/cast_certificate/cast_cert_validator_unittest.cc ('k') | components/cast_certificate/cast_crl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698