mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-25 20:56:40 +08:00
Compare commits
No commits in common. "a703cb2ad1824aa2e1b3827d3eb350f5b961d748" and "e795e315ebadfe71ebb00ba0d070abdb7aa1eafb" have entirely different histories.
a703cb2ad1
...
e795e315eb
@ -72,10 +72,5 @@ public interface Constants {
|
||||
*/
|
||||
Long TOP_PARENT_ID = 0L;
|
||||
|
||||
/**
|
||||
* 加密头
|
||||
*/
|
||||
String ENCRYPT_HEADER = "ENC_";
|
||||
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ import cn.hutool.core.util.ReflectUtil;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.io.Resources;
|
||||
import org.dromara.common.core.constant.Constants;
|
||||
import org.dromara.common.core.utils.ObjectUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.encrypt.annotation.EncryptField;
|
||||
@ -93,12 +92,8 @@ public class EncryptorManager {
|
||||
* @param encryptContext 加密相关的配置信息
|
||||
*/
|
||||
public String encrypt(String value, EncryptContext encryptContext) {
|
||||
if (StringUtils.startsWith(value, Constants.ENCRYPT_HEADER)) {
|
||||
return value;
|
||||
}
|
||||
IEncryptor encryptor = this.registAndGetEncryptor(encryptContext);
|
||||
String encrypt = encryptor.encrypt(value, encryptContext.getEncode());
|
||||
return Constants.ENCRYPT_HEADER + encrypt;
|
||||
return encryptor.encrypt(value, encryptContext.getEncode());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,12 +103,8 @@ public class EncryptorManager {
|
||||
* @param encryptContext 加密相关的配置信息
|
||||
*/
|
||||
public String decrypt(String value, EncryptContext encryptContext) {
|
||||
if (!StringUtils.startsWith(value, Constants.ENCRYPT_HEADER)) {
|
||||
return value;
|
||||
}
|
||||
IEncryptor encryptor = this.registAndGetEncryptor(encryptContext);
|
||||
String str = StringUtils.removeStart(value, Constants.ENCRYPT_HEADER);
|
||||
return encryptor.decrypt(str);
|
||||
return encryptor.decrypt(value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user