Closed kdisneur closed 5 years ago
I've proposed a fix for this on #67 . I've confirmed it makes the test on your repo pass.
If possible @kdisneur could you check that changing the dep to: {:jose, git: "git@github.com:victorolinasc/erlang-jose.git", branch: "patch-2"}
also works for you?
Thanks!
I just tried to use your repo and it worked 👍
Thanks for the patch 🙇
Just a heads up: I've just opened a bug report to the OTP team about public_key:decrypt_private/3
not respecting the options passed to it here: so, RSA-OAEP is broken here. Options is ignored.
The fix would be to switch it to use crypto:private_decrypt
directly. I'll open another issue to note this, but I thought it'd be good to warn here.
@kdisneur @victorolinasc I'm a little late on replying here, but there was a bug prior to 1.9.0 that was not verifying that public_key:decrypt_private/3
(and public_key:encrypt_public/3
) were properly respecting the options passed to them instead of just ignoring them.
In other words, if you were using public_key
for RSA encryption/decryption operations in OTP 21 or below, you were only ever doing the PKCS#1 Version 1.5 style padding. Even if you passed options that should have used PKCS#1 Version 2.2 OAEP-SHA-1 or OAEP-SHA-256 style padding.
This extra sanity check I added as part of the changes between 1.8.4 and 1.9.0 correctly identifies the bug and will switch back to the pure Erlang implementation of RSA operations from the :jose_jwa_pkcs1
module if :jose.crypto_fallback(true)
(or the equivalent application environment variable) is set.
The pure Erlang version is slower. However, it is tested against the OAEP test vectors provided by the RSA security group in pkcs-1v2-1-vec.zip
.
The bug filed by @victorolinasc in ERL-878 has been fixed as of OTP 22, but earlier versions will need to use the pure Erlang implementation if RSA OAEP encryption operations are needed.
More comments can be found on #67.
Hi,
When we tried to bump from
jose
1.8.4
to1.9.0
, some of our tests started to fail with the following message:when reading the CHANGELOG, I can see something about fixing some RSA padding:
I guess it might be related but I have no idea how to dig further.
If it can help, I reproduced the error on a separate repository : https://github.com/kdisneur/jose_error
Thanks for your help