| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
TAG |
| Constructor and Description |
|---|
RSACrypto(java.security.PrivateKey privateKey)
解密传入私钥
|
RSACrypto(java.security.PublicKey publicKey)
加密要传入公钥
|
| Modifier and Type | Method and Description |
|---|---|
static void |
createFile(java.lang.String filePath) |
static java.security.Key |
createKeyFromObjectData(java.io.InputStream is)
从数据流初始化rsa公钥和私钥
|
static void |
createRSAKeyPairFile(java.lang.String publicKeyPath,
java.lang.String privateKeyPath)
创建rsa密钥,并分别保存公钥私钥到以下路径
|
byte[] |
decode(byte[] encryptData)
解密
|
byte[] |
encode(byte[] rawData)
加密
|
static java.security.KeyPair |
generateRSAKeyPair(int keyLength)
生成rsa密钥串
|
static byte[] |
keyPairToByteArray(java.security.Key key)
把密钥转成byte[]
|
static void |
makeKeyFile(java.lang.String path,
byte[] bytes) |
public RSACrypto(java.security.PublicKey publicKey)
publicKey - public RSACrypto(java.security.PrivateKey privateKey)
privateKey - public static java.security.KeyPair generateRSAKeyPair(int keyLength)
keyLength - public static java.security.Key createKeyFromObjectData(java.io.InputStream is)
is - public static byte[] keyPairToByteArray(java.security.Key key)
key - public byte[] encode(byte[] rawData)
Cryptopublic byte[] decode(byte[] encryptData)
Cryptopublic static void createRSAKeyPairFile(java.lang.String publicKeyPath,
java.lang.String privateKeyPath)
publicKeyPath - privateKeyPath - public static void createFile(java.lang.String filePath)
public static void makeKeyFile(java.lang.String path,
byte[] bytes)