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

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

Issue 2050983002: Cast device revocation checking. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: For review Created 4 years, 6 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 signature_policy.get(), 291 signature_policy.get(),
292 ConvertExplodedTime(time))) { 292 ConvertExplodedTime(time))) {
293 return false; 293 return false;
294 } 294 }
295 295
296 // Check properties of the leaf certificate (key usage, policy), and construct 296 // Check properties of the leaf certificate (key usage, policy), and construct
297 // a CertVerificationContext that uses its public key. 297 // a CertVerificationContext that uses its public key.
298 return CheckTargetCertificate(input_chain[0].get(), context, policy); 298 return CheckTargetCertificate(input_chain[0].get(), context, policy);
299 } 299 }
300 300
301 const std::string FindCastTrustAnchorByName(const std::string& name) {
302 std::vector<scoped_refptr<net::ParsedCertificate>> matches;
303 CastTrustStore::Get().FindTrustAnchorsByNormalizedName(net::der::Input(&name),
304 &matches);
305 if (matches.empty())
306 return "";
307 return matches[0]->der_cert().AsString();
308 }
309
301 std::unique_ptr<CertVerificationContext> CertVerificationContextImplForTest( 310 std::unique_ptr<CertVerificationContext> CertVerificationContextImplForTest(
302 const base::StringPiece& spki) { 311 const base::StringPiece& spki) {
303 // Use a bogus CommonName, since this is just exposed for testing signature 312 // Use a bogus CommonName, since this is just exposed for testing signature
304 // verification by unittests. 313 // verification by unittests.
305 return base::WrapUnique( 314 return base::WrapUnique(
306 new CertVerificationContextImpl(net::der::Input(spki), "CommonName")); 315 new CertVerificationContextImpl(net::der::Input(spki), "CommonName"));
307 } 316 }
308 317
309 bool AddTrustAnchorForTest(const uint8_t* data, size_t length) { 318 bool AddTrustAnchorForTest(const uint8_t* data, size_t length) {
310 scoped_refptr<net::ParsedCertificate> anchor( 319 scoped_refptr<net::ParsedCertificate> anchor(
311 net::ParsedCertificate::CreateFromCertificateData( 320 net::ParsedCertificate::CreateFromCertificateData(
312 data, length, 321 data, length,
313 net::ParsedCertificate::DataSource::EXTERNAL_REFERENCE)); 322 net::ParsedCertificate::DataSource::EXTERNAL_REFERENCE));
314 if (!anchor) 323 if (!anchor)
315 return false; 324 return false;
316 CastTrustStore::Get().AddTrustedCertificate(std::move(anchor)); 325 CastTrustStore::Get().AddTrustedCertificate(std::move(anchor));
317 return true; 326 return true;
318 } 327 }
319 328
320 } // namespace cast_certificate 329 } // namespace cast_certificate
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698