feat: 更改aes密钥
This commit is contained in:
@@ -10,20 +10,22 @@ import com.cxx.home.service.PasswordService;
|
||||
import com.cxx.home.vo.PasswordQueryVo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class PasswordServiceImpl implements PasswordService {
|
||||
@Value("${aes.secret-key}")
|
||||
private String secretKey;
|
||||
|
||||
@Resource
|
||||
private PasswordDao passwordDao;
|
||||
|
||||
@Resource
|
||||
private PasswordMapper passwordMapper;
|
||||
|
||||
private static final String SECRET_KEY = "MySuperSecretKey";
|
||||
|
||||
@Override
|
||||
public Boolean add(PasswordDto passwordDto) {
|
||||
Password password = new Password();
|
||||
@@ -69,10 +71,10 @@ public class PasswordServiceImpl implements PasswordService {
|
||||
}
|
||||
|
||||
private String encryptPassword(String password) {
|
||||
return SecureUtil.aes(SECRET_KEY.getBytes()).encryptBase64(password);
|
||||
return SecureUtil.aes(secretKey.getBytes()).encryptBase64(password);
|
||||
}
|
||||
|
||||
private String decryptStr(String password) {
|
||||
return SecureUtil.aes(SECRET_KEY.getBytes()).decryptStr(password);
|
||||
return SecureUtil.aes(secretKey.getBytes()).decryptStr(password);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user