All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class iaik.security.rsa.RSASignature

java.lang.Object
   |
   +----java.security.Signature
           |
           +----iaik.security.rsa.RSASignature

public class RSASignature
extends Signature
This Signature class is used to provide the functionality of the RSA digital signature algorithm with any hash algorithm. Digital signatures are used for authentication and integrity assurance of digital data. To create a RSASignature with a specific hash algorithm you have to subclass this class and to set the variable hash to the desird hash algorithm. See Md5RSASignature, ShaRSASignature.

See Also:
Md5RSASignature, ShaRSASignature

Variable Index

 o hash

Constructor Index

 o RSASignature(AlgorithmID)
Creates a RSA Signature Object with a specified hash algorithm.

Method Index

 o engineGetParameter(String)
SPI: Gets the value of the specified algorithm parameter.
 o engineInitSign(PrivateKey)
SPI:Initializes this signature object with the specified private key for signing operations.
 o engineInitVerify(PublicKey)
SPI: Initializes this signature object with the specified public key for verification operations.
 o engineSetParameter(String, Object)
SPI: Sets the specified algorithm parameter to the specified value.
 o engineSign()
SPI: Returns the signature bytes of all the data updated so far.
 o engineUpdate(byte)
SPI: Updates the data to be signed or verified using the specified byte.
 o engineUpdate(byte[], int, int)
SPI: Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.
 o engineVerify(byte[])
Verifies the signature of a message defined in PKCS#1

Variables

 o hash
 protected MessageDigest hash

Constructors

 o RSASignature
 protected RSASignature(AlgorithmID algorithm)
Creates a RSA Signature Object with a specified hash algorithm. This method is called from subclasses which represent a RSA signature with a defined hash algorithm like Md5RSASignature or ShaRSASignature.

Parameters:
algorithm - the hash algorithm to use

Methods

 o engineInitVerify
 protected void engineInitVerify(PublicKey pk) throws InvalidKeyException
SPI: Initializes this signature object with the specified public key for verification operations.

Parameters:
publicKey - a public key.
Throws: InvalidKeyException
if the key is improperly encoded, parameters are missing, and so on.
Overrides:
engineInitVerify in class Signature
 o engineInitSign
 protected void engineInitSign(PrivateKey pk) throws InvalidKeyException
SPI:Initializes this signature object with the specified private key for signing operations.

Parameters:
privateKey - a private key.
Throws: InvalidKeyException
if the key is improperly encoded, parameters are missing, and so on.
Overrides:
engineInitSign in class Signature
 o engineSign
 protected byte[] engineSign() throws SignatureException
SPI: Returns the signature bytes of all the data updated so far. The signature is returned as defined in PKCS#1.

Returns:
the signature bytes of the signing operation's result.
Throws: SignatureException
if the signature is not initialized properly or an other problem occurs.
Overrides:
engineSign in class Signature
 o engineVerify
 protected boolean engineVerify(byte sigBytes[]) throws SignatureException
Verifies the signature of a message defined in PKCS#1

Parameters:
sigBytes - the RSA encrypted DigestInfo ASN1 type
Returns:
true if signature is OK
Throws: SignatureException
if the signature is not initialized properly, or it is improperly encoded or of the wrong type, etc.
Overrides:
engineVerify in class Signature
 o engineUpdate
 protected void engineUpdate(byte b)
SPI: Updates the data to be signed or verified using the specified byte.

Parameters:
b - the byte to update.
Overrides:
engineUpdate in class Signature
 o engineUpdate
 protected void engineUpdate(byte b[],
                             int off,
                             int len)
SPI: Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.

Parameters:
data - 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.
Overrides:
engineUpdate in class Signature
 o engineSetParameter
 protected void engineSetParameter(String param,
                                   Object value) throws InvalidParameterException
SPI: Sets the specified algorithm parameter to the specified value. This method is not implemented.

Overrides:
engineSetParameter in class Signature
 o engineGetParameter
 protected Object engineGetParameter(String param) throws InvalidParameterException
SPI: Gets the value of the specified algorithm parameter. This method is not implemented.

Overrides:
engineGetParameter in class Signature

All Packages  Class Hierarchy  This Package  Previous  Next  Index