]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: jwt: Properly process ecdsa signatures (concatenated R and S params)
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Wed, 18 Jan 2023 14:32:28 +0000 (15:32 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Wed, 18 Jan 2023 15:18:31 +0000 (16:18 +0100)
commit5a8f02ae6686c72e30bff7e5dbece67a5d438551
tree853ef640beafc4087dba09b2cc37cddcfa407a8d
parent86aac23e6b5f8efde8950573705f494642c11f82
BUG/MEDIUM: jwt: Properly process ecdsa signatures (concatenated R and S params)

When the JWT token signature is using ECDSA algorithm (ES256 for
instance), the signature is a direct concatenation of the R and S
parameters instead of OpenSSL's DER format (see section
3.4 of RFC7518).
The code that verified the signatures wrongly assumed that they came in
OpenSSL's format and it did not actually work.
We now have the extra step of converting the signature into a complete
ECDSA_SIG that can be fed into OpenSSL's digest verification functions.

The ECDSA signatures in the regtest had to be recalculated and it was
made via the PyJWT python library so that we don't end up checking
signatures that we built ourselves anymore.

This patch should fix GitHub issue #2001.
It should be backported up to branch 2.5.
reg-tests/jwt/build_token.py [new file with mode: 0755]
reg-tests/jwt/jws_verify.vtc
src/jwt.c