static void testKey() throws Exception
{
int size = 8 * 24;
KeyGenerator kgen = KeyGenerator.getInstance("Blowfish");
kgen.init(size);
SecretKey key = kgen.generateKey();
byte[] kbytes = key.getEncoded();
System.out.println("key.Algorithm = "+key.getAlgorithm());
System.out.println("key.Format = "+key.getFormat());
System.out.println("key.Encoded Size = "+kbytes.length);
SecureRandom rnd = SecureRandom.getInstance("SHA1PRNG");
BigInteger bi = new BigInteger(320, rnd);
byte[] k2bytes = bi.toByteArray();
SecretKeySpec keySpec = new SecretKeySpec(k2bytes, "Blowfish");
System.out.println("key2.Algorithm = "+key.getAlgorithm());
System.out.println("key2.Format = "+key.getFormat());
System.out.println("key2.Encoded Size = "+kbytes.length);
}