Module jpms_dss_spi

Class DSSMessageDigestCalculator

java.lang.Object
eu.europa.esig.dss.spi.DSSMessageDigestCalculator

public class DSSMessageDigestCalculator extends Object
This class is used to compute DSSMessageDigest based on the provided input
  • Constructor Summary

    Constructors
    Constructor
    Description
    DSSMessageDigestCalculator(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
    Default constructor with a single digest algorithm
    DSSMessageDigestCalculator(Collection<eu.europa.esig.dss.enumerations.DigestAlgorithm> digestAlgorithms)
    Constructor with multiple digest algorithms
  • Method Summary

    Modifier and Type
    Method
    Description
    eu.europa.esig.dss.model.DSSMessageDigest
    Deprecated.
    since DSS 6.3.
    eu.europa.esig.dss.model.DSSMessageDigest
    getMessageDigest(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
    Returns the DSSMessageDigest accordingly to the given digestAlgorithm This method resets the state of message-digest.
    Gets OutputStream that can be used to calculate digest on the fly.
    Gets OutputStream that can be used to calculate digest on the fly.
    void
    update(byte byteToAdd)
    Updates the digest using the provided byte
    void
    update(byte[] bytes)
    Updates the digest using the provided array of bytes
    void
    update(byte[] bytes, int offset, int length)
    Updates the bytes starting from the offset and a specified length
    void
    update(InputStream inputStream)
    Updates the digest by reading the provided InputStream.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DSSMessageDigestCalculator

      public DSSMessageDigestCalculator(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
      Default constructor with a single digest algorithm
      Parameters:
      digestAlgorithm - DigestAlgorithm to be used for message-digest computation
    • DSSMessageDigestCalculator

      public DSSMessageDigestCalculator(Collection<eu.europa.esig.dss.enumerations.DigestAlgorithm> digestAlgorithms)
      Constructor with multiple digest algorithms
      Parameters:
      digestAlgorithms - DigestAlgorithm to be used for message-digest computation
  • Method Details

    • update

      public void update(byte byteToAdd)
      Updates the digest using the provided byte
      Parameters:
      byteToAdd - byte to be added for digest computation
    • update

      public void update(byte[] bytes)
      Updates the digest using the provided array of bytes
      Parameters:
      bytes - array of bytes
    • update

      public void update(byte[] bytes, int offset, int length)
      Updates the bytes starting from the offset and a specified length
      Parameters:
      bytes - array of bytes
      offset - to start bytes update from
      length - the length of bytes array to be updated
    • update

      public void update(InputStream inputStream) throws IOException
      Updates the digest by reading the provided InputStream. NOTE: the method consumes the InputStream, and closes it after.
      Parameters:
      inputStream - InputStream
      Throws:
      IOException - if an error is thrown on InputStream reading
    • getMessageDigest

      @Deprecated public eu.europa.esig.dss.model.DSSMessageDigest getMessageDigest()
      Deprecated.
      since DSS 6.3. Please use #getMessageDigest(DigestAlgorithm) method instead.
      Returns the DSSMessageDigest accordingly to the current state. This method resets the state of message-digest.
      Returns:
      DSSMessageDigest
    • getMessageDigest

      public eu.europa.esig.dss.model.DSSMessageDigest getMessageDigest(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
      Returns the DSSMessageDigest accordingly to the given digestAlgorithm This method resets the state of message-digest.
      Parameters:
      digestAlgorithm - DigestAlgorithm to get a corresponding DSSMessageDigest for
      Returns:
      DSSMessageDigest
    • getOutputStream

      public OutputStream getOutputStream()
      Gets OutputStream that can be used to calculate digest on the fly. This method will update the digest within the current instance of DSSMessageDigestCalculator, when the returned OutputStream is being updated.
      Returns:
      OutputStream
    • getOutputStream

      public OutputStream getOutputStream(OutputStream outputStream)
      Gets OutputStream that can be used to calculate digest on the fly. This method will write the binaries into the provided outputStream as well as will update the digest within the current instance of DSSMessageDigestCalculator
      Parameters:
      outputStream - to be embedded into
      Returns:
      OutputStream