]> git.ipfire.org Git - thirdparty/strongswan.git/commit
pkcs11: Fix encoding of RSA keys if unnecessarily zero prefixed
authorTobias Brunner <tobias@strongswan.org>
Thu, 2 Jul 2015 13:58:01 +0000 (15:58 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 6 Aug 2015 15:15:25 +0000 (17:15 +0200)
commitb2efc6181848b679a186f00963bfe02816f79d05
tree398dc1545814c8b1d9ec781832c65552e3b55047
parent1de31bcc2b3d6b5ff9f8d06651bc5c68d94d5e9b
pkcs11: Fix encoding of RSA keys if unnecessarily zero prefixed

Some tokens/libraries seem to prefix all numbers with zero bytes even
if not necessary (e.g. the default exponent 0x010001).  If we don't fix
that, the fingerprints calculated based on the retrieved values will be
incorrect.

Even if the pkcs1 plugin can properly handle numbers that are not in
two's complement since a81bd670b086 ("Added PUBKEY_RSA_MODULUS
encoding type") we prefix them with zero if necessary as other encoders
might expect them in two's complement.

Fixes #1012.
src/libstrongswan/plugins/pkcs11/pkcs11_public_key.c