DESede translate String password
Hi,
I would like to Know how I can transform a String Password to a DESede valid key. I have a password like "testingword", one salt and the encrypted message in DESede/CFB.
When I try to make :
DESedeKeySpec spec = new DESedeKeySpec("testingword".getBytes());
SecretKeyFactory DESedeFactory = SecretKeyFactory.getInstance("DESede");
java.security.Key k = DESedeFactory.generateSecret(spec);
I get a java.securoty.InvalidKeyException.
Thanks in advance.
[523 byte] By [
alyabar] at [2007-9-26 2:22:26]

> DESedeKeySpec spec = new DESedeKeySpec("testingword".getBytes());
> SecretKeyFactory DESedeFactory = SecretKeyFactory.getInstance("DESede");
> java.security.Key k = DESedeFactory.generateSecret(spec);
try it this way :
SecretKeyFactory DESedeFactory = SecretKeyFactory.getInstance("DESede");
DESedeKeySpec spec = new DESedeKeySpec("testingword1234567890aZe".getBytes());
java.security.Key k = DESedeFactory.generateSecret(spec);
The DESedeKeySpec need a key of 24 bytes or 168 bits. Giving only 11 bytes or 88 bits, you can't get the key back.
Hope this will help you a bit more.
Thanks for a quick response.
When I put a password of 24 bytes long I get another error:
Unsupported keysize or algorithm parameters.
The message I am trying to decrypt was encrypted with perl using openssl command, and "testingword" was the password they used for that. They have sent me the encrypted message, the salt and the password but I dont know how to decrypt it in Java.
Thanks