Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Java Encryption NoSuchAlgorithmException

19 views
Skip to first unread message

DougJrs

unread,
Apr 2, 2007, 6:21:47 PM4/2/07
to

I am attempting to encrypt and decrypt data using the bouncycastle JCE
provider. I get this exception when I try to use it:
java.security.NoSuchAlgorithmException: Cannot find any provider
supporting RSA/ECB/PKCS1Padding
at javax.crypto.Cipher.getInstance(DashoA12275)
at jsp_servlet.__headers._jspService(headers.jsp:46)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl
$ServletInvocationAction.run(ServletStubImpl.java:1072)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:
465)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:
526)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:
348)
at weblogic.servlet.internal.WebAppServletContext
$ServletInvocationAction.run(WebAppServletContext.java:6981)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:
321)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:
3892)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:
2766)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)


My Code looks like this:
RSAEncryptUtil cipher = new RSAEncryptUtil();

KeyPair key;
key = cipher.generateKey();

String TestMessage = "This is the message!!";


byte[] cipherText = null;
// get an RSA cipher object and print the provider
Cipher cipher2 = Cipher.getInstance("RSA/ECB/PKCS1Padding");
out.println("\nProvider is: " + cipher2.getProvider().getInfo());
out.println("\nStart encryption with public key");


Can anyone point out what I am doing wrong?

Thanks,
Doug

Arne Vajhøj

unread,
Apr 2, 2007, 8:41:02 PM4/2/07
to
DougJrs wrote:
> I am attempting to encrypt and decrypt data using the bouncycastle JCE
> provider. I get this exception when I try to use it:
> java.security.NoSuchAlgorithmException: Cannot find any provider
> supporting RSA/ECB/PKCS1Padding
> at javax.crypto.Cipher.getInstance(DashoA12275)

> My Code looks like this:

> Cipher cipher2 = Cipher.getInstance("RSA/ECB/PKCS1Padding");

> Can anyone point out what I am doing wrong?

Try inserting a line:

Security.addProvider(new
org.bouncycastle.jce.provider.BouncyCastleProvider());

before your code.

Arne

0 new messages