Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RSA/NONE/PKCS1Padding giving error as java.security.NoSuchAlgorithmException

I am using "RSA/None/PKCS1Padding" as :

Cipher RSACipher = Cipher.getInstance("RSA/None/PKCS1Padding");

This gives me exception as :

java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA/None/PKCS1Padding

Thanks for help.

like image 372
artofabhishek Avatar asked Jan 06 '14 23:01

artofabhishek


1 Answers

Try "RSA/ECB/PKCS1Padding" instead if you are running in an Oracle or Open JDK. It does not make too much sense to use a block cipher mode of encryption with RSA, but not all algorithm names are logical within the Java SE providers.

The Bouncy Castle Libraries support "RSA/None/PKCS1Padding" though. So maybe the code was written for Bouncy or Android.

like image 111
Maarten Bodewes Avatar answered Sep 28 '22 00:09

Maarten Bodewes