类 RsaUtils
java.lang.Object
cn.iosd.starter.encrypt.rsa.utils.RsaUtils
- 作者:
- ok1996
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static String使用私钥解密数据static String使用公钥加密数据static KeyPair生成 RSA 密钥对static voidtimestampValidation(RsaProperties.TimestampValidation timestampValidation, String contentsDecrypt) 时间戳校验方法
-
构造器详细资料
-
RsaUtils
public RsaUtils()
-
-
方法详细资料
-
generateKeyPair
生成 RSA 密钥对- 返回:
- RSA 密钥对
- 抛出:
NoSuchAlgorithmException
-
encrypt
使用公钥加密数据- 参数:
data- 待加密数据publicKey- 公钥字符串- 返回:
- 加密后的数据字符串
- 抛出:
Exception
-
decrypt
使用私钥解密数据- 参数:
data- 待解密数据字符串privateKey- 私钥字符串- 返回:
- 解密后的数据
- 抛出:
Exception
-
timestampValidation
public static void timestampValidation(RsaProperties.TimestampValidation timestampValidation, String contentsDecrypt) throws com.fasterxml.jackson.core.JsonProcessingException 时间戳校验方法- 参数:
timestampValidation- 校验配置参数contentsDecrypt- 加密文本- 抛出:
com.fasterxml.jackson.core.JsonProcessingException- 解析异常抛出
-