public class RsaUtils extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
RsaUtils.RsaKeyPair
RSA密钥对对象
|
| 构造器和说明 |
|---|
RsaUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
decryptByPrivateKey(String privateKeyText,
String text)
私钥解密
|
static String |
decryptByPrivateKey(String privateKeyText,
String text1,
String text2)
私钥解密并比较
|
static String |
decryptByPublicKey(String publicKeyText,
String text)
公钥解密
|
static String |
encryptByPrivateKey(String privateKeyText,
String text)
私钥加密
|
static String |
encryptByPublicKey(String publicKeyText,
String text)
公钥加密
|
static RsaUtils.RsaKeyPair |
generateKeyPair()
构建RSA密钥对
|
static void |
main(String[] args) |
public static String decryptByPublicKey(String publicKeyText, String text) throws Exception
publicKeyText - 公钥text - 待解密的信息Exception - /public static String encryptByPrivateKey(String privateKeyText, String text) throws Exception
privateKeyText - 私钥text - 待加密的信息Exception - /public static String decryptByPrivateKey(String privateKeyText, String text) throws Exception
privateKeyText - 私钥text - 待解密的文本Exception - /public static String decryptByPrivateKey(String privateKeyText, String text1, String text2) throws Exception
Exceptionpublic static String encryptByPublicKey(String publicKeyText, String text) throws Exception
publicKeyText - 公钥text - 待加密的文本Exceptionpublic static RsaUtils.RsaKeyPair generateKeyPair() throws NoSuchAlgorithmException
NoSuchAlgorithmException - /Copyright © 2022–2023. All rights reserved.