dcsimg
DES not found problem in servlet
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Lee_Juan
Posted On:   Friday, April 23, 2004 03:07 AM

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? I have already put all my jar files, jce, policies into /common/lib dir and i dont think this is the problem. import java.net.*; i   More>>

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?
I have already put all my jar files, jce, policies into /common/lib dir and i dont think this is the problem.



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;

}

   <<Less

Re: DES not found problem in servlet

Posted By:   keshav_sarin  
Posted On:   Tuesday, July 6, 2004 10:32 AM

IMO, tomcat can't find the full encryption libraries. I had a similar problem and the following worked:


1. Get the full encryption package from Sun for your JDK. Install under JAVA_HOME/jre/lib/security.


2. Make sure your tomcat uses this JAVA_HOME.


3. You don't need to put anything under common/lib

About | Sitemap | Contact