# JCE

Damien Tampe (damian@deis38.deis.unibo.it)
Tue, 06 May 1997 16:52:12 +0200

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: lelam948: "Leaks in java when user is attending chat.rooms"
- Previous message: Shen, Raymond North York: "Security of Java"

    Date: Tue, 06 May 1997 16:52:12 +0200

    From: Damien Tampe <damian@deis38.deis.unibo.it>

    To: java-security@web2.javasoft.com

    Subject: JCE

Hi,
Is the JCE considered like a "provider" as meant by the JCA specs, and
should it be installed in
jdk1.1.1/lib/security/java.security ? If not, is there something to
configure?
If yes, what masterclass?

By the way, the code example of the JCE API Specification & Reference
seems a bit @#$%& .. I corrected it into:
----------------
/*\
security by cryptography
*/
try {
// generate a secure random number
SecureRandom my_random = new
SecureRandom(SecureRandom.getSeed(6)); //line 2
// get the key generator for DES algorithm
KeyGenerator my_keygen =
KeyGenerator.getInstance("DES/ECB/PKCS#5");
// initialize that key generator with the random number
my_keygen.initialize(my_random);
// and now generate a key!
SecretKey my_key = my_keygen.generateKey();
// create the cipher
Cipher my_cipher_des = Cipher.getInstance("DES/ECB/PKCS#5");
// initialize the Cipher for encryption
my_cipher_des.initEncrypt(my_key);
// NOW encrypt and decrypt...
} catch(java.security.NoSuchAlgorithmException nsa){
System.out.println("no such algo");
} catch( java.security.KeyException kex){
System.out.println("key exception");
} ;
---------------
but i still have runtime exception from line 2
java.lang.ExceptionInInitializerError
this is the reason of my first question!

Thanks!

    --
    D.Tampe
    damian@deis38.deis.unibo.it

- Next message: lelam948: "Leaks in java when user is attending chat.rooms"
- Previous message: Shen, Raymond North York: "Security of Java"