-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incompatible with cryptopp #11
Comments
It looks like you are encrypting with Nettle's RSA (v.1.5) and decrypting with RSA OAEP (v.2.0). I welcome contributions for OAEP in lua-resty-nettle. I need to check if Nettle provides any helpers for it. |
Does CryptoPP Support v1.5 padding that Nettle is using (OAEP is v2.0)? |
Sorry, I'm newer to rsa, but I think cryptopp is support PKCS v1.5 padding. |
According to your hint, I change the CryptoPP::RSAES_OAEP_SHA_Decryptor to CryptoPP::RSAES_PKCS1v15_Decryptor, it works! And now, How to use cryptopp rsa keys in lua-resty-nettle? The fixed values(n = 4096, e=65537) in rsa.lua is unsafe.
|
By default please supply the parameters as base16 encoded bytes as a string. See this: Also check this: I think for you it is easiest to |
the fixed values: are not the fixed values for actual public key: and / or private key: Usually you need only one of the keys (e.g. your code verifies signatures, you will only need public key, or you are only decrypting, then you will only need private key). |
And yes, I need to update the example, as quite a lot has happened with this library recently. |
you can also supply the |
For use customed public & private key, I modify the rsa.lua, from
to
The test code cannot decrypt successfully, However, the cryptopp is ok.
|
No, do not modify. It is totally unneeded. just use, e.g.: local pub, err = rsa.key.public.new(n, e) |
Ok, why decrypt result is nil? |
The problem has been found: a,b,c cannot be omitted. It's different from cryptopp. |
Good, I guessed that it might be the case, but did't have time to test. |
Maybe you can add some codes in function "private.new(d, p, q, a, b, c, base)" to calc the a,b,c if them are nil.
|
Good work! I'll test it later, If any problem, I'll post here. |
I use the sample code to get "n e d q p", but cannot decrypt the cipher text by cryptopp.
Got "CryptoPP::InvalidCiphertext" error.
The text was updated successfully, but these errors were encountered: