You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by So...@aol.com on 2000/07/26 17:13:13 UTC
jce problem
Hi to anyone familiar with JCE:
I am new to it. I am using javax.crypto.* and au.net.aba.*
Anyway I am just trying to write a simple program to encrypt and I get an IllegalBlockSizeException: Datasize less than block size. Anyone know what's wrong?Here it is so far:
Security.addProvider(new au.net.aba.crypto.provider.ABAProvider());
KeyGenerator keygen = KeyGenerator.getInstance("DES");
SecretKey desKey = keygen.generateKey();
Cipher c = Cipher.getInstance("DES");
c.init(Cipher.ENCRYPT_MODE, desKey);
byte[] cleartext = "testingkhdkshvksdvds".getBytes();
byte[] ciphertext = c.doFinal(cleartext); //exception thrown here
String encrypted = new String(ciphertext);