public class RSAUtil extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
RSAUtil.RSAItem |
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
KEY_SIZE
KEY SIZE 必要时在使用前修改
|
| 构造器和说明 |
|---|
RSAUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static KeyPair |
generateKey(String password)
生存rsa
|
void |
generateKey(String publicKeyFilename,
String privateKeyFilename,
String password)
生存rsa公钥和密钥
|
void |
generateKeyBase64(String publicKeyFilename,
String privateKeyFilename,
String password)
生存rsa公钥和密钥
|
static RSAUtil.RSAItem |
generateNew(int length) |
static byte[] |
generatePublicKey(String password)
生存rsa公钥
|
PrivateKey |
getPrivateKey(byte[] privateKey)
获取密钥
|
PrivateKey |
getPrivateKey(String filename)
获取密钥
|
PrivateKey |
getPrivateKeyFromBase64(String filename)
获取密钥
|
PublicKey |
getPublicKey(byte[] publicKey)
获取公钥
|
PublicKey |
getPublicKey(String filename)
获取公钥
|
PublicKey |
getPublicKeyFromBase64(String filename)
获取公钥
|
static String |
toBase64(byte[] b) |
static byte[] |
toBytes(String s) |
public PublicKey getPublicKey(String filename) throws Exception
filename - Exceptionpublic PrivateKey getPrivateKey(String filename) throws Exception
filename - Exceptionpublic PublicKey getPublicKeyFromBase64(String filename) throws Exception
filename - Exceptionpublic PrivateKey getPrivateKeyFromBase64(String filename) throws Exception
filename - Exceptionpublic PublicKey getPublicKey(byte[] publicKey) throws Exception
publicKey - Exceptionpublic PrivateKey getPrivateKey(byte[] privateKey) throws Exception
privateKey - Exceptionpublic void generateKey(String publicKeyFilename, String privateKeyFilename, String password) throws IOException, NoSuchAlgorithmException
publicKeyFilename - privateKeyFilename - password - IOExceptionNoSuchAlgorithmExceptionpublic void generateKeyBase64(String publicKeyFilename, String privateKeyFilename, String password) throws IOException, NoSuchAlgorithmException
publicKeyFilename - privateKeyFilename - password - IOExceptionNoSuchAlgorithmExceptionpublic static byte[] generatePublicKey(String password) throws NoSuchAlgorithmException
password - IOExceptionNoSuchAlgorithmExceptionpublic static KeyPair generateKey(String password) throws NoSuchAlgorithmException
password - IOExceptionNoSuchAlgorithmExceptionpublic static String toBase64(byte[] b)
public static final byte[] toBytes(String s)
public static final RSAUtil.RSAItem generateNew(int length)
Copyright © 2025. All rights reserved.