|
@@ -14,6 +14,8 @@ import org.apache.commons.codec.binary.Hex;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
import cn.com.qmth.examcloud.commons.exception.ExamCloudRuntimeException;
|
|
import cn.com.qmth.examcloud.commons.exception.ExamCloudRuntimeException;
|
|
|
|
+import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
|
|
|
|
+import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
|
|
|
|
|
|
/**
|
|
/**
|
|
* AES算法<br>
|
|
* AES算法<br>
|
|
@@ -25,6 +27,9 @@ import cn.com.qmth.examcloud.commons.exception.ExamCloudRuntimeException;
|
|
* @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
|
|
* @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
|
|
*/
|
|
*/
|
|
public class AES {
|
|
public class AES {
|
|
|
|
+
|
|
|
|
+ private static final ExamCloudLog LOG = ExamCloudLogFactory.getLog(AES.class);
|
|
|
|
+
|
|
private static final String KEY_ALGORITHM = "AES";
|
|
private static final String KEY_ALGORITHM = "AES";
|
|
|
|
|
|
private static final String CIPHER_ALGORITHM_CBC = "AES/CBC/PKCS5Padding";
|
|
private static final String CIPHER_ALGORITHM_CBC = "AES/CBC/PKCS5Padding";
|
|
@@ -66,7 +71,7 @@ public class AES {
|
|
encryptCipher.init(Cipher.ENCRYPT_MODE, secretKey, new IvParameterSpec(iv));
|
|
encryptCipher.init(Cipher.ENCRYPT_MODE, secretKey, new IvParameterSpec(iv));
|
|
decryptCipher.init(Cipher.DECRYPT_MODE, secretKey, new IvParameterSpec(iv));
|
|
decryptCipher.init(Cipher.DECRYPT_MODE, secretKey, new IvParameterSpec(iv));
|
|
} catch (GeneralSecurityException e) {
|
|
} catch (GeneralSecurityException e) {
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ LOG.error("fail to new instance of AES.", e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|