Parcourir la source

考生端websocket

wangliang il y a 4 ans
Parent
commit
f798a9ee2d

+ 2 - 2
themis-common/src/main/java/com/qmth/themis/common/util/AesUtil.java

@@ -113,7 +113,7 @@ public class AesUtil {
         try {
             Cipher cipher = Cipher.getInstance(Constants.AES_MODE_PKCS7);
             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);
             byte[] result = cipher.doFinal(content.getBytes(Constants.CHARSET_NAME));
             encoderText = Base64.getEncoder().encodeToString(result);
@@ -135,7 +135,7 @@ public class AesUtil {
         try {
             Cipher cipher = Cipher.getInstance(Constants.AES_MODE_PKCS7);
             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);
             decoderText = new String(cipher.doFinal(Base64.getDecoder().decode(content)), Constants.CHARSET_NAME);
         } catch (Exception e) {