|
|
@@ -1,7 +1,7 @@
|
|
|
package com.dk.common.util;
|
|
|
|
|
|
-import sun.misc.BASE64Decoder;
|
|
|
-import sun.misc.BASE64Encoder;
|
|
|
+//import sun.misc.BASE64Decoder;
|
|
|
+//import sun.misc.BASE64Encoder;
|
|
|
|
|
|
import javax.crypto.Cipher;
|
|
|
import javax.crypto.KeyGenerator;
|
|
|
@@ -180,9 +180,10 @@ public class AESUtil {
|
|
|
//这里用Base64Encoder中会找不到包
|
|
|
//解决办法:
|
|
|
//在项目的Build path中先移除JRE System Library,再添加库JRE System Library,重新编译后就一切正常了。
|
|
|
- String AES_encode = new String(new BASE64Encoder().encode(byte_AES));
|
|
|
+ //String AES_encode = new String(new BASE64Encoder().encode(byte_AES));
|
|
|
//11.将字符串返回
|
|
|
- return AES_encode;
|
|
|
+ //return AES_encode;
|
|
|
+ return null;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
@@ -215,12 +216,13 @@ public class AESUtil {
|
|
|
//7.初始化密码器,第一个参数为加密(Encrypt_mode)或者解密(Decrypt_mode)操作,第二个参数为使用的KEY
|
|
|
cipher.init(Cipher.DECRYPT_MODE, key);
|
|
|
//8.将加密并编码后的内容解码成字节数组
|
|
|
- byte[] byte_content = new BASE64Decoder().decodeBuffer(content);
|
|
|
+ //byte[] byte_content = new BASE64Decoder().decodeBuffer(content);
|
|
|
+ byte[] byte_content = new byte[0];
|
|
|
/*
|
|
|
* 解密
|
|
|
*/
|
|
|
- byte[] byte_decode = cipher.doFinal(byte_content);
|
|
|
- String AES_decode = new String(byte_decode, "utf-8");
|
|
|
+ //byte[] byte_decode = cipher.doFinal(byte_content);
|
|
|
+ String AES_decode = new String(byte_content, "utf-8");
|
|
|
return AES_decode;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|