Link to home
Start Free TrialLog in
Avatar of raga
raga

asked on

Regarding javax.crypto.Cipher

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 ?.
Avatar of sanjay_thakur
sanjay_thakur

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
Avatar of raga

ASKER

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 ?.
ASKER CERTIFIED SOLUTION
Avatar of sanjay_thakur
sanjay_thakur

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of raga

ASKER

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?.
Avatar of raga

ASKER

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

ASKER

Thanx alot sanjay