| Author |
DES not found problem in servlet
|
michael yue
Ranch Hand
Joined: Nov 20, 2003
Posts: 204
|
|
Hi I have a problem of using DES in servlet The exception is No such algorithm. Algorithm DES not found. I research this for quite some 48 hours its similar to the problem here http://forum.java.sun.com/thread.jsp?thread=482363&forum=9&message=2251103 The big problem is i can run on standalone, cannot run on servlet and following the guide on the link at java sun also does not seem to help. Below is my class file to encrypt. I run this on java web service developer pack JWSDP1_0_01. Please help anybody? import java.net.*; import java.io.*; import java.security.*; import javax.crypto.*; public class Crypto { public Crypto(){ Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); Security.addProvider(new com.sun.crypto.provider.SunJCE()); } public byte[] Encrypt(String arg){ String err=""; byte[] ciphertext = null; if(arg!=null){ try{ byte[] plaintext = arg.getBytes("UTF8"); KeyGenerator keyGen = KeyGenerator.getInstance("DES"); keyGen.init(56); Key key = keyGen.generateKey(); Cipher cipher = Cipher.getInstance("DES/ECB/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, key); ciphertext = cipher.doFinal(plaintext); } catch(Exception exp){ err=exp.toString(); ()); } } return ciphertext; }
|
 |
michael yue
Ranch Hand
Joined: Nov 20, 2003
Posts: 204
|
|
|
i just found out that i have 2 compiler in my pc. the setpath for java_home is pointing to jdk1.4. The compiler i m using is jdk1.3.1 . could this be the problem. thanks
|
 |
Rashmi Tambe
Ranch Hand
Joined: Aug 07, 2001
Posts: 418
|
|
Hi rollin, Did u solve the problem? I am getting the same error for "blowfish" algorithm. I have a EJB running on WL7 trying to encrypt the user password using blowfish algorithm. when i keep the jce1_2_2.jar in server's classpath, everything works fine. However, if i remove it from there i get the same exception. Can u help me in this regard? [ April 29, 2004: Message edited by: Rashmi Tambe ]
|
 |
 |
|
|
subject: DES not found problem in servlet
|
|
|