Cipher streams using Java Cryptography Extension (JCE)
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ankit_Doshi
Posted On:   Thursday, October 18, 2001 03:40 AM

I am trying to develop a sample program for cipher streams using JCE. I have got the instance of cipher and initialized it in the following manner. Security.addProvider(new com.sun.crypto.provider.SunJCE()); cipher = Cipher.getInstance("DES/ECB/PKCS5Padding", "SunJCE"); keyGenerator = KeyGenerator.getInstance("DES"); keyGenerator.init(56, new SecureRandom()); SecretKey key = keyGenerator.generateKey(); cipher.init(Cipher.ENCRYPT_MODE, key); When I run this program, it gives me Security Exception at the line where I am getting instance of cipher, means cipher = Cipher.getInstance("DES/ECB/PKCS5Padding", "SunJCE");    More>>

I am trying to develop a sample program for cipher streams using JCE. I have got the instance of cipher and initialized it in the following manner.


Security.addProvider(new com.sun.crypto.provider.SunJCE());

cipher = Cipher.getInstance("DES/ECB/PKCS5Padding", "SunJCE");

keyGenerator = KeyGenerator.getInstance("DES");

keyGenerator.init(56, new SecureRandom());

SecretKey key = keyGenerator.generateKey();

cipher.init(Cipher.ENCRYPT_MODE, key);

When I run this program, it gives me Security Exception at the line where I am getting instance of cipher, means
cipher = Cipher.getInstance("DES/ECB/PKCS5Padding", "SunJCE");

The exception it gives is this:
Exception in thread "main" java.lang.ExceptionInInitializerError: java.lang.SecurityException: Cannot set up certs for truste
d CAs
at javax.crypto.b. ([DashoPro-V1.2-120198])
at javax.crypto.Cipher.getInstance([DashoPro-V1.2-120198])
at CipherTest.main(CipherTest.java:22)

I dont understand what is the problem, kindly help me out with this problem.

Ankit.

   <<Less
About | Sitemap | Contact