448-bit Blowfish encryption not supported?
843810Nov 12 2001 — edited Nov 25 2001Hiyas,
I'm trying to encrypt a file with 448-bit blowfish encryption. However, it won't work. I get a java.lang.SecurityException: Unsupport keysize or algorithm parameters error. Here's my code...
try {
KeyGenerator keyGen = KeyGenerator.getInstance("Blowfish");
keyGen.init(448);
SecretKey bfSKey = keyGen.generateKey();
byte[] raw = bfSKey.getEncoded();
SecretKeySpec skeySpec = new SecretKeySpec(raw, "Blowfish");
Cipher fileCipher = Cipher.getInstance("Blowfish");
fileCipher.init(Cipher.ENCRYPT_MODE, skeySpec);
byte[] encrypted = fileCipher.doFinal("This is just an example".getBytes());
System.out.println(new String(encrypted));
}
catch (Exception e) {
System.err.println("Exception: " + e.toString());
}
if I change the keyGen.init(448) to keyGen.init(128) or anything less than 128, it works fine. So my question is, how can I make it support 448-bit blowfish? Anyone know?
Thanks!