REM:
1.修改AES128的错误码
2.修改加密解密异常的错误信息
This commit is contained in:
chenlinghy 2020-09-14 10:39:28 +08:00
parent 6100401b85
commit 91a383aaab
2 changed files with 5 additions and 5 deletions

View File

@ -176,11 +176,11 @@ public enum ErrorCode {
/** /**
* Err decrypt aes 256 error code. * Err decrypt aes 256 error code.
*/ */
ERR_DECRYPT_AES256(102, "AES256解密失败"), ERR_DECRYPT_AES128(102, "AES128解密失败"),
/** /**
* Err encrypt aes 256 error code. * Err encrypt aes 256 error code.
*/ */
ERR_ENCRYPT_AES256(103, "AES256加密失败"), ERR_ENCRYPT_AES128(103, "AES128加密失败"),
/** /**
* Err decrypt 3 des error code. * Err decrypt 3 des error code.
*/ */

View File

@ -74,7 +74,7 @@ public class ProtocolSecurityServiceImpl implements ProtocolSecurityService {
decryptContent = CryptoHelper.aes128Decryption(base64Decode, SecurityConfigValue.AES_KEY); decryptContent = CryptoHelper.aes128Decryption(base64Decode, SecurityConfigValue.AES_KEY);
} catch (Exception e) { } catch (Exception e) {
log.error("AES128 decode message error: {}", base64Decode); log.error("AES128 decode message error: {}", base64Decode);
throw new SecurityProtocolException(ErrorCode.ERR_DECRYPT_AES256); throw new SecurityProtocolException(ErrorCode.ERR_DECRYPT_AES128);
} }
} else if (proReq.getCryptoType() == ProtoCryptoType.CRYPTO_DES.getCode()) { } else if (proReq.getCryptoType() == ProtoCryptoType.CRYPTO_DES.getCode()) {
try { try {
@ -128,7 +128,7 @@ public class ProtocolSecurityServiceImpl implements ProtocolSecurityService {
cipherText = CryptoHelper.base64Encryption(encode); cipherText = CryptoHelper.base64Encryption(encode);
} catch (Exception e) { } catch (Exception e) {
log.error("AES128 encode message error: {}", plainText); log.error("AES128 encode message error: {}", plainText);
throw new SecurityProtocolException(ErrorCode.ERR_DECRYPT_AES256); throw new SecurityProtocolException(ErrorCode.ERR_ENCRYPT_AES128);
} }
} else if (cryptoType == ProtoCryptoType.CRYPTO_DES.getCode()) { } else if (cryptoType == ProtoCryptoType.CRYPTO_DES.getCode()) {
try { try {
@ -137,7 +137,7 @@ public class ProtocolSecurityServiceImpl implements ProtocolSecurityService {
cipherText= CryptoHelper.base64Encryption(encode); cipherText= CryptoHelper.base64Encryption(encode);
} catch (Exception e) { } catch (Exception e) {
log.error("DES encode message error: {}", plainText); log.error("DES encode message error: {}", plainText);
throw new SecurityProtocolException(ErrorCode.ERR_DECRYPT_3DES); throw new SecurityProtocolException(ErrorCode.ERR_ENCRYPT_3DES);
} }
} else { } else {
log.error("Unknown protocol security type: {}, {}", cryptoType, plainText); log.error("Unknown protocol security type: {}, {}", cryptoType, plainText);