|
|
@@ -37,10 +37,10 @@ public class AesUtil {
|
|
|
|
|
|
public static String Decrypt(String sSrc, String sKey, String sIv) throws Exception {
|
|
|
|
|
|
- byte[] encrypted1 = hex2byte(sSrc);
|
|
|
+ byte[] encrypted1 = hex2byte(sSrc);
|
|
|
|
|
|
- Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
|
|
|
- SecretKeySpec keyspec = new SecretKeySpec(sKey.getBytes(), "AES");
|
|
|
+ Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
|
|
|
+ SecretKeySpec keyspec = new SecretKeySpec(sKey.getBytes(), "AES");
|
|
|
IvParameterSpec ivspec = new IvParameterSpec(sIv.getBytes());
|
|
|
|
|
|
cipher.init(Cipher.DECRYPT_MODE, keyspec, ivspec);
|
|
|
@@ -101,7 +101,8 @@ public class AesUtil {
|
|
|
System.out.println("加密耗时:" + lUseTime + "毫秒");
|
|
|
// 解密
|
|
|
lStart = System.currentTimeMillis();
|
|
|
- String DeString = AesUtil.Decrypt(enString, cKey, cIv);
|
|
|
+// String DeString = AesUtil.Decrypt(enString, cKey, cIv);
|
|
|
+ String DeString = AesUtil.Decrypt("34a4795c730b4e5ec822e710d0e5aff2ec9e0544f5ae27df5c62365ef8abd916c661ae91316674c545c7edadb86f70c7d06ec298b203e97fd9d1536d3c8e429c7000d4a737434f1c188d7d4c5faa227e68a018e8ad669e610572cd9b357eaa1cb745bd48b0f99dc9f53c594cd35c5b75952a2d1ecc4e93b24a8be8d1c67bdec95dff94e04507a94a0627ea6996a8019a9cee101bfac817f3e3389fd805750b3cl", cKey, cIv);
|
|
|
System.out.println("解密后的字串是:" + DeString);
|
|
|
lUseTime = System.currentTimeMillis() - lStart;
|
|
|
System.out.println("解密耗时:" + lUseTime + "毫秒");
|