OLD | NEW |
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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 // Do path building and RFC 5280 compatible certificate verification using the | 303 // Do path building and RFC 5280 compatible certificate verification using the |
304 // two Cast trust anchors and Cast signature policy. | 304 // two Cast trust anchors and Cast signature policy. |
305 net::der::GeneralizedTime verification_time; | 305 net::der::GeneralizedTime verification_time; |
306 if (!net::der::EncodeTimeAsGeneralizedTime(time, &verification_time)) | 306 if (!net::der::EncodeTimeAsGeneralizedTime(time, &verification_time)) |
307 return false; | 307 return false; |
308 net::CertPathBuilder::Result result; | 308 net::CertPathBuilder::Result result; |
309 net::CertPathBuilder path_builder(target_cert.get(), trust_store, | 309 net::CertPathBuilder path_builder(target_cert.get(), trust_store, |
310 signature_policy.get(), verification_time, | 310 signature_policy.get(), verification_time, |
311 &result); | 311 &result); |
312 path_builder.AddCertIssuerSource(&intermediate_cert_issuer_source); | 312 path_builder.AddCertIssuerSource(&intermediate_cert_issuer_source); |
313 net::CompletionStatus rv = path_builder.Run(base::Closure()); | 313 path_builder.Run(); |
314 DCHECK_EQ(rv, net::CompletionStatus::SYNC); | |
315 if (!result.HasValidPath()) { | 314 if (!result.HasValidPath()) { |
316 // TODO(crbug.com/634443): Log error information. | 315 // TODO(crbug.com/634443): Log error information. |
317 return false; | 316 return false; |
318 } | 317 } |
319 | 318 |
320 // Check properties of the leaf certificate (key usage, policy), and construct | 319 // Check properties of the leaf certificate (key usage, policy), and construct |
321 // a CertVerificationContext that uses its public key. | 320 // a CertVerificationContext that uses its public key. |
322 if (!CheckTargetCertificate(target_cert.get(), context, policy)) | 321 if (!CheckTargetCertificate(target_cert.get(), context, policy)) |
323 return false; | 322 return false; |
324 | 323 |
(...skipping 12 matching lines...) Expand all Loading... |
337 | 336 |
338 std::unique_ptr<CertVerificationContext> CertVerificationContextImplForTest( | 337 std::unique_ptr<CertVerificationContext> CertVerificationContextImplForTest( |
339 const base::StringPiece& spki) { | 338 const base::StringPiece& spki) { |
340 // Use a bogus CommonName, since this is just exposed for testing signature | 339 // Use a bogus CommonName, since this is just exposed for testing signature |
341 // verification by unittests. | 340 // verification by unittests. |
342 return base::MakeUnique<CertVerificationContextImpl>(net::der::Input(spki), | 341 return base::MakeUnique<CertVerificationContextImpl>(net::der::Input(spki), |
343 "CommonName"); | 342 "CommonName"); |
344 } | 343 } |
345 | 344 |
346 } // namespace cast_certificate | 345 } // namespace cast_certificate |
OLD | NEW |