[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef NET_QUIC_CRYPTO_PROOF_VERIFIER_CHROMIUM_H_ |
| 6 | #define NET_QUIC_CRYPTO_PROOF_VERIFIER_CHROMIUM_H_ |
| 7 | |
[email protected] | 5c78ce6 | 2014-03-13 19:48:01 | [diff] [blame] | 8 | #include <set> |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 9 | #include <string> |
| 10 | #include <vector> |
| 11 | |
| 12 | #include "base/basictypes.h" |
| 13 | #include "base/compiler_specific.h" |
| 14 | #include "base/memory/scoped_ptr.h" |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 15 | #include "net/base/net_export.h" |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 16 | #include "net/cert/cert_verify_result.h" |
[email protected] | c817c67 | 2014-03-21 22:25:34 | [diff] [blame] | 17 | #include "net/cert/x509_certificate.h" |
eroman | 87c53d6 | 2015-04-02 06:51:07 | [diff] [blame] | 18 | #include "net/log/net_log.h" |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 19 | #include "net/quic/crypto/proof_verifier.h" |
| 20 | |
| 21 | namespace net { |
| 22 | |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 23 | class CertVerifier; |
[email protected] | 080b7793 | 2014-08-04 01:22:46 | [diff] [blame] | 24 | class TransportSecurityState; |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 25 | |
[email protected] | 72e6599 | 2013-07-30 17:16:14 | [diff] [blame] | 26 | // ProofVerifyDetailsChromium is the implementation-specific information that a |
| 27 | // ProofVerifierChromium returns about a certificate verification. |
[email protected] | 92bc621d | 2014-07-29 21:42:13 | [diff] [blame] | 28 | class NET_EXPORT_PRIVATE ProofVerifyDetailsChromium |
| 29 | : public ProofVerifyDetails { |
[email protected] | 72e6599 | 2013-07-30 17:16:14 | [diff] [blame] | 30 | public: |
[email protected] | 92bc621d | 2014-07-29 21:42:13 | [diff] [blame] | 31 | |
| 32 | // ProofVerifyDetails implementation |
dcheng | b03027d | 2014-10-21 12:00:20 | [diff] [blame] | 33 | ProofVerifyDetails* Clone() const override; |
[email protected] | 92bc621d | 2014-07-29 21:42:13 | [diff] [blame] | 34 | |
[email protected] | 72e6599 | 2013-07-30 17:16:14 | [diff] [blame] | 35 | CertVerifyResult cert_verify_result; |
[email protected] | 080b7793 | 2014-08-04 01:22:46 | [diff] [blame] | 36 | |
| 37 | // pinning_failure_log contains a message produced by |
martijn | c0d6b62 | 2015-06-30 19:14:40 | [diff] [blame^] | 38 | // TransportSecurityState::PKPState::CheckPublicKeyPins in the event of a |
[email protected] | 080b7793 | 2014-08-04 01:22:46 | [diff] [blame] | 39 | // pinning failure. It is a (somewhat) human-readable string. |
| 40 | std::string pinning_failure_log; |
[email protected] | 72e6599 | 2013-07-30 17:16:14 | [diff] [blame] | 41 | }; |
| 42 | |
[email protected] | c817c67 | 2014-03-21 22:25:34 | [diff] [blame] | 43 | // ProofVerifyContextChromium is the implementation-specific information that a |
| 44 | // ProofVerifierChromium needs in order to log correctly. |
| 45 | struct ProofVerifyContextChromium : public ProofVerifyContext { |
| 46 | public: |
rtenneti | a75df62 | 2015-06-21 23:59:50 | [diff] [blame] | 47 | ProofVerifyContextChromium(int cert_verify_flags, const BoundNetLog& net_log) |
| 48 | : cert_verify_flags(cert_verify_flags), net_log(net_log) {} |
[email protected] | c817c67 | 2014-03-21 22:25:34 | [diff] [blame] | 49 | |
rtenneti | a75df62 | 2015-06-21 23:59:50 | [diff] [blame] | 50 | int cert_verify_flags; |
[email protected] | c817c67 | 2014-03-21 22:25:34 | [diff] [blame] | 51 | BoundNetLog net_log; |
| 52 | }; |
| 53 | |
[email protected] | 5c78ce6 | 2014-03-13 19:48:01 | [diff] [blame] | 54 | // ProofVerifierChromium implements the QUIC ProofVerifier interface. It is |
| 55 | // capable of handling multiple simultaneous requests. |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 56 | class NET_EXPORT_PRIVATE ProofVerifierChromium : public ProofVerifier { |
| 57 | public: |
[email protected] | 080b7793 | 2014-08-04 01:22:46 | [diff] [blame] | 58 | ProofVerifierChromium(CertVerifier* cert_verifier, |
| 59 | TransportSecurityState* transport_security_state); |
dcheng | b03027d | 2014-10-21 12:00:20 | [diff] [blame] | 60 | ~ProofVerifierChromium() override; |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 61 | |
| 62 | // ProofVerifier interface |
dcheng | b03027d | 2014-10-21 12:00:20 | [diff] [blame] | 63 | QuicAsyncStatus VerifyProof(const std::string& hostname, |
| 64 | const std::string& server_config, |
| 65 | const std::vector<std::string>& certs, |
| 66 | const std::string& signature, |
| 67 | const ProofVerifyContext* verify_context, |
| 68 | std::string* error_details, |
| 69 | scoped_ptr<ProofVerifyDetails>* verify_details, |
| 70 | ProofVerifierCallback* callback) override; |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 71 | |
| 72 | private: |
[email protected] | 5c78ce6 | 2014-03-13 19:48:01 | [diff] [blame] | 73 | class Job; |
[email protected] | 0cceb92 | 2014-07-01 02:00:56 | [diff] [blame] | 74 | typedef std::set<Job*> JobSet; |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 75 | |
[email protected] | 5c78ce6 | 2014-03-13 19:48:01 | [diff] [blame] | 76 | void OnJobComplete(Job* job); |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 77 | |
[email protected] | 5c78ce6 | 2014-03-13 19:48:01 | [diff] [blame] | 78 | // Set owning pointers to active jobs. |
[email protected] | 5c78ce6 | 2014-03-13 19:48:01 | [diff] [blame] | 79 | JobSet active_jobs_; |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 80 | |
[email protected] | 5c78ce6 | 2014-03-13 19:48:01 | [diff] [blame] | 81 | // Underlying verifier used to verify certificates. |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 82 | CertVerifier* const cert_verifier_; |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 83 | |
[email protected] | 2bfa5cf | 2014-08-21 01:24:51 | [diff] [blame] | 84 | TransportSecurityState* const transport_security_state_; |
[email protected] | 080b7793 | 2014-08-04 01:22:46 | [diff] [blame] | 85 | |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 86 | DISALLOW_COPY_AND_ASSIGN(ProofVerifierChromium); |
| 87 | }; |
| 88 | |
| 89 | } // namespace net |
| 90 | |
| 91 | #endif // NET_QUIC_CRYPTO_PROOF_VERIFIER_CHROMIUM_H_ |