Firstly, you shouldn't use "ECB" mode cipher, because:
- ECB is a block cipher mode, RSA isn't an algorithm based on that mode of operation.
- If you use an algorithm based on that mode of operation (for example AES), you shouldn't use ECB, because it doesn't have IV (Initialization Vector), so it's insecure and a crypto analyzer could break the cipher. You could use CBC, it has IV, or GCM, if you want to share sensitive information to external systems and prevent Oracle Padding. I recommend you visit the following link:
MSC61-J. Do not use insecure or weak cryptographic algorithms
So, in this case, you just need to use OAEP for RSA encryption, because it's a padding scheme and it helpts to prevent Oracle Padding for asymetric algorithms, then change your code for: RSA/None/OAEPWithSHA-256AndMGF1Padding
. Maybe, you could get compatibility with Node.js. Also, I recommend you visit the official web site:
JCA Reference Guide
I hope this information helps you.
Good luck.