Skip to content

Conversation

@randombit
Copy link
Owner

No description provided.

We now always return something here since DER is only used for ECDSA
@randombit
Copy link
Owner Author

asio tests are failing which is somewhat unexpected, I'll look at this tomorrow

Comment on lines +164 to +168
if(std::find(cert_signature_schemes.begin(),
cert_signature_schemes.end(),
i.certs[0].subject_public_key_algo()) == cert_signature_schemes.end()) {
continue;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the reason that the ASIO tests fail to perform a successful handshake. The algorithm identifiers of the signature scheme involve the padding (e.g. "RSA/PKCS1v15(SHA-256)") but the subject public key's algorithm identifier is just that, e.g. "RSA", without the padding.

The ASIO integration tests happen to use an RSA certificate that doesn't pass this check. So the server fails to find a suitable certificate and raises a handshake failure.

@KaganCanSit
Copy link
Contributor

KaganCanSit commented Jun 16, 2025

Hi @randombit,

I tried to develop a solution by addressing @reneme's comment explaining the reason for the ASIO test failures. I made the following changes.

Changes:
KaganCanSit@0f0afcf

#include <algorithm>

Botan::OID cert_oid = i.certs[0].subject_public_key_algo().oid();
bool compatible = 
	std::ranges::any_of(cert_signature_schemes, [&cert_oid](const Botan::AlgorithmIdentifier& scheme) {
		return scheme.oid() == cert_oid || (scheme.parameters_are_null_or_empty() &&
		  scheme.oid().to_formatted_string().starts_with(cert_oid.to_formatted_string()));
	});

if(!compatible) {
	continue;
}

Then I performed the following steps.

Compilation:

ninja clean && ./configure.py --without-documentation --with-boost --cc=clang --compiler-cache=ccache --build-targets=static,cli,tests --build-tool=ninja && ninja

Test-1:

./botan-test --test-threads=4 --run-long-tests

Test-2:

python3 src/scripts/test_cli.py ./botan cli_tls_socket_tests

Since I am not fully familiar with the functions here, I made improvements by checking the calls I could make. First, I compared the string components, but then I thought OID could be faster. I may have mistakes, but it can save you time and help you merge this PR content.

If you find it appropriate, I can create a PR or you can include it by cherry-pick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants