6

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.

2
  • Can you please provide more information like, java version, any 3rd party libraries, is it Oracle JDK, Windows or linux etc? Commented Jan 7, 2014 at 0:04
  • I also faced this issue. But when I restart the server it is working. Commented Jun 9, 2017 at 9:04

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

5 Comments

It isn't too sensible, but "RSA/ECB/PKCS1Padding" is the name specified by the Java Standard Algorithm Name documentation. It doesn't handle the v. 1.5 versus 2 padding ambiguity either.
@erickson Even worse, it does not accept data of over keysize - 88 bits either. So what ECB mode would that be?
Thanks Folks. after reading few more documentation here is what it solved. Cipher RSACipher = Cipher.getInstance("RSA/None/PKCS1Padding"); // this should be PKCS1PADDING OR just RSA as Cipher RSACipher = Cipher.getInstance("RSA"); // default for "RSA/None/PKCS1PADDING" mentioned here : javadoc.iaik.tugraz.at/iaik_jce/current/iaik/pkcs/pkcs1/…
The Security architecture is case insensitive for algorithm names. Furthermore, you should always specify the mode and padding otherwise the provider may choose it's own defaults - and the defaults may differ for each provider. So what you wrote above is very dangerous.
Thanks, I'll provide provider name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.