public class RSA_Cipher extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
PRIVATE_KEY |
static String |
PUBLIC_KEY |
| 构造器和说明 |
|---|
RSA_Cipher() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
decrypt(PrivateKey key,
byte[] encoded)
解密
|
static byte[] |
encrypt(PublicKey key,
byte[] text)
加密
|
static Map<String,byte[]> |
generatePair()
生成密钥对。
|
static PrivateKey |
restorePrivateKey(byte[] key)
还原私钥,PKCS8EncodedKeySpec 用于构建私钥的规范
|
static PublicKey |
restorePublicKey(byte[] key)
还原公钥,X509EncodedKeySpec 用于构建公钥的规范
|
public static Map<String,byte[]> generatePair()
public static PublicKey restorePublicKey(byte[] key)
key - 公钥字节码public static PrivateKey restorePrivateKey(byte[] key)
key - 私钥字节码public static byte[] encrypt(PublicKey key, byte[] text)
key - 公钥text - 要加密的内容public static String decrypt(PrivateKey key, byte[] encoded)
key - 私钥encoded - 已加密的内容Copyright © 2013–2021 AJAXJS. All rights reserved.