Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0045de4
add verifier impl and proof source details
danzh1989 Jul 1, 2020
105e714
no empty filter chain
danzh1989 Jul 2, 2020
811a141
Merge branch 'master' into certverify
danzh1989 Jul 3, 2020
a0d8975
revert cert verification
danzh1989 Jul 4, 2020
6e599bf
add back cert verification
danzh1989 Jul 4, 2020
67fad57
comment
danzh1989 Jul 4, 2020
af27dd7
Merge branch 'master' into certverify
danzh1989 Jul 13, 2020
eae447a
Merge branch 'master' into certverify
danzh1989 Jul 13, 2020
010661c
add comment
danzh1989 Jul 13, 2020
7ac6b81
spell
danzh1989 Jul 14, 2020
562bbd2
remove redudant check
danzh1989 Jul 14, 2020
66e0383
fix asan
danzh1989 Jul 14, 2020
5c0dd47
fix sigalgs
danzh1989 Jul 14, 2020
ae75699
format
danzh1989 Jul 14, 2020
1b85e44
fix windows
danzh1989 Jul 15, 2020
bcad52c
sign alg
danzh1989 Jul 15, 2020
2675461
share sign function
danzh1989 Jul 20, 2020
f19000a
wildcard
danzh1989 Jul 20, 2020
4c2d222
update comment
danzh1989 Jul 20, 2020
80a24d9
move around X509 stuff
danzh1989 Jul 23, 2020
1406524
Merge branch 'master' into certverify
danzh1989 Jul 24, 2020
ca7978f
use dnsNameMatch
danzh1989 Jul 28, 2020
cf62882
refactor string compare
danzh1989 Jul 28, 2020
bb4ec8a
fail upon invalid pkey
danzh1989 Jul 28, 2020
03f319e
Merge branch 'master' into certverify
danzh1989 Jul 28, 2020
c60059a
fix unuse param
danzh1989 Jul 29, 2020
29e1f29
fix sig alg deduction
danzh1989 Jul 29, 2020
bb9b501
use string_view
danzh1989 Jul 30, 2020
333b896
corner cases
danzh1989 Jul 31, 2020
99aa268
format
danzh1989 Aug 3, 2020
fc121e7
fix test failure
danzh1989 Aug 3, 2020
c3229ed
add more test
danzh1989 Aug 5, 2020
405fdb9
Merge branch 'master' into certverify
danzh1989 Aug 5, 2020
0f7f7b8
fix test name
danzh1989 Aug 6, 2020
a37fea6
Merge branch 'master' into certverify
danzh1989 Aug 7, 2020
1ed55e1
check key validity
danzh1989 Aug 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,19 @@ void EnvoyQuicProofSource::signPayload(
callback->Run(false, "", nullptr);
return;
}
// Verify the signature algorithm is as expected.
std::string error_details;
int sign_alg = deduceSignatureAlgorithmFromPublicKey(pem_key->private_key(), &error_details);
if (sign_alg != signature_algorithm) {
ENVOY_LOG(warn,
fmt::format("The signature algorithm {} from the private key is not expected: {}",
sign_alg, error_details));
callback->Run(false, "", nullptr);
return;
}

// Sign.
std::string sig = pem_key->Sign(in, signature_algorithm);

bool success = !sig.empty();
ASSERT(res.filter_chain_.has_value());
callback->Run(success, sig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,42 @@ GUy+n0vQNB0cXGzgcGI=
testGetProof(false);
}

TEST_F(EnvoyQuicProofSourceTest, UnexpectedPrivateKey) {
EXPECT_CALL(listen_socket_, ioHandle());
EXPECT_CALL(filter_chain_manager_, findFilterChain(_))
.WillOnce(Invoke([&](const Network::ConnectionSocket&) { return &filter_chain_; }));
auto server_context_config = std::make_unique<Ssl::MockServerContextConfig>();
auto server_context_config_ptr = server_context_config.get();
QuicServerTransportSocketFactory transport_socket_factory(std::move(server_context_config));
EXPECT_CALL(filter_chain_, transportSocketFactory())
.WillRepeatedly(ReturnRef(transport_socket_factory));

Ssl::MockTlsCertificateConfig tls_cert_config;
std::vector<std::reference_wrapper<const Envoy::Ssl::TlsCertificateConfig>> tls_cert_configs{
std::reference_wrapper<const Envoy::Ssl::TlsCertificateConfig>(tls_cert_config)};
EXPECT_CALL(*server_context_config_ptr, tlsCertificates())
.WillRepeatedly(Return(tls_cert_configs));
std::string rsa_pkey_1024_len(R"(-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgQC79hDq/OwN3ke3EF6Ntdi9R+VSrl9MStk992l1us8lZhq+e0zU
OlvxbUeZ8wyVkzs1gqI1it1IwF+EpdGhHhjggZjg040GD3HWSuyCzpHh+nLwJxtQ
D837PCg0zl+TnKv1YjY3I1F3trGhIqfd2B6pgaJ4hpr+0hdqnKP0Htd4DwIDAQAB
AoGASNypUD59Tx70k+1fifWNMEq3heacgJmfPxsyoXWqKSg8g8yOStLYo20mTXJf
VXg+go7CTJkpELOqE2SoL5nYMD0D/YIZCgDx85k0GWHdA6udNn4to95ZTeZPrBHx
T0QNQHnZI3A7RwLinO60IRY0NYzhkTEBxIuvIY6u0DVbrAECQQDpshbxK3DHc7Yi
Au7BUsxP8RbG4pP5IIVoD4YvJuwUkdrfrwejqTdkfchJJc+Gu/+h8vy7eASPHLLT
NBk5wFoPAkEAzeaKnx0CgNs0RX4+sSF727FroD98VUM38OFEJQ6U9OAWGvaKd8ey
yAYUjR2Sl5ZRyrwWv4IqyWgUGhZqNG0CAQJAPTjjm8DGpenhcB2WkNzxG4xMbEQV
gfGMIYvXmmi29liTn4AKH00IbvIo00jtih2cRcATh8VUZG2fR4dhiGik7wJAWSwS
NwzaS7IjtkERp6cHvELfiLxV/Zsp/BGjcKUbD96I1E6X834ySHyRo/f9x9bbP4Es
HO6j1yxTIGU6w8++AQJACdFPnRidOaj5oJmcZq0s6WGTYfegjTOKgi5KQzO0FTwG
qGm130brdD+1U1EJnEFmleLZ/W6mEi3MxcKpWOpTqQ==
-----END RSA PRIVATE KEY-----)");
EXPECT_CALL(tls_cert_config, privateKey()).WillOnce(ReturnRef(rsa_pkey_1024_len));
proof_source_.ComputeTlsSignature(server_address_, client_address_, hostname_,
SSL_SIGN_RSA_PSS_RSAE_SHA256, "payload",
std::make_unique<TestSignatureCallback>(false));
}

TEST_F(EnvoyQuicProofSourceTest, InvalidPrivateKey) {
EXPECT_CALL(listen_socket_, ioHandle());
EXPECT_CALL(filter_chain_manager_, findFilterChain(_))
Expand Down