TLS-Attacker
TLS-Attacker copied to clipboard
Brainpool Curve in ECDSA Certificate
Hello!
I ran into some difficulties when using a brainpool curve in a certificat during ECDSA. It seems that the X509Certificate class in
https://github.com/tls-attacker/TLS-Attacker/blob/a5e9b78b01026b076152ca9aa2773406ed7a854b/TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/util/CertificateUtils.java#L125
does not support the brainpool curves. In
https://github.com/tls-attacker/TLS-Attacker/blob/a5e9b78b01026b076152ca9aa2773406ed7a854b/TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/constants/NamedGroup.java#L117
the brainpool group was not matched because of a capital letter (brainpoolP256r1 != brainpoolp256r1).
As a quick fix in the CertificateUtils, I replaced the code for extracting the public key as follows, :
SubjectPublicKeyInfo pkInfo = cert.getCertificateAt(0).getTBSCertificate().getSubjectPublicKeyInfo();
JcaPEMKeyConverter converter = new JcaPEMKeyConverter();
PublicKey key = converter.getPublicKey( pkInfo );
Best regards Matthias
The default jdk functionality in
https://github.com/tls-attacker/TLS-Attacker/blob/a5e9b78b01026b076152ca9aa2773406ed7a854b/TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/crypto/SignatureCalculator.java#L84
and
https://github.com/tls-attacker/TLS-Attacker/blob/a5e9b78b01026b076152ca9aa2773406ed7a854b/TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/crypto/keys/CustomECPrivateKey.java#L82
also didn't seem to support the brainpool curves. It works if one uses the bouncy castle provider there.
Hm that is weird. We will look into this