parent
63debfca1d
commit
f7085b6520
|
@ -17,7 +17,7 @@ public enum ProtoCryptoType {
|
||||||
/**
|
/**
|
||||||
* The Crypto aes 256.
|
* The Crypto aes 256.
|
||||||
*/
|
*/
|
||||||
CRYPTO_AES256(2, "AES256加密"),
|
CRYPTO_AES128(2, "AES128加密"),
|
||||||
/**
|
/**
|
||||||
* The Crypto des.
|
* The Crypto des.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class ProtocolSecurityServiceImpl implements ProtocolSecurityService {
|
||||||
// 加密类型为base64直接返回处理结果
|
// 加密类型为base64直接返回处理结果
|
||||||
if (proReq.getCryptoType() == ProtoCryptoType.CRYPTO_BASE64.getCode()) {
|
if (proReq.getCryptoType() == ProtoCryptoType.CRYPTO_BASE64.getCode()) {
|
||||||
decryptContent = base64Decode;
|
decryptContent = base64Decode;
|
||||||
} else if (proReq.getCryptoType() == ProtoCryptoType.CRYPTO_AES256.getCode()) {
|
} else if (proReq.getCryptoType() == ProtoCryptoType.CRYPTO_AES128.getCode()) {
|
||||||
try {
|
try {
|
||||||
decryptContent = CryptoHelper.aes128Decryption(base64Decode, SecurityConfigValue.AES_KEY);
|
decryptContent = CryptoHelper.aes128Decryption(base64Decode, SecurityConfigValue.AES_KEY);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -122,7 +122,7 @@ public class ProtocolSecurityServiceImpl implements ProtocolSecurityService {
|
||||||
String cipherText;
|
String cipherText;
|
||||||
if (cryptoType == ProtoCryptoType.CRYPTO_BASE64.getCode()) {
|
if (cryptoType == ProtoCryptoType.CRYPTO_BASE64.getCode()) {
|
||||||
cipherText = CryptoHelper.base64Encryption(plainText.getBytes(StandardCharsets.UTF_8));
|
cipherText = CryptoHelper.base64Encryption(plainText.getBytes(StandardCharsets.UTF_8));
|
||||||
} else if (cryptoType == ProtoCryptoType.CRYPTO_AES256.getCode()) {
|
} else if (cryptoType == ProtoCryptoType.CRYPTO_AES128.getCode()) {
|
||||||
try {
|
try {
|
||||||
byte[] encode = CryptoHelper.aes128Encryption(plainText.getBytes(StandardCharsets.UTF_8),
|
byte[] encode = CryptoHelper.aes128Encryption(plainText.getBytes(StandardCharsets.UTF_8),
|
||||||
SecurityConfigValue.AES_KEY);
|
SecurityConfigValue.AES_KEY);
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class CodeCoverage {
|
||||||
.rspCode(ErrorCode.ERR_PARAMEXCEPTION)
|
.rspCode(ErrorCode.ERR_PARAMEXCEPTION)
|
||||||
.autoLogin(true)
|
.autoLogin(true)
|
||||||
.verifyCallback((VerifyProtoRespCallback<GetTaskRsp>) CodeCoverage::verifyJsonExceptionResp)
|
.verifyCallback((VerifyProtoRespCallback<GetTaskRsp>) CodeCoverage::verifyJsonExceptionResp)
|
||||||
.prepareCallback(c -> SecurityConfigValue.SECURITY_PROTOCOL_TYPE = ProtoCryptoType.CRYPTO_AES256.getCode())
|
.prepareCallback(c -> SecurityConfigValue.SECURITY_PROTOCOL_TYPE = ProtoCryptoType.CRYPTO_AES128.getCode())
|
||||||
.build(),
|
.build(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue