OLD | NEW |
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 "blimp/net/exact_match_cert_verifier.h" | 5 #include "blimp/net/exact_match_cert_verifier.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 engine_cert_hashes_.push_back(net::HashValue(sha1_hash)); | 26 engine_cert_hashes_.push_back(net::HashValue(sha1_hash)); |
27 | 27 |
28 net::SHA256HashValue sha256_hash; | 28 net::SHA256HashValue sha256_hash; |
29 sha256_hash = net::X509Certificate::CalculateFingerprint256( | 29 sha256_hash = net::X509Certificate::CalculateFingerprint256( |
30 engine_cert_->os_cert_handle()); | 30 engine_cert_->os_cert_handle()); |
31 engine_cert_hashes_.push_back(net::HashValue(sha256_hash)); | 31 engine_cert_hashes_.push_back(net::HashValue(sha256_hash)); |
32 } | 32 } |
33 | 33 |
34 ExactMatchCertVerifier::~ExactMatchCertVerifier() {} | 34 ExactMatchCertVerifier::~ExactMatchCertVerifier() {} |
35 | 35 |
36 int ExactMatchCertVerifier::Verify(net::X509Certificate* cert, | 36 int ExactMatchCertVerifier::Verify( |
37 const std::string& hostname, | 37 const net::CertVerifier::RequestParams& params, |
38 const std::string& ocsp_response, | 38 net::CRLSet* crl_set, |
39 int flags, | 39 net::CertVerifyResult* verify_result, |
40 net::CRLSet* crl_set, | 40 const net::CompletionCallback& callback, |
41 net::CertVerifyResult* verify_result, | 41 std::unique_ptr<Request>* out_req, |
42 const net::CompletionCallback& callback, | 42 const net::BoundNetLog& net_log) { |
43 std::unique_ptr<Request>* out_req, | |
44 const net::BoundNetLog& net_log) { | |
45 verify_result->Reset(); | 43 verify_result->Reset(); |
46 verify_result->verified_cert = engine_cert_; | 44 verify_result->verified_cert = engine_cert_; |
47 | 45 |
48 if (!cert->Equals(engine_cert_.get())) { | 46 if (!params.certificate()->Equals(engine_cert_.get())) { |
49 verify_result->cert_status = net::CERT_STATUS_INVALID; | 47 verify_result->cert_status = net::CERT_STATUS_INVALID; |
50 return net::ERR_CERT_INVALID; | 48 return net::ERR_CERT_INVALID; |
51 } | 49 } |
52 | 50 |
53 verify_result->public_key_hashes = engine_cert_hashes_; | 51 verify_result->public_key_hashes = engine_cert_hashes_; |
54 return net::OK; | 52 return net::OK; |
55 } | 53 } |
56 | 54 |
57 } // namespace blimp | 55 } // namespace blimp |
OLD | NEW |