|
@@ -113,7 +113,7 @@ public class AesUtil {
|
|
try {
|
|
try {
|
|
Cipher cipher = Cipher.getInstance(Constants.AES_MODE_PKCS7);
|
|
Cipher cipher = Cipher.getInstance(Constants.AES_MODE_PKCS7);
|
|
SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(Constants.CHARSET_NAME), Constants.AES);
|
|
SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(Constants.CHARSET_NAME), Constants.AES);
|
|
- AlgorithmParameterSpec paramSpec = new IvParameterSpec(new byte[16]);
|
|
|
|
|
|
+ AlgorithmParameterSpec paramSpec = new IvParameterSpec(Constants.AES_RULE.getBytes());
|
|
cipher.init(Cipher.ENCRYPT_MODE, keySpec, paramSpec);
|
|
cipher.init(Cipher.ENCRYPT_MODE, keySpec, paramSpec);
|
|
byte[] result = cipher.doFinal(content.getBytes(Constants.CHARSET_NAME));
|
|
byte[] result = cipher.doFinal(content.getBytes(Constants.CHARSET_NAME));
|
|
encoderText = Base64.getEncoder().encodeToString(result);
|
|
encoderText = Base64.getEncoder().encodeToString(result);
|
|
@@ -135,7 +135,7 @@ public class AesUtil {
|
|
try {
|
|
try {
|
|
Cipher cipher = Cipher.getInstance(Constants.AES_MODE_PKCS7);
|
|
Cipher cipher = Cipher.getInstance(Constants.AES_MODE_PKCS7);
|
|
SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(Constants.CHARSET_NAME), Constants.AES);
|
|
SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(Constants.CHARSET_NAME), Constants.AES);
|
|
- AlgorithmParameterSpec paramSpec = new IvParameterSpec(new byte[16]);
|
|
|
|
|
|
+ AlgorithmParameterSpec paramSpec = new IvParameterSpec(Constants.AES_RULE.getBytes());
|
|
cipher.init(Cipher.DECRYPT_MODE, keySpec, paramSpec);
|
|
cipher.init(Cipher.DECRYPT_MODE, keySpec, paramSpec);
|
|
decoderText = new String(cipher.doFinal(Base64.getDecoder().decode(content)), Constants.CHARSET_NAME);
|
|
decoderText = new String(cipher.doFinal(Base64.getDecoder().decode(content)), Constants.CHARSET_NAME);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|