Problems finding RSA/NONE/PKCS1Padding in Java 1.5.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Problems finding RSA/NONE/PKCS1Padding in Java 1.5.

Jeremy Sheeley
Something strange is happening, and it used to work in Java 1.4.
Here's my code:

public static void main(String[] args) {
   Security.addProvider(new BouncyCastleProvider());
   try {
     Cipher encrypt2=Cipher.getInstance("RSA/NONE/PKCS1Padding");
   } catch (Exception e1) {

Running this under Java 1.5 gives a stack trace of Cannot find any provider
supporting RSA/NONE/PKCS1Padding
        at javax.crypto.Cipher.getInstance(DashoA12275)
        at bctest.main(
Caused by: can't support mode NONE
        at javax.crypto.SunJCE_f.a(DashoA12275)
        ... 2 more

Note that the stack trace implies that it is indeed the bouncycastle
provider that is rejecting the mode.  However, if I specify
     Cipher encrypt2=Cipher.getInstance("RSA/NONE/PKCS1Padding", "BC");

Everything works just fine.  It's a library that I don't have control of
which is making this call, so I can't just add the BC hint.

This library worked fine until I upgraded to 1.5.  I would welcome any
hint that can tell me where I'm going wrong.  Thanks in advance.