public class OpenSSLKey extends Object
Constructor and Description |
---|
OpenSSLKey(long ctx) |
OpenSSLKey(long ctx,
boolean wrapped) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
static OpenSSLKey |
fromECPrivateKeyForTLSStackOnly(PrivateKey key,
ECParameterSpec ecParams)
Gets an
OpenSSLKey instance backed by the provided EC private key. |
static OpenSSLKey |
fromPrivateKey(PrivateKey key) |
static OpenSSLKey |
fromPrivateKeyForTLSStackOnly(PrivateKey privateKey,
PublicKey publicKey)
Gets an
OpenSSLKey instance backed by the provided private key. |
static OpenSSLKey |
fromPrivateKeyPemInputStream(InputStream is)
Parse a private key in PEM encoding from the provided input stream.
|
static OpenSSLKey |
fromPublicKey(PublicKey key) |
static OpenSSLKey |
fromPublicKeyPemInputStream(InputStream is)
Parse a public key in PEM encoding from the provided input stream.
|
NativeRef.EVP_PKEY |
getNativeRef()
Returns the EVP_PKEY context for use in JNI calls.
|
PrivateKey |
getPrivateKey() |
PublicKey |
getPublicKey() |
int |
hashCode() |
boolean |
isWrapped() |
public OpenSSLKey(long ctx)
public OpenSSLKey(long ctx, boolean wrapped)
public NativeRef.EVP_PKEY getNativeRef()
public boolean isWrapped()
public static OpenSSLKey fromPrivateKey(PrivateKey key) throws InvalidKeyException
InvalidKeyException
public static OpenSSLKey fromPrivateKeyPemInputStream(InputStream is) throws InvalidKeyException
InvalidKeyException
- if parsing failspublic static OpenSSLKey fromPrivateKeyForTLSStackOnly(PrivateKey privateKey, PublicKey publicKey) throws InvalidKeyException
OpenSSLKey
instance backed by the provided private key. The resulting key is
usable only by this provider's TLS/SSL stack.privateKey
- private key.publicKey
- corresponding public key or null
if not available. Some opaque
private keys cannot be used by the TLS/SSL stack without the public key.InvalidKeyException
public static OpenSSLKey fromECPrivateKeyForTLSStackOnly(PrivateKey key, ECParameterSpec ecParams) throws InvalidKeyException
OpenSSLKey
instance backed by the provided EC private key. The resulting key
is usable only by this provider's TLS/SSL stack.key
- private key.ecParams
- EC parameters null
if not available. Some opaque private keys cannot
be used by the TLS/SSL stack without the parameters because the private key itself
might not expose the parameters.InvalidKeyException
public static OpenSSLKey fromPublicKey(PublicKey key) throws InvalidKeyException
InvalidKeyException
public static OpenSSLKey fromPublicKeyPemInputStream(InputStream is) throws InvalidKeyException
InvalidKeyException
- if parsing failspublic PublicKey getPublicKey() throws NoSuchAlgorithmException
NoSuchAlgorithmException
public PrivateKey getPrivateKey() throws NoSuchAlgorithmException
NoSuchAlgorithmException