public class KeyUtil
extends java.lang.Object
| 限定符和类型 | 字段和说明 |
|---|---|
static java.lang.String |
DEFAULT_KEY_ALGORITHM |
| 构造器和说明 |
|---|
KeyUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static java.security.KeyPair |
createKeyPair()
RSA算法创建密钥对
|
static java.security.KeyPair |
createKeyPair(java.lang.String algorithm,
int keySize)
根据算法创建密钥对
|
static java.security.PrivateKey |
createPrivateKey(byte[] key)
RSA构建私钥
|
static java.security.PrivateKey |
createPrivateKey(java.lang.String algorithm,
byte[] key)
指定算法构建私钥
|
static java.security.PrivateKey |
createPrivateKeyPKCS8(java.lang.String algorithm,
byte[] privateKey)
生成PKCS8标准的私钥
|
static java.security.PrivateKey |
createPrivateKeyPKCS8(java.lang.String algorithm,
java.lang.String privateKey)
将私钥字符串进行Base64解码之后, 生成PKCS8标准的私钥
|
static java.security.PublicKey |
createPublicKey(byte[] key)
RSA构建公钥
|
static java.security.PublicKey |
createPublicKey(java.lang.String algorithm,
byte[] key)
指定算法构建公钥
|
static java.security.PublicKey |
createPublicKeyX509(java.lang.String algorithm,
byte[] publicKey)
指定算法,生成X509标准公钥
|
static java.security.PublicKey |
createPublicKeyX509(java.lang.String algorithm,
java.lang.String publicKey)
公钥字符串base64解码后, 生成X509标准公钥
|
static java.security.KeyPair |
getKeyPair(java.io.File certificate,
java.lang.String password)
从证书中获取密钥对
|
static java.security.KeyPair |
getKeyPair(java.io.InputStream certificateInputStream,
java.lang.String password)
从证书中获取密钥对
|
public static final java.lang.String DEFAULT_KEY_ALGORITHM
public static java.security.KeyPair getKeyPair(java.io.File certificate,
java.lang.String password)
certificate - 证书password - 密码, 为null不需要密码public static java.security.KeyPair getKeyPair(java.io.InputStream certificateInputStream,
java.lang.String password)
certificateInputStream - 证书流password - 密码, 为null不需要密码public static java.security.KeyPair createKeyPair()
public static java.security.KeyPair createKeyPair(java.lang.String algorithm,
int keySize)
algorithm - 算法keySize - 长度public static java.security.PrivateKey createPrivateKey(byte[] key)
key - 私钥keypublic static java.security.PrivateKey createPrivateKey(java.lang.String algorithm,
byte[] key)
algorithm - 算法key - 私钥keypublic static java.security.PrivateKey createPrivateKeyPKCS8(java.lang.String algorithm,
byte[] privateKey)
algorithm - 算法privateKey - 未加密私钥public static java.security.PrivateKey createPrivateKeyPKCS8(java.lang.String algorithm,
java.lang.String privateKey)
algorithm - 算法privateKey - 加密私钥字符串public static java.security.PublicKey createPublicKey(byte[] key)
key - 公钥keypublic static java.security.PublicKey createPublicKey(java.lang.String algorithm,
byte[] key)
algorithm - 算法key - 公钥keypublic static java.security.PublicKey createPublicKeyX509(java.lang.String algorithm,
byte[] publicKey)
algorithm - 算法publicKey - 未加密公钥keypublic static java.security.PublicKey createPublicKeyX509(java.lang.String algorithm,
java.lang.String publicKey)
algorithm - 算法publicKey - base64加密公钥key字符串