Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

448-bit Blowfish encryption not supported?

843810Nov 12 2001 — edited Nov 25 2001
Hiyas,

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!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 23 2001
Added on Nov 12 2001
3 comments
210 views