OLD | NEW |
(Empty) | |
| 1 #ifndef NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_OPENSSL_H_ |
| 2 #define NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_OPENSSL_H_ |
| 3 |
| 4 #include <memory> |
| 5 |
| 6 #include "net/quic/core/crypto/channel_id.h" |
| 7 #include "net/quic/test_tools/crypto_test_utils.h" |
| 8 |
| 9 #include "security/util/openssl_unique_ptr.h" |
| 10 #include "third_party/openssl/evp.h" |
| 11 |
| 12 namespace net { |
| 13 |
| 14 namespace test { |
| 15 |
| 16 class TestChannelIDKey : public ChannelIDKey { |
| 17 public: |
| 18 explicit TestChannelIDKey(EVP_PKEY* ecdsa_key) : ecdsa_key_(ecdsa_key) {} |
| 19 ~TestChannelIDKey() override {} |
| 20 |
| 21 // ChannelIDKey implementation. |
| 22 |
| 23 bool Sign(base::StringPiece signed_data, std::string* out_signature) const ove
rride; |
| 24 |
| 25 std::string SerializeKey() const override; |
| 26 |
| 27 const EVP_PKEY* get_evp_pkey() const { return ecdsa_key_.get(); } |
| 28 |
| 29 private: |
| 30 security::openssl_unique_ptr<EVP_PKEY> ecdsa_key_; |
| 31 }; |
| 32 |
| 33 class TestChannelIDSource : public ChannelIDSource { |
| 34 public: |
| 35 ~TestChannelIDSource() override {} |
| 36 |
| 37 // ChannelIDSource implementation. |
| 38 |
| 39 QuicAsyncStatus GetChannelIDKey( |
| 40 const std::string& hostname, |
| 41 std::unique_ptr<ChannelIDKey>* channel_id_key, |
| 42 ChannelIDSourceCallback* /*callback*/) override; |
| 43 |
| 44 private: |
| 45 static EVP_PKEY* HostnameToKey(const std::string& hostname); |
| 46 }; |
| 47 |
| 48 } // namespace test |
| 49 } // namespace net |
| 50 |
| 51 #endif // NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_OPENSSL_H_ |
OLD | NEW |