From f7085b65205923d8739979d771468d99ab0e4613 Mon Sep 17 00:00:00 2001 From: HuangXin Date: Wed, 16 Sep 2020 15:28:26 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E4=BF=AE=E6=94=B9=E5=8A=A0?= =?UTF-8?q?=E5=AF=86=E7=B1=BB=E5=9E=8BAES256=E4=B8=BAAES128?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/dispose/common/ProtoCryptoType.java | 2 +- .../com/dispose/service/impl/ProtocolSecurityServiceImpl.java | 4 ++-- .../java/com/dispose/test/testcase/dev/v200/CodeCoverage.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/dispose/common/ProtoCryptoType.java b/src/main/java/com/dispose/common/ProtoCryptoType.java index ad23555c..2346f545 100644 --- a/src/main/java/com/dispose/common/ProtoCryptoType.java +++ b/src/main/java/com/dispose/common/ProtoCryptoType.java @@ -17,7 +17,7 @@ public enum ProtoCryptoType { /** * The Crypto aes 256. */ - CRYPTO_AES256(2, "AES256加密"), + CRYPTO_AES128(2, "AES128加密"), /** * The Crypto des. */ diff --git a/src/main/java/com/dispose/service/impl/ProtocolSecurityServiceImpl.java b/src/main/java/com/dispose/service/impl/ProtocolSecurityServiceImpl.java index 93e2ec41..4082cbc5 100644 --- a/src/main/java/com/dispose/service/impl/ProtocolSecurityServiceImpl.java +++ b/src/main/java/com/dispose/service/impl/ProtocolSecurityServiceImpl.java @@ -70,7 +70,7 @@ public class ProtocolSecurityServiceImpl implements ProtocolSecurityService { // 加密类型为base64直接返回处理结果 if (proReq.getCryptoType() == ProtoCryptoType.CRYPTO_BASE64.getCode()) { decryptContent = base64Decode; - } else if (proReq.getCryptoType() == ProtoCryptoType.CRYPTO_AES256.getCode()) { + } else if (proReq.getCryptoType() == ProtoCryptoType.CRYPTO_AES128.getCode()) { try { decryptContent = CryptoHelper.aes128Decryption(base64Decode, SecurityConfigValue.AES_KEY); } catch (Exception e) { @@ -122,7 +122,7 @@ public class ProtocolSecurityServiceImpl implements ProtocolSecurityService { String cipherText; if (cryptoType == ProtoCryptoType.CRYPTO_BASE64.getCode()) { cipherText = CryptoHelper.base64Encryption(plainText.getBytes(StandardCharsets.UTF_8)); - } else if (cryptoType == ProtoCryptoType.CRYPTO_AES256.getCode()) { + } else if (cryptoType == ProtoCryptoType.CRYPTO_AES128.getCode()) { try { byte[] encode = CryptoHelper.aes128Encryption(plainText.getBytes(StandardCharsets.UTF_8), SecurityConfigValue.AES_KEY); diff --git a/src/test/java/com/dispose/test/testcase/dev/v200/CodeCoverage.java b/src/test/java/com/dispose/test/testcase/dev/v200/CodeCoverage.java index fccdf6ab..f477da11 100644 --- a/src/test/java/com/dispose/test/testcase/dev/v200/CodeCoverage.java +++ b/src/test/java/com/dispose/test/testcase/dev/v200/CodeCoverage.java @@ -57,7 +57,7 @@ public class CodeCoverage { .rspCode(ErrorCode.ERR_PARAMEXCEPTION) .autoLogin(true) .verifyCallback((VerifyProtoRespCallback) CodeCoverage::verifyJsonExceptionResp) - .prepareCallback(c -> SecurityConfigValue.SECURITY_PROTOCOL_TYPE = ProtoCryptoType.CRYPTO_AES256.getCode()) + .prepareCallback(c -> SecurityConfigValue.SECURITY_PROTOCOL_TYPE = ProtoCryptoType.CRYPTO_AES128.getCode()) .build(), };