🐛 修复加密失败的问题.
This commit is contained in:
@@ -23,21 +23,13 @@
|
||||
package org.dromara.visor.common.interfaces;
|
||||
|
||||
/**
|
||||
* rsa 加密器
|
||||
* rsa 解密器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2025/1/5 20:58
|
||||
*/
|
||||
public interface RsaEncryptor {
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
* @param value value
|
||||
* @return value
|
||||
*/
|
||||
String encrypt(String value);
|
||||
public interface RsaDecryptor {
|
||||
|
||||
/**
|
||||
* 解密
|
||||
@@ -23,30 +23,20 @@
|
||||
package org.dromara.visor.common.utils;
|
||||
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import org.dromara.visor.common.interfaces.RsaEncryptor;
|
||||
import org.dromara.visor.common.interfaces.RsaDecryptor;
|
||||
|
||||
/**
|
||||
* rsa 加密工具类
|
||||
* rsa 参数解密工具类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2025/1/5 21:13
|
||||
*/
|
||||
public class RsaEncryptUtils {
|
||||
public class RsaParamDecryptUtils {
|
||||
|
||||
private static RsaEncryptor delegate;
|
||||
private static RsaDecryptor delegate;
|
||||
|
||||
private RsaEncryptUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
* @param value value
|
||||
* @return value
|
||||
*/
|
||||
public static String encrypt(String value) {
|
||||
return delegate.encrypt(value);
|
||||
private RsaParamDecryptUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,12 +49,12 @@ public class RsaEncryptUtils {
|
||||
return delegate.decrypt(value);
|
||||
}
|
||||
|
||||
public static void setDelegate(RsaEncryptor delegate) {
|
||||
if (RsaEncryptUtils.delegate != null) {
|
||||
public static void setDelegate(RsaDecryptor delegate) {
|
||||
if (RsaParamDecryptUtils.delegate != null) {
|
||||
// unmodified
|
||||
throw Exceptions.state();
|
||||
}
|
||||
RsaEncryptUtils.delegate = delegate;
|
||||
RsaParamDecryptUtils.delegate = delegate;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user