| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "net/quic/test_tools/crypto_test_utils.h" | 5 #include "net/quic/test_tools/crypto_test_utils.h" |
| 6 | 6 |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "net/base/test_data_directory.h" | 9 #include "net/base/test_data_directory.h" |
| 10 #include "net/cert/cert_verifier.h" | 10 #include "net/cert/cert_verifier.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 certs_[0] = kLeafCert; | 52 certs_[0] = kLeafCert; |
| 53 certs_[1] = kIntermediateCert; | 53 certs_[1] = kIntermediateCert; |
| 54 } | 54 } |
| 55 virtual ~FakeProofSource() {} | 55 virtual ~FakeProofSource() {} |
| 56 | 56 |
| 57 // ProofSource interface | 57 // ProofSource interface |
| 58 virtual bool GetProof(const std::string& hostname, | 58 virtual bool GetProof(const std::string& hostname, |
| 59 const std::string& server_config, | 59 const std::string& server_config, |
| 60 bool ecdsa_ok, | 60 bool ecdsa_ok, |
| 61 const std::vector<std::string>** out_certs, | 61 const std::vector<std::string>** out_certs, |
| 62 std::string* out_signature) OVERRIDE { | 62 std::string* out_signature) override { |
| 63 *out_certs = &certs_; | 63 *out_certs = &certs_; |
| 64 *out_signature = kSignature; | 64 *out_signature = kSignature; |
| 65 return true; | 65 return true; |
| 66 } | 66 } |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 std::vector<std::string> certs_; | 69 std::vector<std::string> certs_; |
| 70 DISALLOW_COPY_AND_ASSIGN(FakeProofSource); | 70 DISALLOW_COPY_AND_ASSIGN(FakeProofSource); |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 class FakeProofVerifier : public ProofVerifier { | 73 class FakeProofVerifier : public ProofVerifier { |
| 74 public: | 74 public: |
| 75 FakeProofVerifier() {} | 75 FakeProofVerifier() {} |
| 76 virtual ~FakeProofVerifier() {} | 76 virtual ~FakeProofVerifier() {} |
| 77 | 77 |
| 78 // ProofVerifier interface | 78 // ProofVerifier interface |
| 79 virtual QuicAsyncStatus VerifyProof( | 79 virtual QuicAsyncStatus VerifyProof( |
| 80 const std::string& hostname, | 80 const std::string& hostname, |
| 81 const std::string& server_config, | 81 const std::string& server_config, |
| 82 const std::vector<std::string>& certs, | 82 const std::vector<std::string>& certs, |
| 83 const std::string& signature, | 83 const std::string& signature, |
| 84 const ProofVerifyContext* verify_context, | 84 const ProofVerifyContext* verify_context, |
| 85 std::string* error_details, | 85 std::string* error_details, |
| 86 scoped_ptr<ProofVerifyDetails>* verify_details, | 86 scoped_ptr<ProofVerifyDetails>* verify_details, |
| 87 ProofVerifierCallback* callback) OVERRIDE { | 87 ProofVerifierCallback* callback) override { |
| 88 error_details->clear(); | 88 error_details->clear(); |
| 89 scoped_ptr<ProofVerifyDetailsChromium> verify_details_chromium( | 89 scoped_ptr<ProofVerifyDetailsChromium> verify_details_chromium( |
| 90 new ProofVerifyDetailsChromium); | 90 new ProofVerifyDetailsChromium); |
| 91 if (certs.size() != 2 || certs[0] != kLeafCert || | 91 if (certs.size() != 2 || certs[0] != kLeafCert || |
| 92 certs[1] != kIntermediateCert || signature != kSignature) { | 92 certs[1] != kIntermediateCert || signature != kSignature) { |
| 93 *error_details = "Invalid proof"; | 93 *error_details = "Invalid proof"; |
| 94 verify_details_chromium->cert_verify_result.cert_status = | 94 verify_details_chromium->cert_verify_result.cert_status = |
| 95 CERT_STATUS_INVALID; | 95 CERT_STATUS_INVALID; |
| 96 *verify_details = verify_details_chromium.Pass(); | 96 *verify_details = verify_details_chromium.Pass(); |
| 97 return QUIC_FAILURE; | 97 return QUIC_FAILURE; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 } | 136 } |
| 137 | 137 |
| 138 // static | 138 // static |
| 139 ProofVerifyContext* CryptoTestUtils::FakeProofVerifyContextForTesting() { | 139 ProofVerifyContext* CryptoTestUtils::FakeProofVerifyContextForTesting() { |
| 140 return nullptr; | 140 return nullptr; |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace test | 143 } // namespace test |
| 144 | 144 |
| 145 } // namespace net | 145 } // namespace net |
| OLD | NEW |