Package org.conscrypt
Class OpenSSLRSAPrivateKey
- java.lang.Object
-
- org.conscrypt.OpenSSLRSAPrivateKey
-
- All Implemented Interfaces:
java.io.Serializable,java.security.interfaces.RSAKey,java.security.interfaces.RSAPrivateKey,java.security.Key,java.security.PrivateKey,javax.security.auth.Destroyable,OpenSSLKeyHolder
- Direct Known Subclasses:
OpenSSLRSAPrivateCrtKey
class OpenSSLRSAPrivateKey extends java.lang.Object implements java.security.interfaces.RSAPrivateKey, OpenSSLKeyHolder
An implementation ofPrivateKeyfor RSA keys which uses BoringSSL to perform all the operations.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) booleanfetchedParams(package private) OpenSSLKeykey(package private) java.math.BigIntegermodulus(package private) java.math.BigIntegerprivateExponentprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description OpenSSLRSAPrivateKey(java.security.spec.RSAPrivateKeySpec rsaKeySpec)OpenSSLRSAPrivateKey(OpenSSLKey key)OpenSSLRSAPrivateKey(OpenSSLKey key, byte[][] params)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidensureReadParams()booleanequals(java.lang.Object o)java.lang.StringgetAlgorithm()byte[]getEncoded()java.lang.StringgetFormat()(package private) static OpenSSLKeygetInstance(java.security.interfaces.RSAPrivateKey rsaPrivateKey)(package private) static OpenSSLRSAPrivateKeygetInstance(OpenSSLKey key)java.math.BigIntegergetModulus()OpenSSLKeygetOpenSSLKey()java.math.BigIntegergetPrivateExponent()inthashCode()private static OpenSSLKeyinit(java.security.spec.RSAPrivateKeySpec rsaKeySpec)private voidreadObject(java.io.ObjectInputStream stream)(package private) voidreadParams(byte[][] params)java.lang.StringtoString()(package private) static OpenSSLKeywrapJCAPrivateKeyForTLSStackOnly(java.security.PrivateKey privateKey, java.security.PublicKey publicKey)Wraps the provided private key for use in the TLS/SSL stack only.(package private) static OpenSSLKeywrapPlatformKey(java.security.interfaces.RSAPrivateKey rsaPrivateKey)private voidwriteObject(java.io.ObjectOutputStream stream)
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
key
transient OpenSSLKey key
-
fetchedParams
transient boolean fetchedParams
-
modulus
java.math.BigInteger modulus
-
privateExponent
java.math.BigInteger privateExponent
-
-
Constructor Detail
-
OpenSSLRSAPrivateKey
OpenSSLRSAPrivateKey(OpenSSLKey key)
-
OpenSSLRSAPrivateKey
OpenSSLRSAPrivateKey(OpenSSLKey key, byte[][] params)
-
OpenSSLRSAPrivateKey
public OpenSSLRSAPrivateKey(java.security.spec.RSAPrivateKeySpec rsaKeySpec) throws java.security.spec.InvalidKeySpecException- Throws:
java.security.spec.InvalidKeySpecException
-
-
Method Detail
-
getOpenSSLKey
public OpenSSLKey getOpenSSLKey()
- Specified by:
getOpenSSLKeyin interfaceOpenSSLKeyHolder
-
init
private static OpenSSLKey init(java.security.spec.RSAPrivateKeySpec rsaKeySpec) throws java.security.spec.InvalidKeySpecException
- Throws:
java.security.spec.InvalidKeySpecException
-
getInstance
static OpenSSLRSAPrivateKey getInstance(OpenSSLKey key)
-
wrapPlatformKey
static OpenSSLKey wrapPlatformKey(java.security.interfaces.RSAPrivateKey rsaPrivateKey) throws java.security.InvalidKeyException
- Throws:
java.security.InvalidKeyException
-
wrapJCAPrivateKeyForTLSStackOnly
static OpenSSLKey wrapJCAPrivateKeyForTLSStackOnly(java.security.PrivateKey privateKey, java.security.PublicKey publicKey) throws java.security.InvalidKeyException
Wraps the provided private key for use in the TLS/SSL stack only. Sign/decrypt operations using the key will be delegated to theSignature/Cipherimplementation of the provider which accepts the key.- Throws:
java.security.InvalidKeyException
-
getInstance
static OpenSSLKey getInstance(java.security.interfaces.RSAPrivateKey rsaPrivateKey) throws java.security.InvalidKeyException
- Throws:
java.security.InvalidKeyException
-
ensureReadParams
final void ensureReadParams()
-
readParams
void readParams(byte[][] params)
-
getPrivateExponent
public final java.math.BigInteger getPrivateExponent()
- Specified by:
getPrivateExponentin interfacejava.security.interfaces.RSAPrivateKey
-
getModulus
public final java.math.BigInteger getModulus()
- Specified by:
getModulusin interfacejava.security.interfaces.RSAKey
-
getEncoded
public final byte[] getEncoded()
- Specified by:
getEncodedin interfacejava.security.Key
-
getFormat
public final java.lang.String getFormat()
- Specified by:
getFormatin interfacejava.security.Key
-
getAlgorithm
public final java.lang.String getAlgorithm()
- Specified by:
getAlgorithmin interfacejava.security.Key
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
readObject
private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
writeObject
private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException- Throws:
java.io.IOException
-
-