public class RSA
extends java.lang.Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
RSA.Key
密钥
|
static class |
RSA.PriKey
私钥
|
static class |
RSA.PubKey
公钥
|
| 构造器和说明 |
|---|
RSA() |
| 限定符和类型 | 方法和说明 |
|---|---|
static java.lang.String |
decrypt(RSA.PriKey key,
java.lang.String data)
私钥解密,只能解密对应公钥加密的字符串
|
static java.lang.String |
decrypt(RSA.PubKey key,
java.lang.String data)
公钥解密,只能解密对应私钥加密的字符串
|
static java.lang.String |
encode(RSA.PriKey key,
java.lang.String data)
私钥加密,加密结果需要对应的公钥解密
|
static java.lang.String |
encode(RSA.PubKey key,
java.lang.String data)
公钥加密,加密结果需要对应的私钥解密
|
static RSA.PriKey |
fromPriKey(java.lang.String priKey) |
static RSA.PubKey |
fromPubKey(java.lang.String pubKey) |
static RSA.Key |
generateKey()
生成密钥
|
static void |
main(java.lang.String[] args) |
public static RSA.Key generateKey()
public static RSA.PubKey fromPubKey(java.lang.String pubKey)
public static RSA.PriKey fromPriKey(java.lang.String priKey)
public static java.lang.String encode(RSA.PriKey key, java.lang.String data)
key - -私钥密钥data - -需要加密的字符串public static java.lang.String decrypt(RSA.PubKey key, java.lang.String data)
key - -公钥密钥data - -需要解密的字符串public static java.lang.String encode(RSA.PubKey key, java.lang.String data)
key - -公钥密钥data - -需要加密的字符串public static java.lang.String decrypt(RSA.PriKey key, java.lang.String data)
key - -私钥密钥data - -需要解密的字符串public static void main(java.lang.String[] args)