Top Description Fields Constructors Methods
sun.security.rsa

public final Class RSAPrivateKeyImpl

extends PKCS8Key
implements RSAPrivateKey
Class Inheritance
All Implemented Interfaces
java.security.interfaces.RSAPrivateKey, java.security.interfaces.RSAKey, java.security.PrivateKey, javax.security.auth.Destroyable, java.security.AsymmetricKey, java.security.Key, java.io.Serializable
Imports
java.io.IOException, .InvalidObjectException, .ObjectInputStream, java.math.BigInteger, java.security.*, java.security.spec.AlgorithmParameterSpec, java.security.interfaces.*, java.util.Arrays, sun.security.util.*, sun.security.pkcs.PKCS8Key, sun.security.rsa.RSAUtil.KeyType

RSA private key implementation for "RSA", "RSASSA-PSS" algorithms in non-CRT form (modulus, private exponent only).

For CRT private keys, see RSAPrivateCrtKeyImpl. We need separate classes to ensure correct behavior in instanceof checks, etc.

Note

RSA keys must be at least 512 bits long

Author
Andreas Sterbenz
Since
1.5
See Also
RSAPrivateCrtKeyImpl, RSAKeyFactory

Field Summary

Modifier and TypeField and Description
private final BigInteger
d

private final transient AlgorithmParameterSpec
private final BigInteger
n

private static final long
private final transient RSAUtil.KeyType
Inherited from sun.security.pkcs.PKCS8Key:
algidencodedKeykey

Constructor Summary

AccessConstructor and Description
pack-priv
RSAPrivateKeyImpl(RSAUtil.KeyType type, AlgorithmParameterSpec keyParams, BigInteger n, BigInteger d)

Construct a key from its components.

Method Summary

Modifier and TypeMethod and Description
public String
getAlgorithm()

Overrides sun.security.pkcs.PKCS8Key.getAlgorithm.

Implements java.security.Key.getAlgorithm.

Returns the standard algorithm name for this key.
public BigInteger
getModulus()

Implements java.security.interfaces.RSAKey.getModulus.

Returns the modulus.
public AlgorithmParameterSpec
getParams()

Overrides default java.security.interfaces.RSAPrivateKey.getParams, java.security.AsymmetricKey.getParams.

Returns the parameters associated with this key.
public BigInteger
private void
readObject(ObjectInputStream
the ObjectInputStream from which data is read
stream
)

Hides sun.security.pkcs.PKCS8Key.readObject.

Restores the state of this object from the stream.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from sun.security.pkcs.PKCS8Key:
clearequalsgetAlgorithmIdgetEncodedgetFormathashCodeparseKeywriteReplace

Field Detail

dback to summary
private final BigInteger d
keyParamsback to summary
private final transient AlgorithmParameterSpec keyParams
nback to summary
private final BigInteger n
serialVersionUIDback to summary
private static final long serialVersionUID

Hides sun.security.pkcs.PKCS8Key.serialVersionUID, java.security.interfaces.RSAPrivateKey.serialVersionUID, java.security.PrivateKey.serialVersionUID.

Annotations
@Serial
typeback to summary
private final transient RSAUtil.KeyType type

Constructor Detail

RSAPrivateKeyImplback to summary
pack-priv RSAPrivateKeyImpl(RSAUtil.KeyType type, AlgorithmParameterSpec keyParams, BigInteger n, BigInteger d) throws InvalidKeyException

Construct a key from its components. Used by the RSAKeyFactory and the RSAKeyPairGenerator.

Method Detail

getAlgorithmback to summary
public String getAlgorithm()

Overrides sun.security.pkcs.PKCS8Key.getAlgorithm.

Implements java.security.Key.getAlgorithm.

Doc from java.security.Key.getAlgorithm.

Returns the standard algorithm name for this key. For example, "DSA" would indicate that this key is a DSA key. See the key related sections (KeyFactory, KeyGenerator, KeyPairGenerator, and SecretKeyFactory) in the Java Security Standard Algorithm Names Specification for information about standard key algorithm names.

Returns:String

the name of the algorithm associated with this key.

Annotations
@Override
getModulusback to summary
public BigInteger getModulus()

Implements java.security.interfaces.RSAKey.getModulus.

Doc from java.security.interfaces.RSAKey.getModulus.

Returns the modulus.

Returns:BigInteger

the modulus

Annotations
@Override
getParamsback to summary
public AlgorithmParameterSpec getParams()

Overrides default java.security.interfaces.RSAPrivateKey.getParams, java.security.AsymmetricKey.getParams.

Doc from java.security.interfaces.RSAPrivateKey.getParams.

Returns the parameters associated with this key. The parameters are optional and may be either explicitly specified or implicitly created during key pair generation.

Returns:AlgorithmParameterSpec

the associated parameters, may be null

Annotations
@Override
getPrivateExponentback to summary
public BigInteger getPrivateExponent()

Implements java.security.interfaces.RSAPrivateKey.getPrivateExponent.

Doc from java.security.interfaces.RSAPrivateKey.getPrivateExponent.

Returns the private exponent.

Returns:BigInteger

the private exponent

Annotations
@Override
readObjectback to summary
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException

Hides sun.security.pkcs.PKCS8Key.readObject.

Restores the state of this object from the stream.

Deserialization of this object is not supported.

Parameters
stream:ObjectInputStream

the ObjectInputStream from which data is read

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if a serialized class cannot be loaded
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override