Question

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.

Was it helpful?

Solution

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".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top