| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef NET_QUIC_CORE_CRYPTO_PROOF_SOURCE_H_ | 5 #ifndef NET_QUIC_CORE_CRYPTO_PROOF_SOURCE_H_ |
| 6 #define NET_QUIC_CORE_CRYPTO_PROOF_SOURCE_H_ | 6 #define NET_QUIC_CORE_CRYPTO_PROOF_SOURCE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/memory/ref_counted.h" | |
| 13 #include "net/quic/core/crypto/quic_crypto_proof.h" | 12 #include "net/quic/core/crypto/quic_crypto_proof.h" |
| 14 #include "net/quic/core/quic_packets.h" | 13 #include "net/quic/core/quic_packets.h" |
| 15 #include "net/quic/platform/api/quic_export.h" | 14 #include "net/quic/platform/api/quic_export.h" |
| 15 #include "net/quic/platform/api/quic_reference_counted.h" |
| 16 #include "net/quic/platform/api/quic_socket_address.h" | 16 #include "net/quic/platform/api/quic_socket_address.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 // ProofSource is an interface by which a QUIC server can obtain certificate | 20 // ProofSource is an interface by which a QUIC server can obtain certificate |
| 21 // chains and signatures that prove its identity. | 21 // chains and signatures that prove its identity. |
| 22 class QUIC_EXPORT_PRIVATE ProofSource { | 22 class QUIC_EXPORT_PRIVATE ProofSource { |
| 23 public: | 23 public: |
| 24 // Chain is a reference-counted wrapper for a std::vector of std::stringified | 24 // Chain is a reference-counted wrapper for a std::vector of std::stringified |
| 25 // certificates. | 25 // certificates. |
| 26 struct QUIC_EXPORT_PRIVATE Chain : public base::RefCounted<Chain> { | 26 struct QUIC_EXPORT_PRIVATE Chain : public QuicReferenceCounted { |
| 27 explicit Chain(const std::vector<std::string>& certs); | 27 explicit Chain(const std::vector<std::string>& certs); |
| 28 | 28 |
| 29 const std::vector<std::string> certs; | 29 const std::vector<std::string> certs; |
| 30 | 30 |
| 31 protected: |
| 32 ~Chain() override; |
| 33 |
| 31 private: | 34 private: |
| 32 friend class base::RefCounted<Chain>; | |
| 33 | |
| 34 virtual ~Chain(); | |
| 35 | |
| 36 DISALLOW_COPY_AND_ASSIGN(Chain); | 35 DISALLOW_COPY_AND_ASSIGN(Chain); |
| 37 }; | 36 }; |
| 38 | 37 |
| 39 // Details is an abstract class which acts as a container for any | 38 // Details is an abstract class which acts as a container for any |
| 40 // implementation-specific details that a ProofSource wants to return. | 39 // implementation-specific details that a ProofSource wants to return. |
| 41 class Details { | 40 class Details { |
| 42 public: | 41 public: |
| 43 virtual ~Details() {} | 42 virtual ~Details() {} |
| 44 }; | 43 }; |
| 45 | 44 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 58 // certificate chain. | 57 // certificate chain. |
| 59 // | 58 // |
| 60 // |signature| contains the signature of the server config. | 59 // |signature| contains the signature of the server config. |
| 61 // | 60 // |
| 62 // |leaf_cert_sct| holds the signed timestamp (RFC6962) of the leaf cert. | 61 // |leaf_cert_sct| holds the signed timestamp (RFC6962) of the leaf cert. |
| 63 // | 62 // |
| 64 // |details| holds a pointer to an object representing the statistics, if | 63 // |details| holds a pointer to an object representing the statistics, if |
| 65 // any, gathered during the operation of GetProof. If no stats are | 64 // any, gathered during the operation of GetProof. If no stats are |
| 66 // available, this will be nullptr. | 65 // available, this will be nullptr. |
| 67 virtual void Run(bool ok, | 66 virtual void Run(bool ok, |
| 68 const scoped_refptr<Chain>& chain, | 67 const QuicReferenceCountedPointer<Chain>& chain, |
| 69 const QuicCryptoProof& proof, | 68 const QuicCryptoProof& proof, |
| 70 std::unique_ptr<Details> details) = 0; | 69 std::unique_ptr<Details> details) = 0; |
| 71 | 70 |
| 72 private: | 71 private: |
| 73 Callback(const Callback&) = delete; | 72 Callback(const Callback&) = delete; |
| 74 Callback& operator=(const Callback&) = delete; | 73 Callback& operator=(const Callback&) = delete; |
| 75 }; | 74 }; |
| 76 | 75 |
| 77 virtual ~ProofSource() {} | 76 virtual ~ProofSource() {} |
| 78 | 77 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 102 // |out_leaf_cert_sct| points to the signed timestamp (RFC6962) of the leaf | 101 // |out_leaf_cert_sct| points to the signed timestamp (RFC6962) of the leaf |
| 103 // cert. | 102 // cert. |
| 104 // | 103 // |
| 105 // This function may be called concurrently. | 104 // This function may be called concurrently. |
| 106 virtual bool GetProof(const QuicSocketAddress& server_address, | 105 virtual bool GetProof(const QuicSocketAddress& server_address, |
| 107 const std::string& hostname, | 106 const std::string& hostname, |
| 108 const std::string& server_config, | 107 const std::string& server_config, |
| 109 QuicVersion quic_version, | 108 QuicVersion quic_version, |
| 110 base::StringPiece chlo_hash, | 109 base::StringPiece chlo_hash, |
| 111 const QuicTagVector& connection_options, | 110 const QuicTagVector& connection_options, |
| 112 scoped_refptr<Chain>* out_chain, | 111 QuicReferenceCountedPointer<Chain>* out_chain, |
| 113 QuicCryptoProof* out_proof) = 0; | 112 QuicCryptoProof* out_proof) = 0; |
| 114 | 113 |
| 115 // Async version of GetProof with identical semantics, except that the results | 114 // Async version of GetProof with identical semantics, except that the results |
| 116 // are delivered to |callback|. Callers should expect that |callback| might | 115 // are delivered to |callback|. Callers should expect that |callback| might |
| 117 // be invoked synchronously. The ProofSource takes ownership of |callback| in | 116 // be invoked synchronously. The ProofSource takes ownership of |callback| in |
| 118 // any case. | 117 // any case. |
| 119 virtual void GetProof(const QuicSocketAddress& server_address, | 118 virtual void GetProof(const QuicSocketAddress& server_address, |
| 120 const std::string& hostname, | 119 const std::string& hostname, |
| 121 const std::string& server_config, | 120 const std::string& server_config, |
| 122 QuicVersion quic_version, | 121 QuicVersion quic_version, |
| 123 base::StringPiece chlo_hash, | 122 base::StringPiece chlo_hash, |
| 124 const QuicTagVector& connection_options, | 123 const QuicTagVector& connection_options, |
| 125 std::unique_ptr<Callback> callback) = 0; | 124 std::unique_ptr<Callback> callback) = 0; |
| 126 }; | 125 }; |
| 127 | 126 |
| 128 } // namespace net | 127 } // namespace net |
| 129 | 128 |
| 130 #endif // NET_QUIC_CORE_CRYPTO_PROOF_SOURCE_H_ | 129 #endif // NET_QUIC_CORE_CRYPTO_PROOF_SOURCE_H_ |
| OLD | NEW |