Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Java Encryption NoSuchAlgorithmException

Reply
Thread Tools

Java Encryption NoSuchAlgorithmException

 
 
DougJrs
Guest
Posts: n/a
 
      04-02-2007


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.invokeSe rvlet(ServletStubImpl.java:
465)
at
weblogic.servlet.internal.ServletStubImpl.invokeSe rvlet(ServletStubImpl.java:
526)
at
weblogic.servlet.internal.ServletStubImpl.invokeSe rvlet(ServletStubImpl.java:
34
at weblogic.servlet.internal.WebAppServletContext
$ServletInvocationAction.run(WebAppServletContext. java:6981)
at
weblogic.security.acl.internal.AuthenticatedSubjec t.doAs(AuthenticatedSubject.java:
321)
at
weblogic.security.service.SecurityManager.runAs(Se curityManager.java:
121)
at
weblogic.servlet.internal.WebAppServletContext.inv okeServlet(WebAppServletContext.java:
3892)
at
weblogic.servlet.internal.ServletRequestImpl.execu te(ServletRequestImpl.java:
2766)
at weblogic.kernel.ExecuteThread.execute(ExecuteThrea d.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.ja va: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

 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?Arne_Vajh=F8j?=
Guest
Posts: n/a
 
      04-03-2007
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Which hard drive encryption program has the strongest tested encryption & security? =?iso-8859-1?Q?-=3D|__=28=BAL=BA=29__|=3D-____o=3D=5B:::::::::::::::=BB?= Computer Security 6 02-20-2008 01:35 PM
java.security.NoSuchAlgorithmException: No such algorithm: SunX509 ramasubramanian.rahul@gmail.com Java 0 09-15-2006 06:31 AM
JCE: NoSuchAlgorithmException Timo Nentwig Java 0 12-14-2004 07:42 PM
java.security.NoSuchAlgorithmException: using SSL with Webtest Derek Java 0 04-03-2004 10:25 PM
Java/Delphi/COM compatible encryption libraries. Daniel Fiske Java 0 08-29-2003 11:13 AM



Advertisments