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 ofPrivateKey
for RSA keys which uses BoringSSL to perform all the operations.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
fetchedParams
(package private) OpenSSLKey
key
(package private) java.math.BigInteger
modulus
(package private) java.math.BigInteger
privateExponent
private static long
serialVersionUID
-
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) void
ensureReadParams()
boolean
equals(java.lang.Object o)
java.lang.String
getAlgorithm()
byte[]
getEncoded()
java.lang.String
getFormat()
(package private) static OpenSSLKey
getInstance(java.security.interfaces.RSAPrivateKey rsaPrivateKey)
(package private) static OpenSSLRSAPrivateKey
getInstance(OpenSSLKey key)
java.math.BigInteger
getModulus()
OpenSSLKey
getOpenSSLKey()
java.math.BigInteger
getPrivateExponent()
int
hashCode()
private static OpenSSLKey
init(java.security.spec.RSAPrivateKeySpec rsaKeySpec)
private void
readObject(java.io.ObjectInputStream stream)
(package private) void
readParams(byte[][] params)
java.lang.String
toString()
(package private) static OpenSSLKey
wrapJCAPrivateKeyForTLSStackOnly(java.security.PrivateKey privateKey, java.security.PublicKey publicKey)
Wraps the provided private key for use in the TLS/SSL stack only.(package private) static OpenSSLKey
wrapPlatformKey(java.security.interfaces.RSAPrivateKey rsaPrivateKey)
private void
writeObject(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:
getOpenSSLKey
in 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
/Cipher
implementation 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:
getPrivateExponent
in interfacejava.security.interfaces.RSAPrivateKey
-
getModulus
public final java.math.BigInteger getModulus()
- Specified by:
getModulus
in interfacejava.security.interfaces.RSAKey
-
getEncoded
public final byte[] getEncoded()
- Specified by:
getEncoded
in interfacejava.security.Key
-
getFormat
public final java.lang.String getFormat()
- Specified by:
getFormat
in interfacejava.security.Key
-
getAlgorithm
public final java.lang.String getAlgorithm()
- Specified by:
getAlgorithm
in interfacejava.security.Key
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
readObject
private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
writeObject
private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
-