It depends on the selected or standard provider, which is actually populated when you create the Cipher instance without its full qualification:
Cipher.getInstance("RSA")
This is bad practice because if you switch Java implementations, there may be different default values ββand you will suddenly not be compatible with old ciphertexts. Always fully qualify the cipher.
As I said, by default it is likely (there are many providers, you canβt be sure) that this is PKCS # 1 v1.5. If you need something else, you must specify it. If you want to use OAEP, here is the full encryption line from here :
Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding");
source share