org.globus.gsi.bc
public class BouncyCastleOpenSSLKey extends OpenSSLKey
Constructor and Description |
---|
BouncyCastleOpenSSLKey(java.io.InputStream is)
Reads a OpenSSL private key from the specified input stream.
|
BouncyCastleOpenSSLKey(java.security.PrivateKey key)
Converts a RSAPrivateCrtKey into OpenSSL key.
|
BouncyCastleOpenSSLKey(java.lang.String file)
Reads a OpenSSL private key from the specified file.
|
BouncyCastleOpenSSLKey(java.lang.String algorithm,
byte[] data)
Initializes the OpenSSL key from raw byte array.
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
getEncoded(java.security.PrivateKey key) |
protected java.security.PrivateKey |
getKey(java.lang.String alg,
byte[] data) |
protected java.lang.String |
getProvider() |
decrypt, decrypt, encrypt, encrypt, equals, getEncoded, getPrivateKey, hashCode, isEncrypted, setEncryptionAlgorithm, writeTo, writeTo, writeTo
public BouncyCastleOpenSSLKey(java.io.InputStream is) throws java.io.IOException, java.security.GeneralSecurityException
is
- input stream with OpenSSL key in PEM format.java.io.IOException
- if I/O problems.java.security.GeneralSecurityException
- if problems with the keypublic BouncyCastleOpenSSLKey(java.lang.String file) throws java.io.IOException, java.security.GeneralSecurityException
file
- file containing the OpenSSL key in PEM format.java.io.IOException
- if I/O problems.java.security.GeneralSecurityException
- if problems with the keypublic BouncyCastleOpenSSLKey(java.security.PrivateKey key)
key
- private key - must be a RSAPrivateCrtKeypublic BouncyCastleOpenSSLKey(java.lang.String algorithm, byte[] data) throws java.security.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.java.security.GeneralSecurityException
- if any security problems.protected java.security.PrivateKey getKey(java.lang.String alg, byte[] data) throws java.security.GeneralSecurityException
getKey
in class OpenSSLKey
java.security.GeneralSecurityException
protected byte[] getEncoded(java.security.PrivateKey key)
getEncoded
in class OpenSSLKey
protected java.lang.String getProvider()
getProvider
in class OpenSSLKey