Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / net / quic / crypto / proof_verifier_chromium.h
blob46d63e16e5cd51d7000fa3b11d940cc571db1874
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.
5 #ifndef NET_QUIC_CRYPTO_PROOF_VERIFIER_CHROMIUM_H_
6 #define NET_QUIC_CRYPTO_PROOF_VERIFIER_CHROMIUM_H_
8 #include <set>
9 #include <string>
10 #include <vector>
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "net/base/net_export.h"
16 #include "net/cert/cert_verify_result.h"
17 #include "net/cert/x509_certificate.h"
18 #include "net/log/net_log.h"
19 #include "net/quic/crypto/proof_verifier.h"
21 namespace net {
23 class CertPolicyEnforcer;
24 class CertVerifier;
25 class TransportSecurityState;
27 // ProofVerifyDetailsChromium is the implementation-specific information that a
28 // ProofVerifierChromium returns about a certificate verification.
29 class NET_EXPORT_PRIVATE ProofVerifyDetailsChromium
30 : public ProofVerifyDetails {
31 public:
33 // ProofVerifyDetails implementation
34 ProofVerifyDetails* Clone() const override;
36 CertVerifyResult cert_verify_result;
38 // pinning_failure_log contains a message produced by
39 // TransportSecurityState::PKPState::CheckPublicKeyPins in the event of a
40 // pinning failure. It is a (somewhat) human-readable string.
41 std::string pinning_failure_log;
44 // ProofVerifyContextChromium is the implementation-specific information that a
45 // ProofVerifierChromium needs in order to log correctly.
46 struct ProofVerifyContextChromium : public ProofVerifyContext {
47 public:
48 ProofVerifyContextChromium(int cert_verify_flags, const BoundNetLog& net_log)
49 : cert_verify_flags(cert_verify_flags), net_log(net_log) {}
51 int cert_verify_flags;
52 BoundNetLog net_log;
55 // ProofVerifierChromium implements the QUIC ProofVerifier interface. It is
56 // capable of handling multiple simultaneous requests.
57 class NET_EXPORT_PRIVATE ProofVerifierChromium : public ProofVerifier {
58 public:
59 ProofVerifierChromium(CertVerifier* cert_verifier,
60 CertPolicyEnforcer* cert_policy_enforcer,
61 TransportSecurityState* transport_security_state);
62 ~ProofVerifierChromium() override;
64 // ProofVerifier interface
65 QuicAsyncStatus VerifyProof(const std::string& hostname,
66 const std::string& server_config,
67 const std::vector<std::string>& certs,
68 const std::string& signature,
69 const ProofVerifyContext* verify_context,
70 std::string* error_details,
71 scoped_ptr<ProofVerifyDetails>* verify_details,
72 ProofVerifierCallback* callback) override;
74 private:
75 class Job;
76 typedef std::set<Job*> JobSet;
78 void OnJobComplete(Job* job);
80 // Set owning pointers to active jobs.
81 JobSet active_jobs_;
83 // Underlying verifier used to verify certificates.
84 CertVerifier* const cert_verifier_;
85 CertPolicyEnforcer* const cert_policy_enforcer_;
87 TransportSecurityState* const transport_security_state_;
89 DISALLOW_COPY_AND_ASSIGN(ProofVerifierChromium);
92 } // namespace net
94 #endif // NET_QUIC_CRYPTO_PROOF_VERIFIER_CHROMIUM_H_