Below is a CODE and its associated ERROR. Does any body have any idea about
the problem? We are trying to use DES algorithm in JCE to ENC/DEC for
security purposes. We are using JDK Ver.1.4 Beta in which JCE is
integrated. After we got the error we downloaded JCE Unlimited Strength
Jurisdiction Policy Files. But the same error continued. Thanks...
Error is given in runtime when Cipher.getInstance is being executed.
CODE:
import java.io.*;
import java.math.BigInteger;
import java.security.*;
import java.security.spec.*;
import java.security.interfaces.*;
import javax.crypto.*;
import javax.crypto.spec.*;
import javax.crypto.interfaces.*;
import com.sun.crypto.provider.SunJCE;
public class DESIFS {
private DESIFS() {}
public static void main(String argv[]) {
try
{
SecureRandom rand = new SecureRandom( );
byte[] bytes = new byte[20];
rand.nextBytes(bytes);
SecretKey key = new SecretKeySpec(bytes, "HmacSHA1");
Cipher c = Cipher.getInstance("DES/ECB/PKCS5Padding");
c.init(Cipher.ENCRYPT_MODE, key);
byte[] input = "I want to rock and roll all night and party every
day.".getBytes( );
byte[] ciphertText = c.doFinal(input);
System.out.println("Enc:" + ciphertText);
}
catch (Exception e)
{
System.err.println("Error: " + e);
System.exit(1);
}
}
ERROR:
"C:\jdk1.4\jre\bin\javaw.exe" -mx50m -classpath "C:\JavaDeneme\myclasses;C:
\Program
Files\Oracle\JDeveloper 3.1.1.2\lib\jdev-rt.zip;C:\Program
Files\Oracle\JDeveloper
3.1.1.2\jdbc\lib\oracle8.1.6\classes12.zip;C:\Program
Files\Oracle\JDeveloper
3.1.1.2\lib\connectionmanager.zip;C:\jdk1.4\lib\dt.jar;C:
\jdk1.4\jre\lib\rt.jar;C:\jdk1.4\jre\lib\i18n.ja
r;C:\jdk1.4\jre\lib\sunrsasign.jar;C:\jdk1.4\jre\lib\jsse.jar;C:
\jdk1.4\jre\lib\jce.jar;C:\jdk1.4\jre\lib
\ext\sunjce_provider.jar" DESIFS
java.lang.ExceptionInInitializerError
at javax.crypto.Cipher.getInstance([DashoPro-V1.2-120198])
at DESIFS.main(DESIFS.java:43)
Caused by: java.lang.SecurityException: Cannot set up certs for trusted
CAs: java.util.jar.JarException:
file:C:/jdk1.4/jre/lib/security/US_export_policy.jarhas unsigned class
files.
at javax.crypto.b.<clinit>([DashoPro-V1.2-120198])
... 2 more
Exception in thread "main"
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets