public class RsaKeyHelper extends Object
| 构造器和说明 |
|---|
RsaKeyHelper() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Map<String,byte[]> |
generateKey(String password) |
void |
generateKey(String publicKeyFilename,
String privateKeyFilename,
String password)
生存rsa公钥和密钥
|
static byte[] |
generatePrivateKey(String password)
生存rsa私钥
|
static byte[] |
generatePublicKey(String password)
生存rsa公钥
|
PrivateKey |
getPrivateKey(byte[] privateKey)
获取密钥
|
PrivateKey |
getPrivateKey(String filename)
获取密钥
|
PublicKey |
getPublicKey(byte[] publicKey)
获取公钥
|
PublicKey |
getPublicKey(String filename)
获取公钥
|
static void |
main(String[] args) |
static byte[] |
toBytes(String s) |
static String |
toHexString(byte[] b) |
public PublicKey getPublicKey(String filename) throws Exception
filename - Exceptionpublic PrivateKey getPrivateKey(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 static byte[] generatePublicKey(String password) throws IOException, NoSuchAlgorithmException
password - IOExceptionNoSuchAlgorithmExceptionpublic static byte[] generatePrivateKey(String password) throws IOException, NoSuchAlgorithmException
password - IOExceptionNoSuchAlgorithmExceptionpublic static Map<String,byte[]> generateKey(String password) throws IOException, NoSuchAlgorithmException
public static String toHexString(byte[] b)
public static final byte[] toBytes(String s) throws IOException
IOExceptionpublic static void main(String[] args) throws NoSuchAlgorithmException
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.