Gostaria de saber se o código abaixo é suportador pelo JDK 1.6, estou leno o livro David Hook e apresenta o seguinte erro :
java.security.InvalidKeyException: Illegal key size or default parameters
at javax.crypto.Cipher.a(DashoA13*…)
at javax.crypto.Cipher.init(DashoA13*…)
at javax.crypto.Cipher.init(DashoA13*…)
pedaço do código referente ao erro:
// create a 192 bit secret key from raw bytes
SecretKey key192 = new SecretKeySpec(;
new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 },
“Blowfish”)
// now try encrypting with the larger key
c.init(Cipher.ENCRYPT_MODE, key192);
c.doFinal(data);