Commit fd3b77da by huluobin

update

parent 211d02cc
...@@ -32,7 +32,7 @@ public class AESUtil { ...@@ -32,7 +32,7 @@ public class AESUtil {
* *
* @param iv iv * @param iv iv
* @return AlgorithmParameters * @return AlgorithmParameters
* @throws NoSuchAlgorithmException noSuchAlgorithmException * @throws NoSuchAlgorithmException noSuchAlgorithmException
* @throws InvalidParameterSpecException invalidParameterSpecException * @throws InvalidParameterSpecException invalidParameterSpecException
*/ */
public static AlgorithmParameters generateIV(byte[] iv) throws NoSuchAlgorithmException, InvalidParameterSpecException { public static AlgorithmParameters generateIV(byte[] iv) throws NoSuchAlgorithmException, InvalidParameterSpecException {
...@@ -46,9 +46,8 @@ public class AESUtil { ...@@ -46,9 +46,8 @@ public class AESUtil {
* *
* @param content 密文 * @param content 密文
* @return result * @return result
* @throws Exception e
*/ */
public byte[] decrypt(byte[] content, byte[] keyByte, byte[] ivByte) throws Exception { public byte[] decrypt(byte[] content, byte[] keyByte, byte[] ivByte) {
initialize(); initialize();
try { try {
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding");
......
...@@ -23,7 +23,7 @@ public class WXCore { ...@@ -23,7 +23,7 @@ public class WXCore {
String sessionKey, String sessionKey,
String iv) throws InvalidAlgorithmParameterException { String iv) throws InvalidAlgorithmParameterException {
String result; String result;
AES aes = new AES(); AESUtil aes = new AESUtil();
byte[] resultByte = aes.decrypt(Base64.decodeBase64(encryptedData), byte[] resultByte = aes.decrypt(Base64.decodeBase64(encryptedData),
Base64.decodeBase64(sessionKey), Base64.decodeBase64(iv)); Base64.decodeBase64(sessionKey), Base64.decodeBase64(iv));
if (null != resultByte && resultByte.length > 0) { if (null != resultByte && resultByte.length > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment