1

I RSA encrypt an AES key using PyCrypto PKCS_OAEP. The OAEP uses SHA1 and MGF1 (defaults).

I am trying to get a Cipher instance in Java which matches my PyCrypto encryption param spec.

I see that the SHA1/MGF1 padding is fine, BUT totally unsure about the cipher mode. I assume it is ECB but can someone help here. Decryption is failing. I can provide the errors when I get to work, but till then there may be a trivial answer that will save any more discussion.

5
  • 2
    RSA can only be used in ECB mode. You need to show us how you are attempting to perform the decryption. Commented Sep 22, 2013 at 23:36
  • 2
    Public key ciphers are not used in any mode of operation, so the technically correct term is "NONE", though the JCE does accept "ECB" as a synonym for legacy compatibility reasons. The string to pass to Cipher.getInstance() should be "RSA/NONE/OAEPWithSHA1AndMGF1Padding". Commented Sep 23, 2013 at 15:35
  • @ntoskrnl sounds like an answer to me ... don't become CodesInChaos and use the answer button :P Commented Sep 23, 2013 at 19:14
  • Done. All good. Thx for the answers Commented Sep 24, 2013 at 4:36
  • @owlstead Posted comment as answer. Commented Sep 24, 2013 at 13:54

1 Answer 1

1

Public key ciphers are not used in any mode of operation, so the technically correct term is "NONE", though the JCE does accept "ECB" as a synonym for legacy compatibility reasons. The string to pass to Cipher.getInstance() should be "RSA/NONE/OAEPWithSHA1AndMGF1Padding".

Sign up to request clarification or add additional context in comments.

1 Comment

SunJCE (1.7.40) seems to not have None as an option. RSA/ECB/OAEPWithSHA1AndMGF1Paddinng works fine

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.