public final class

RSASignature

extends SignatureSpi
java.lang.Object
   ↳ java.security.SignatureSpi
     ↳ sun.security.ssl.RSASignature

Class Overview

Signature implementation for the SSL/TLS RSA Signature variant with both MD5 and SHA-1 MessageDigests. Used for explicit RSA server authentication (RSA signed server key exchange for RSA_EXPORT and DHE_RSA) and RSA client authentication (RSA signed certificate verify message). It conforms to the standard JCA Signature API. It is registered in the SunJSSE provider to avoid more complicated getInstance() code and negative interaction with the JCA mechanisms for hardware providers. The class should be instantiated via the getInstance() method in this class, which returns the implementation from the prefered provider. The internal implementation allows the hashes to be explicitly set, which is required for RSA client authentication. It can be obtained via the getInternalInstance() method. This class is not thread safe.

Summary

[Expand]
Inherited Fields
From class java.security.SignatureSpi
Public Constructors
RSASignature()
Protected Methods
Object engineGetParameter(String param)
This method is deprecated. No replacement.
void engineInitSign(PrivateKey privateKey, SecureRandom random)
Initializes this signature object with the specified private key and source of randomness for signing operations.
void engineInitSign(PrivateKey privateKey)
Initializes this signature object with the specified private key for signing operations.
void engineInitVerify(PublicKey publicKey)
Initializes this signature object with the specified public key for verification operations.
void engineSetParameter(String param, Object value)
This method is deprecated. Replaced by engineSetParameter.
byte[] engineSign()
Returns the signature bytes of all the data updated so far.
void engineUpdate(byte[] b, int off, int len)
Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.
void engineUpdate(byte b)
Updates the data to be signed or verified using the specified byte.
boolean engineVerify(byte[] sigBytes, int offset, int length)
Verifies the passed-in signature in the specified array of bytes, starting at the specified offset.
boolean engineVerify(byte[] sigBytes)
Verifies the passed-in signature.
[Expand]
Inherited Methods
From class java.security.SignatureSpi
From class java.lang.Object

Public Constructors

public RSASignature ()

Protected Methods

protected Object engineGetParameter (String param)

This method is deprecated.
No replacement.

Gets the value of the specified algorithm parameter. This method supplies a general-purpose mechanism through which it is possible to get the various parameters of this object. A parameter may be any settable parameter for the algorithm, such as a parameter size, or a source of random bits for signature generation (if appropriate), or an indication of whether or not to perform a specific but optional computation. A uniform algorithm-specific naming scheme for each parameter is desirable but left unspecified at this time.

Parameters
param the string name of the parameter.
Returns
  • the object that represents the parameter value, or null if there is none.

protected void engineInitSign (PrivateKey privateKey, SecureRandom random)

Initializes this signature object with the specified private key and source of randomness for signing operations.

This concrete method has been added to this previously-defined abstract class. (For backwards compatibility, it cannot be abstract.)

Parameters
privateKey the private key of the identity whose signature will be generated.
random the source of randomness

protected void engineInitSign (PrivateKey privateKey)

Initializes this signature object with the specified private key for signing operations.

Parameters
privateKey the private key of the identity whose signature will be generated.

protected void engineInitVerify (PublicKey publicKey)

Initializes this signature object with the specified public key for verification operations.

Parameters
publicKey the public key of the identity whose signature is going to be verified.

protected void engineSetParameter (String param, Object value)

This method is deprecated.
Replaced by engineSetParameter.

Sets the specified algorithm parameter to the specified value. This method supplies a general-purpose mechanism through which it is possible to set the various parameters of this object. A parameter may be any settable parameter for the algorithm, such as a parameter size, or a source of random bits for signature generation (if appropriate), or an indication of whether or not to perform a specific but optional computation. A uniform algorithm-specific naming scheme for each parameter is desirable but left unspecified at this time.

Parameters
param the string identifier of the parameter.
value the parameter value.

protected byte[] engineSign ()

Returns the signature bytes of all the data updated so far. The format of the signature depends on the underlying signature scheme.

Returns
  • the signature bytes of the signing operation's result.

protected void engineUpdate (byte[] b, int off, int len)

Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.

Parameters
b the array of bytes
off the offset to start from in the array of bytes
len the number of bytes to use, starting at offset

protected void engineUpdate (byte b)

Updates the data to be signed or verified using the specified byte.

Parameters
b the byte to use for the update.

protected boolean engineVerify (byte[] sigBytes, int offset, int length)

Verifies the passed-in signature in the specified array of bytes, starting at the specified offset.

Note: Subclasses should overwrite the default implementation.

Parameters
sigBytes the signature bytes to be verified.
offset the offset to start from in the array of bytes.
length the number of bytes to use, starting at offset.
Returns
  • true if the signature was verified, false if not.

protected boolean engineVerify (byte[] sigBytes)

Verifies the passed-in signature.

Parameters
sigBytes the signature bytes to be verified.
Returns
  • true if the signature was verified, false if not.