I'm using AES to encrypt data and RSA public key to encrypt the AES key used to encrypt data.
I have encrypted the AES key with RSA in Java using RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING and now I would want to decrypt that RSA encrypted key in NodeJS app. Is it possible to decrypt that AES key?
So basically I'm looking for RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING equivalent in NodeJS. (I did look at Java's RSA/ECB/OAEPWithSHA-256AndMGF1Padding equivalent in Node.js but there isn't anything useful)
I looked at NodeJS Decipher and crypto.privateDecrypt but it seems that there is no equivalent for OAEPWITHSHA-256ANDMGF1PADDING in NodeJS
Do I need to change OAEPWITHSHA-256ANDMGF1PADDING to something that else, that could be decrypted in NodeJS?
RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDINGdoes. Most likely the problem is that you are using SHA-256 instead of SHA-1 for the MGF1 digest, as in the accepted answer to the linked question (which is wrong, at least if the default provider, i.e. the SunJCE provider, is used on the Java side).