public class OpensslKeyUtil extends Object
Constructor and Description |
---|
OpensslKeyUtil() |
Modifier and Type | Method and Description |
---|---|
static org.bouncycastle.openssl.PEMKeyPair |
decrypt(org.bouncycastle.openssl.PEMEncryptedKeyPair pemEncryptedKeyPair,
char[] password)
解密
PEMEncryptedKeyPair 为PEMKeyPair |
static org.bouncycastle.asn1.pkcs.PrivateKeyInfo |
decrypt(org.bouncycastle.pkcs.PKCS8EncryptedPrivateKeyInfo pkcs8Info,
char[] password)
解密
PKCS8EncryptedPrivateKeyInfo 为PrivateKeyInfo |
static KeyPair |
getKeyPair(org.bouncycastle.openssl.PEMKeyPair keyPair)
转换
PEMKeyPair 为KeyPair |
static PrivateKey |
getPrivateKey(org.bouncycastle.asn1.pkcs.PrivateKeyInfo privateKeyInfo)
转换
PrivateKeyInfo 为PrivateKey |
static PublicKey |
getPublicKey(org.bouncycastle.asn1.x509.SubjectPublicKeyInfo publicKeyInfo)
转换
SubjectPublicKeyInfo 为PublicKey |
static Key |
readPemKey(InputStream keyStream,
char[] password)
|
public static PrivateKey getPrivateKey(org.bouncycastle.asn1.pkcs.PrivateKeyInfo privateKeyInfo) throws CryptoException
PrivateKeyInfo
为PrivateKey
privateKeyInfo
- PrivateKeyInfo
PrivateKey
CryptoException
- PEMException
包装public static PublicKey getPublicKey(org.bouncycastle.asn1.x509.SubjectPublicKeyInfo publicKeyInfo) throws CryptoException
SubjectPublicKeyInfo
为PublicKey
publicKeyInfo
- SubjectPublicKeyInfo
PublicKey
CryptoException
- PEMException
包装public static KeyPair getKeyPair(org.bouncycastle.openssl.PEMKeyPair keyPair) throws CryptoException
PEMKeyPair
为KeyPair
keyPair
- PEMKeyPair
KeyPair
CryptoException
- PEMException
包装public static Key readPemKey(InputStream keyStream, char[] password)
keyStream
- pem 流password
- 私钥密码Key
,null 表示无法识别的密钥类型public static org.bouncycastle.asn1.pkcs.PrivateKeyInfo decrypt(org.bouncycastle.pkcs.PKCS8EncryptedPrivateKeyInfo pkcs8Info, char[] password) throws CryptoException
PKCS8EncryptedPrivateKeyInfo
为PrivateKeyInfo
pkcs8Info
- PKCS8EncryptedPrivateKeyInfo
password
- 密码PrivateKeyInfo
CryptoException
- OperatorCreationException和PKCSException包装public static org.bouncycastle.openssl.PEMKeyPair decrypt(org.bouncycastle.openssl.PEMEncryptedKeyPair pemEncryptedKeyPair, char[] password) throws IORuntimeException
PEMEncryptedKeyPair
为PEMKeyPair
pemEncryptedKeyPair
- PKCS8EncryptedPrivateKeyInfo
password
- 密码PEMKeyPair
IORuntimeException
- IOException包装Copyright © 2024. All rights reserved.