public abstract class RSAKeyPairUtil extends Object
| Constructor and Description |
|---|
RSAKeyPairUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
decrypt(String privateKey,
String encryptedText)
根据私钥解密
|
static String |
encrypt(String publicKey,
String plainText)
根据公钥加密
|
static RSAPairDTO |
generator() |
static RSAPairDTO |
generator(int keySize)
生成指定长度的 RSA 非对称公私钥
|
public static RSAPairDTO generator()
public static RSAPairDTO generator(int keySize)
keySize - 密钥长度,512 | 1024 | 2048 | 4096 ~ 16384
JDK8 仅支持到 2048 长度public static String encrypt(String publicKey, String plainText)
publicKey - 公钥plainText - 需要加密的内容Copyright © 2025. All rights reserved.