iaik.security.rsa
Class RawRSAPssSignature

java.lang.Object
  |
  +--java.security.SignatureSpi
        |
        +--java.security.Signature
              |
              +--iaik.security.rsa.RSAPkcs1Signature
                    |
                    +--iaik.security.rsa.RSAPssSignature
                          |
                          +--iaik.security.rsa.RawRSAPssSignature

public class RawRSAPssSignature
extends RSAPssSignature

This class represents a "raw" implemention of the RSA PKCS#1v2.1 RSASSA-PSS digital signature algorithm where the hash on the data to be signed has to be calculated by the application.

This class may be used in a similar way than parent class RSAPssSignature except that the message hash value has to be calculated by the application. All required parameters (hash algorithm, mask generation algorithm, salt length) have to be supplied as RSAPssParameterSpec. As defined for PSS the trailer field is fixed to 0xBC.

Generally the following steps have to be performed for calculating/verifying a PSS signature when using this "raw" signature engine:

Please note that in step 3) above when supplying the parameters it would not make sense to also set a hash engine since the message hash has to be calculated outside the engine by the calling application. This does not apply to the mask generation function which may be based on a hash algorithm (like MGF1). Any required hash operation except calculating the message hash may be done by the signature engine itself.

Please note that it is the entire responsibility of the application to take care to provide a proper hash value when calling an update method; no check is performed if the supplied hash value corresponds to the hash algorithm in use (e.g. has the correct length).

  • Please note that in contrast to PKCS1v1.5 -- where attacks that are based on hash algorithm compromise ("hash function substitution") are caught by including the hash algorithm id in the DigestInfo encoding -- no such mechanism is used by the PSS signature scheme. So hash function substitution has to be addressed by other means when using PSS. One possible solution is to use the same hash function for message hashing and any hash operations done by the mask generation function (if based on a hash algorithm). This is ensured for all JCA based hash engines where the hash algorithm(s) to be used are already given by the implementing class: SHA1withRSAandMGF1, for instance, uses the SHA-1 algorithm for both message hashing and MGF1 hash operations. When using this general RSASSA-PSS signature engine, hash algorithm and mask generation function have to be supplied by the calling application. In this case it is the responsibility of the application to take care of hash function substitution issues - if desired. This may be done by, for instance, setting the same hash algorithm parameter for message hashing and MGF hashing, or, for instance, using one and only hash algorithm in any case, or following any other suitable strategy.
  • Version:
    File Revision 12
    See Also:
    RSAPssSignature

    Fields inherited from class iaik.security.rsa.RSAPssSignature
    hash
     
    Fields inherited from class java.security.Signature
    SIGN, state, UNINITIALIZED, VERIFY
     
    Fields inherited from class java.security.SignatureSpi
    appRandom
     
    Constructor Summary
    RawRSAPssSignature()
              Default constructor.
     
    Method Summary
    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.
     
    Methods inherited from class iaik.security.rsa.RSAPssSignature
    engineGetParameter, engineGetParameters, engineInitSign, engineInitSign, engineInitVerify, engineSetParameter, engineSetParameter, engineSign, engineVerify
     
    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
    engineSign
     
    Methods inherited from class java.lang.Object
    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Constructor Detail

    RawRSAPssSignature

    public RawRSAPssSignature()
    Default constructor.

    An application shall call

     Signature.getInstance("RawRSASSA-PSS");
     
    to get the required raw PSS signature engine.
    Method Detail

    engineUpdate

    protected void engineUpdate(byte b)
    SPI: Updates the data to be signed or verified with the specified byte. Only feeds the byte to the internal buffer.
    Overrides:
    engineUpdate in class iaik.security.rsa.RSAPkcs1Signature
    Parameters:
    b - the byte to be used for updating.

    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. Only feeds the bytes to the internal buffer.
    Overrides:
    engineUpdate in class iaik.security.rsa.RSAPkcs1Signature
    Parameters:
    b - 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.

    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