[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 | |
danakj | ad1777e | 2016-04-16 00:56:42 | [diff] [blame] | 8 | #include <memory> |
[email protected] | 5c78ce6 | 2014-03-13 19:48:01 | [diff] [blame] | 9 | #include <set> |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 10 | #include <string> |
| 11 | #include <vector> |
| 12 | |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 13 | #include "base/compiler_specific.h" |
Avi Drissman | 13fc893 | 2015-12-20 04:40:46 | [diff] [blame] | 14 | #include "base/macros.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" |
rtenneti | 052774e | 2015-11-24 21:00:12 | [diff] [blame] | 17 | #include "net/cert/ct_verify_result.h" |
[email protected] | c817c67 | 2014-03-21 22:25:34 | [diff] [blame] | 18 | #include "net/cert/x509_certificate.h" |
eroman | 87c53d6 | 2015-04-02 06:51:07 | [diff] [blame] | 19 | #include "net/log/net_log.h" |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 20 | #include "net/quic/crypto/proof_verifier.h" |
| 21 | |
| 22 | namespace net { |
| 23 | |
estark | 6f9b3d8 | 2016-01-12 21:37:05 | [diff] [blame] | 24 | class CTPolicyEnforcer; |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 25 | class CertVerifier; |
rtenneti | 052774e | 2015-11-24 21:00:12 | [diff] [blame] | 26 | class CTVerifier; |
[email protected] | 080b7793 | 2014-08-04 01:22:46 | [diff] [blame] | 27 | class TransportSecurityState; |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 28 | |
[email protected] | 72e6599 | 2013-07-30 17:16:14 | [diff] [blame] | 29 | // ProofVerifyDetailsChromium is the implementation-specific information that a |
| 30 | // ProofVerifierChromium returns about a certificate verification. |
[email protected] | 92bc621d | 2014-07-29 21:42:13 | [diff] [blame] | 31 | class NET_EXPORT_PRIVATE ProofVerifyDetailsChromium |
| 32 | : public ProofVerifyDetails { |
[email protected] | 72e6599 | 2013-07-30 17:16:14 | [diff] [blame] | 33 | public: |
dadrian | df302c4 | 2016-06-10 18:48:59 | [diff] [blame^] | 34 | ProofVerifyDetailsChromium(); |
| 35 | ProofVerifyDetailsChromium(const ProofVerifyDetailsChromium&); |
| 36 | ~ProofVerifyDetailsChromium() override; |
| 37 | |
[email protected] | 92bc621d | 2014-07-29 21:42:13 | [diff] [blame] | 38 | // ProofVerifyDetails implementation |
dcheng | b03027d | 2014-10-21 12:00:20 | [diff] [blame] | 39 | ProofVerifyDetails* Clone() const override; |
[email protected] | 92bc621d | 2014-07-29 21:42:13 | [diff] [blame] | 40 | |
[email protected] | 72e6599 | 2013-07-30 17:16:14 | [diff] [blame] | 41 | CertVerifyResult cert_verify_result; |
rtenneti | 052774e | 2015-11-24 21:00:12 | [diff] [blame] | 42 | ct::CTVerifyResult ct_verify_result; |
[email protected] | 080b7793 | 2014-08-04 01:22:46 | [diff] [blame] | 43 | |
| 44 | // pinning_failure_log contains a message produced by |
martijn | c0d6b62 | 2015-06-30 19:14:40 | [diff] [blame] | 45 | // TransportSecurityState::PKPState::CheckPublicKeyPins in the event of a |
[email protected] | 080b7793 | 2014-08-04 01:22:46 | [diff] [blame] | 46 | // pinning failure. It is a (somewhat) human-readable string. |
| 47 | std::string pinning_failure_log; |
dadrian | df302c4 | 2016-06-10 18:48:59 | [diff] [blame^] | 48 | |
| 49 | // True if PKP was bypassed due to a local trust anchor. |
| 50 | bool pkp_bypassed; |
[email protected] | 72e6599 | 2013-07-30 17:16:14 | [diff] [blame] | 51 | }; |
| 52 | |
[email protected] | c817c67 | 2014-03-21 22:25:34 | [diff] [blame] | 53 | // ProofVerifyContextChromium is the implementation-specific information that a |
| 54 | // ProofVerifierChromium needs in order to log correctly. |
| 55 | struct ProofVerifyContextChromium : public ProofVerifyContext { |
| 56 | public: |
rtenneti | a75df62 | 2015-06-21 23:59:50 | [diff] [blame] | 57 | ProofVerifyContextChromium(int cert_verify_flags, const BoundNetLog& net_log) |
| 58 | : cert_verify_flags(cert_verify_flags), net_log(net_log) {} |
[email protected] | c817c67 | 2014-03-21 22:25:34 | [diff] [blame] | 59 | |
rtenneti | a75df62 | 2015-06-21 23:59:50 | [diff] [blame] | 60 | int cert_verify_flags; |
[email protected] | c817c67 | 2014-03-21 22:25:34 | [diff] [blame] | 61 | BoundNetLog net_log; |
| 62 | }; |
| 63 | |
[email protected] | 5c78ce6 | 2014-03-13 19:48:01 | [diff] [blame] | 64 | // ProofVerifierChromium implements the QUIC ProofVerifier interface. It is |
| 65 | // capable of handling multiple simultaneous requests. |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 66 | class NET_EXPORT_PRIVATE ProofVerifierChromium : public ProofVerifier { |
| 67 | public: |
[email protected] | 080b7793 | 2014-08-04 01:22:46 | [diff] [blame] | 68 | ProofVerifierChromium(CertVerifier* cert_verifier, |
estark | 6f9b3d8 | 2016-01-12 21:37:05 | [diff] [blame] | 69 | CTPolicyEnforcer* ct_policy_enforcer, |
rtenneti | 052774e | 2015-11-24 21:00:12 | [diff] [blame] | 70 | TransportSecurityState* transport_security_state, |
| 71 | CTVerifier* cert_transparency_verifier); |
dcheng | b03027d | 2014-10-21 12:00:20 | [diff] [blame] | 72 | ~ProofVerifierChromium() override; |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 73 | |
| 74 | // ProofVerifier interface |
danakj | ad1777e | 2016-04-16 00:56:42 | [diff] [blame] | 75 | QuicAsyncStatus VerifyProof( |
| 76 | const std::string& hostname, |
| 77 | const uint16_t port, |
| 78 | const std::string& server_config, |
| 79 | QuicVersion quic_version, |
| 80 | base::StringPiece chlo_hash, |
| 81 | const std::vector<std::string>& certs, |
| 82 | const std::string& cert_sct, |
| 83 | const std::string& signature, |
| 84 | const ProofVerifyContext* verify_context, |
| 85 | std::string* error_details, |
| 86 | std::unique_ptr<ProofVerifyDetails>* verify_details, |
| 87 | ProofVerifierCallback* callback) override; |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 88 | |
| 89 | private: |
[email protected] | 5c78ce6 | 2014-03-13 19:48:01 | [diff] [blame] | 90 | class Job; |
[email protected] | 0cceb92 | 2014-07-01 02:00:56 | [diff] [blame] | 91 | typedef std::set<Job*> JobSet; |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 92 | |
[email protected] | 5c78ce6 | 2014-03-13 19:48:01 | [diff] [blame] | 93 | void OnJobComplete(Job* job); |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 94 | |
[email protected] | 5c78ce6 | 2014-03-13 19:48:01 | [diff] [blame] | 95 | // Set owning pointers to active jobs. |
[email protected] | 5c78ce6 | 2014-03-13 19:48:01 | [diff] [blame] | 96 | JobSet active_jobs_; |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 97 | |
[email protected] | 5c78ce6 | 2014-03-13 19:48:01 | [diff] [blame] | 98 | // Underlying verifier used to verify certificates. |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 99 | CertVerifier* const cert_verifier_; |
estark | 6f9b3d8 | 2016-01-12 21:37:05 | [diff] [blame] | 100 | CTPolicyEnforcer* const ct_policy_enforcer_; |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 101 | |
[email protected] | 2bfa5cf | 2014-08-21 01:24:51 | [diff] [blame] | 102 | TransportSecurityState* const transport_security_state_; |
rtenneti | 052774e | 2015-11-24 21:00:12 | [diff] [blame] | 103 | CTVerifier* const cert_transparency_verifier_; |
[email protected] | 080b7793 | 2014-08-04 01:22:46 | [diff] [blame] | 104 | |
[email protected] | 2662ed56 | 2013-07-03 10:27:46 | [diff] [blame] | 105 | DISALLOW_COPY_AND_ASSIGN(ProofVerifierChromium); |
| 106 | }; |
| 107 | |
| 108 | } // namespace net |
| 109 | |
| 110 | #endif // NET_QUIC_CRYPTO_PROOF_VERIFIER_CHROMIUM_H_ |