We help IT Professionals succeed at work.

Regarding javax.crypto.Cipher

raga
raga asked
on
I am using a package javax.crypto.Cipher in my class for encryption. I am having a line Cipher.getInstance("DES/ECB/PKCS5Padding");
in my code.
I am importing the javax.crypto.* package in the class and i am also providing the jar file jce1_2-do.jar in the exact path, which contains Cipher class. But still when a run my application, i am getting NoSunchAlogrithmException, it says algorithm DES not available. Does any one knows, whatz the problem in this case ?.
Comment
Watch Question

you have to configure java.security to enable the provider

your jre path /lib/security

there is java.security file
check if this line is there

security.provider.1=sun.securiy.provider.Sun

when you ask for an implementation of a cryptic
algorithm the VM will query the providers in this file
for the implementation

if you are using Windows
then you need to change the java.security file
in your JDK directory as well

if you have installed JCE as an extension
then the JAR should be copied in lib/ext

hope this helps you troubleshoot

Author

Commented:
hi sanjay,

thanx for your comments. I have security.provider.1=sun.security.provider.Sun in my java.security file (/lib/security). I am using Win NT workstation. I have changed the java.security file in the JDK directory also and jar is also provided in the correct path (/lib/ext), but still i am getting the problem. Can u please help ?.
Hi

Have you downloaded JCE as an extension?

Just a check

Put the appropiate JAR file in both the locations

c:\jdk home\jre\lib\ext

c:\program files\javasoft\jre\1.3\lib\ext


sim|| change the java.security files in both the locations

I am pretty sure JDK is not able to find the
appropriate JAR file




refer to this link if you have already done all this

http://lists.samba.org/pipermail/jcifs/2000-July/000785.html

hope it helps

Author

Commented:
Hi

In my java.security file, i have following lines

security.provider.1=sun.security.provider.Sun
security.provider.2=com.sun.rsajca.Provider
security.provider.3=com.isnetworks.crypto.jce.ISNetworksProvider

and the jar file (jce1_2-do.jar) is provided by client. I have tried with putting the jar file in the path specified by u.

But still i am facing the same problem.
Can u please help?.

Author

Commented:
Thanx alot sanjay for the help.
Yes, it was the problem of provider.
Once again thanx alot.

Author

Commented:
Thanx alot sanjay

Explore More ContentExplore courses, solutions, and other research materials related to this topic.