发出了一个Android错误:https
:
//pre.google.com/p/android/issues/detail?can=2&start=0&num=100&q=
triple%20des
&colspec=
ID%20Status%20Priority%20Owner%20Summary%20Stars% 20Reporter
%20Opened&groupby =&sort =&id =
189292
您还可以通过将密钥更改为24字节len来解决问题,如下所示:
MessageDigest md = MessageDigest.getInstance("MD5");seed_key = md.digest(new String(key).getBytes());if (seed_key.length == 16) { byte[] tempkey = new byte[24]; System.arraycopy(seed_key, 0, tempkey, 0, 16); System.arraycopy(seed_key, 0, tempkey, 16, 8); seed_key = tempkey;}SecretKeySpec keySpec = new SecretKeySpec(seed_key, "DESede");nCipher = Cipher.getInstance("DESede/CBC/PKCS5Padding");byte[] IVector = new byte[] { 27, 9, 45, 27, 0, 72, (byte) 171, 54 };IvParameterSpec iv = new IvParameterSpec(IVector);nCipher.init(Cipher.ENCRYPT_MODE, keySpec, iv);byte[] cipherbyte = nCipher.doFinal(data.getBytes());enpreTxt = new String(base64.enprebase64(cipherbyte));
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)