Dears,
I need help to understand why decryptString doesn\'t work and throw \"java.security.InvalidKeyException: Need RSA private or public key\". When call encrypt meth
Try omitting the cipher provider:
Cipher output = Cipher.getInstance("RSA/ECB/PKCS1Padding");
Secondly, you can instantiate the provider first to make sure that works, then pass it along as the second argument to Cipher.getInstance().
The second argument can be either a String (provider name) or a Provider (object). Using the second might make debugging easier.