public class BouncyCastleOpenSSLKey extends OpenSSLKey
Constructor and Description |
---|
BouncyCastleOpenSSLKey(InputStream is)
Reads a OpenSSL private key from the specified input stream.
|
BouncyCastleOpenSSLKey(PrivateKey key)
Converts a RSAPrivateCrtKey into OpenSSL key.
|
BouncyCastleOpenSSLKey(String file)
Reads a OpenSSL private key from the specified file.
|
BouncyCastleOpenSSLKey(String algorithm,
byte[] data)
Initializes the OpenSSL key from raw byte array.
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
getEncoded(PrivateKey key) |
protected PrivateKey |
getKey(String alg,
byte[] data) |
protected String |
getProvider() |
decrypt, decrypt, encrypt, encrypt, equals, getEncoded, getPrivateKey, hashCode, isEncrypted, setEncryptionAlgorithm, writeTo, writeTo, writeTo
public BouncyCastleOpenSSLKey(InputStream is) throws IOException, GeneralSecurityException
is
- input stream with OpenSSL key in PEM format.IOException
- if I/O problems.GeneralSecurityException
- if problems with the keypublic BouncyCastleOpenSSLKey(String file) throws IOException, GeneralSecurityException
file
- file containing the OpenSSL key in PEM format.IOException
- if I/O problems.GeneralSecurityException
- if problems with the keypublic BouncyCastleOpenSSLKey(PrivateKey key)
key
- private key - must be a RSAPrivateCrtKeypublic BouncyCastleOpenSSLKey(String algorithm, byte[] data) throws GeneralSecurityException
algorithm
- the algorithm of the key. Currently only RSA algorithm is
supported.data
- the DER encoded key data. If RSA algorithm, the key must be in
PKCS#1 format.GeneralSecurityException
- if any security problems.protected PrivateKey getKey(String alg, byte[] data) throws GeneralSecurityException
getKey
in class OpenSSLKey
GeneralSecurityException
protected byte[] getEncoded(PrivateKey key)
getEncoded
in class OpenSSLKey
protected String getProvider()
getProvider
in class OpenSSLKey
Copyright © 2016. All rights reserved.