9 #include <gmock/gmock.h> 10 #include <gtest/gtest.h> 17 namespace extensions {
23 context_ = std::make_shared<TokenBindingContext>();
24 extensions_ = std::make_shared<TokenBindingClientExtension>(context_);
42 setUpServerHelloExtensions(
43 TokenBindingProtocolVersion::token_binding_0_14,
44 TokenBindingKeyParameters::ecdsap256);
45 extensions_->onEncryptedExtensions(serverExtensions_);
48 extensions_->getVersion(),
49 TokenBindingProtocolVersion::token_binding_0_14);
50 EXPECT_TRUE(extensions_->getNegotiatedKeyParam().hasValue());
52 extensions_->getNegotiatedKeyParam(),
53 TokenBindingKeyParameters::ecdsap256);
57 extensions_->onEncryptedExtensions(serverExtensions_);
59 EXPECT_FALSE(extensions_->getNegotiatedKeyParam().hasValue());
63 setUpServerHelloExtensions(
64 TokenBindingProtocolVersion::token_binding_0_14,
65 TokenBindingKeyParameters::rsa2048_pss);
66 context_->setSupportedVersions(std::vector<TokenBindingProtocolVersion>{
67 TokenBindingProtocolVersion::token_binding_0_12});
68 context_->setSupportedKeyParameters(std::vector<TokenBindingKeyParameters>{
69 TokenBindingKeyParameters::rsa2048_pkcs1_5});
72 extensions_->onEncryptedExtensions(serverExtensions_),
FizzException);
74 EXPECT_FALSE(extensions_->getNegotiatedKeyParam().hasValue());
78 setUpServerHelloExtensions(
79 TokenBindingProtocolVersion::token_binding_0_14,
80 TokenBindingKeyParameters::ecdsap256);
81 context_->setSupportedVersions(std::vector<TokenBindingProtocolVersion>{
82 TokenBindingProtocolVersion::token_binding_0_12});
85 extensions_->onEncryptedExtensions(serverExtensions_),
FizzException);
87 EXPECT_FALSE(extensions_->getNegotiatedKeyParam().hasValue());
91 setUpServerHelloExtensions(
92 TokenBindingProtocolVersion::token_binding_0_12,
93 TokenBindingKeyParameters::ecdsap256);
94 context_->setSupportedVersions(std::vector<TokenBindingProtocolVersion>{
95 TokenBindingProtocolVersion::token_binding_0_14});
97 extensions_->onEncryptedExtensions(serverExtensions_);
99 EXPECT_FALSE(extensions_->getNegotiatedKeyParam().hasValue());
void setUpServerHelloExtensions(TokenBindingProtocolVersion version, TokenBindingKeyParameters keyParam)
#define EXPECT_THROW(statement, expected_exception)
TEST_F(TestInfoTest, Names)
#define EXPECT_EQ(val1, val2)
TokenBindingKeyParameters
TokenBindingProtocolVersion version
constexpr Params params[]
std::vector< Extension > serverExtensions_
#define EXPECT_TRUE(condition)
std::shared_ptr< TokenBindingClientExtension > extensions_
std::vector< TokenBindingKeyParameters > key_parameters_list
std::shared_ptr< TokenBindingContext > context_
TokenBindingProtocolVersion
#define EXPECT_FALSE(condition)
Extension encodeExtension(const TokenBindingParameters ¶ms)