补充楼下的:再加上这个就齐活了
keyGenerator.init(new SecureRandom());// 生成默认长度的KEY
keyGenerator.init(new SecureRandom());// 生成默认长度的KEY
2015-03-07
KeyGenerator keyGenerator = KeyGenerator.getInstance("DESede");
...
DESedeKeySpec desedeKeySpec = new DESedeKeySpec(bytesKey);
SecretKeyFactory factory = SecretKeyFactory.getInstance("DESede");
...
Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
...
...
DESedeKeySpec desedeKeySpec = new DESedeKeySpec(bytesKey);
SecretKeyFactory factory = SecretKeyFactory.getInstance("DESede");
...
Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
...
2015-03-03
我觉得视频中只是将秘钥的生成算法改为了三重DES,但对于实际运行时其实还是DES算法,通过key转换错误的将三重DES秘钥转换为普通DES秘钥了,所以运行没有报错,但正确的应该是还需要修改"DESede/ECB/PKCS5Padding",和秘钥工厂的算法"DESede",如果说的对希望改正,以免误导他人
2015-02-26