iaik.security.rsa
Class SSLRSASignature

java.lang.Object
  |
  +--java.security.SignatureSpi
        |
        +--java.security.Signature
              |
              +--iaik.security.rsa.SSLRSASignature

public class SSLRSASignature
extends Signature

THIS CLASS IS OUTDATED AND SHOULD NOT BE USED ANY LONGER. It was originally written for use by the iSaSiLk library, but it is not used for this purpose any longer. It will probably be removed in a future release, if you still need it please contact jce-sales@iaik.at.

This class implements a special form of a RSA Signature as used within the Secure Sockets Layer (SSL v3.0) protocol.

SSL handles digital signatures by either using the Digital Signature Algorithm (DSA) or a RSA based method. This class implements the RSA version od SSL digital signing, where the SHA and MD5 hash algorithms are used to form 36-byte structure, which subsequently is signed (encrypted with the RSA private key).

In contrast to Md5RSASignature and ShaRSASignature this class not only calls the superclass constructor specifying the hash algorithm to be used. This class overrides all the methods of the superclass according to the particular signature requirements of the SSLv3 protocol.

The general proceeding for signing a message (e.g. build up of client_hello_random + server_hello_random + params) or verifying a signature follows the common guidelines prescribing three steps to be performed:

Version:
File Revision 18
See Also:
RSASignature, ShaRSASignature, Md5RSASignature, Signature, Md5, SHA

Fields inherited from class java.security.Signature
SIGN, state, UNINITIALIZED, VERIFY
 
Fields inherited from class java.security.SignatureSpi
appRandom
 
Constructor Summary
SSLRSASignature()
          The default constructor.
 
Method Summary
protected  Object engineGetParameter(String param)
          This method is not implemented and only throws an InvalidParameterException
protected  void engineInitSign(PrivateKey pk)
          SPI: Initializes this signature object with the given RSA private key for going to sign some data.
protected  void engineInitVerify(PublicKey pk)
          SPI: Initializes this signature object with the given RSA public key for performing a signature verification.
protected  void engineSetParameter(String param, Object value)
          This method is not implemented and only throws an InvalidParameterException
protected  byte[] engineSign()
          SPI: Returns a byte array holding the signature resulting from all already performed data update operations.
protected  void engineUpdate(byte b)
          SPI: Updates the data to be signed or verified with the specified byte.
protected  void engineUpdate(byte[] b, int off, int len)
          SPI: Updates the data to be signed or verified with the specified number of bytes, beginning at the specified offset within the given byte array.
protected  boolean engineVerify(byte[] sigBytes)
          Verifies the given signature of a message according to SSL v3.0.
 
Methods inherited from class java.security.Signature
clone, getAlgorithm, getInstance, getInstance, getParameter, getProvider, initSign, initSign, initVerify, initVerify, setParameter, setParameter, sign, sign, toString, update, update, update, verify
 
Methods inherited from class java.security.SignatureSpi
engineInitSign, engineSetParameter, engineSign
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SSLRSASignature

public SSLRSASignature()
                throws NoSuchAlgorithmException
The default constructor. Creates a new SSL/RSA Signature object.
Throws:
NoSuchAlgorithmException - if there is no implementation for MD5 or SHA
Method Detail

engineInitVerify

protected void engineInitVerify(PublicKey pk)
                         throws InvalidKeyException
SPI: Initializes this signature object with the given RSA public key for performing a signature verification.
Overrides:
engineInitVerify in class SignatureSpi
Parameters:
publicKey - the RSA public key belonging to the RSA private key that has been used for signing.
Throws:
InvalidKeyException - if a key encoding error occurs

engineInitSign

protected void engineInitSign(PrivateKey pk)
                       throws InvalidKeyException
SPI: Initializes this signature object with the given RSA private key for going to sign some data.
Overrides:
engineInitSign in class SignatureSpi
Parameters:
privateKey - the RSA private key to be used for signing.
Throws:
InvalidKeyException - if a key encoding error occurs

engineSign

protected byte[] engineSign()
                     throws SignatureException
SPI: Returns a byte array holding the signature resulting from all already performed data update operations. The signature is returned as defined in SSL v3.0.

According to SSLv3 the data is digested with both Md5 and SHA algorithms before encrypting the result using the RSA algorithm with PKCS#1 padding.

Overrides:
engineSign in class SignatureSpi
Returns:
a byte array holding the signature
Throws:
SignatureException - if an error occurs when creating the signature

engineVerify

protected boolean engineVerify(byte[] sigBytes)
                        throws SignatureException
Verifies the given signature of a message according to SSL v3.0.

According to SSLv3 the data is digested with both Md5 and SHA algorithms before decrypting it using the RSA algorithm.

Overrides:
engineVerify in class SignatureSpi
Parameters:
sigBytes - the signature bytes to be verified
Returns:
true if signature is OK, false if not
Throws:
SignatureException - if an error occurs when verifying the signature

engineUpdate

protected void engineUpdate(byte b)
SPI: Updates the data to be signed or verified with the specified byte.
Overrides:
engineUpdate in class SignatureSpi
Parameters:
b - the byte to update.

engineUpdate

protected void engineUpdate(byte[] b,
                            int off,
                            int len)
SPI: Updates the data to be signed or verified with the specified number of bytes, beginning at the specified offset within the given byte array.
Overrides:
engineUpdate in class SignatureSpi
Parameters:
data - the byte array holding the data to be used for this update operation.
off - the offset, indicating the start position within the given byte array.
len - the number of bytes to be obtained from the given byte array, starting at the given position.

engineSetParameter

protected void engineSetParameter(String param,
                                  Object value)
                           throws InvalidParameterException
This method is not implemented and only throws an InvalidParameterException
Overrides:
engineSetParameter in class SignatureSpi
Throws:
InvalidParameterException - This Method is not supported

engineGetParameter

protected Object engineGetParameter(String param)
                             throws InvalidParameterException
This method is not implemented and only throws an InvalidParameterException
Overrides:
engineGetParameter in class SignatureSpi
Throws:
InvalidParameterException - This Method is not supported

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK