-
Notifications
You must be signed in to change notification settings - Fork 790
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
How to encode using RSA/NONE/OAEPWithSHA-1AndMGF1Padding? #464
Comments
i also have this question |
The presence of "ECB" in "RSA/ECB/OAEPWithSHA-256AndMGF1Padding" doesn't make any sense. "ECB" is a symmetric cipher mode and RSA-OAEP is an asymmetric cipher. So "ECB" has no effect whatsoever ... I presume it has the same meaning as "NONE". If someone wants to put some runnable code into this issue for both the Java and JavaScript side demonstrating something not working properly, then others could help debug what the issue is. |
Thanks for posting this. It helped me a lot. I found out they are not the same thing. The one that matches Java RSA/NONE/OAEPWithSHA-1AndMGF1Padding is:
The other one results in an exception during decryption: |
Hi I am unable to get RSA/NONE/OAEPWithSHA-1AndMGF1Padding working with this library, any chance for an example of how this type of encryption is done with this library? I have used the suggested approach above to no avail // this does not work
var encoded = publicKey.encrypt(data, 'RSA-OAEP', {
md: forge.md.sha1.create(),
mgf: forge.mgf.mgf1.create(forge.md.sha1.create())
})
// this does not work either
var encoded = publicKey.encrypt(data, 'RSA-OAEP', {
md: forge.md.sha1.create(),
mgf: {
md: forge.md.sha1.create()
}
})
// have tried this also
// this does not work either
var encoded = publicKey.encrypt(data, 'RSA-OAEP', {
md: forge.md.sha256.create(),
mgf: {
md: forge.md.sha1.create()
}
}) thanks in advance |
This is the code we're using: https://github.com/enketo/enketo-express/blob/master/public/js/src/module/encryptor.js. Maybe that helps. |
Thanks @MartijnR , this helped out a lot !!! |
Just to note, my issue was I needed SHA-512, i did not see this in the documentation, so this worked for me var encoded = publicKey.encrypt(data, 'RSA-OAEP', {
md: forge.md.sha512.create(),
mgf: forge.mgf.mgf1.create(forge.md.sha1.create())
}) |
I'm trying to mimic the following Java code:
But I'm not sure I completely understand the documentation in the README.md file 😨 The following is based off a
RSA/ECB/OAEPWithSHA-256AndMGF1Padding
implementation that I found under the RSA section, but I'm not sure how to change it fromECB
toNONE
:Btw, I've also seen this approach used, but I can't figure out if it's just two ways of writing the same thing:
The text was updated successfully, but these errors were encountered: