What I'm trying to do is to create a key from a passphrase. But when I try it with the following code, i get a InvaildKeyException. Am I doing something wrong here?
Code:
String keystring = "userdefinedstring";
byte[] k = keystring.getBytes();
SecretKey desKey = new SecretKeySpec(k, "DES");
Cipher desCipher;
desCipher = Cipher.getInstance("DES");
desCipher.init(Cipher.ENCRYPT_MODE, desKey);