Class XAdESTimestampDataBuilder

java.lang.Object
eu.europa.esig.dss.xades.validation.timestamp.XAdESTimestampDataBuilder
All Implemented Interfaces:
TimestampDataBuilder

public class XAdESTimestampDataBuilder
extends Object
implements TimestampDataBuilder
Builds a message-imprint for XAdES timestamps
  • Constructor Details

    • XAdESTimestampDataBuilder

      public XAdESTimestampDataBuilder​(Element signature, List<org.apache.xml.security.signature.Reference> references, XAdESPaths xadesPaths)
      Default constructor
      Parameters:
      signature - Element the signature element
      references - a list of found References
      xadesPaths - XAdESPaths
  • Method Details

    • getContentTimestampData

      public DSSDocument getContentTimestampData​(TimestampToken timestampToken)
      Description copied from interface: TimestampDataBuilder
      Returns the content timestamp data (timestamped or to be).
      Specified by:
      getContentTimestampData in interface TimestampDataBuilder
      Parameters:
      timestampToken - TimestampToken
      Returns:
      DSSDocument representing the canonicalized data to be timestamped
    • getSignatureTimestampData

      public DSSDocument getSignatureTimestampData​(TimestampToken timestampToken)
      Description copied from interface: TimestampDataBuilder
      Returns the data (signature value) that was timestamped by the SignatureTimeStamp for the given timestamp.
      Specified by:
      getSignatureTimestampData in interface TimestampDataBuilder
      Parameters:
      timestampToken - TimestampToken
      Returns:
      DSSDocument representing the canonicalized data to be timestamped
    • getSignatureTimestampData

      public byte[] getSignatureTimestampData​(String canonicalizationMethod)
      Returns SignatureTimestamp Data for a new Timestamp
      Parameters:
      canonicalizationMethod - String canonicalization method to use
      Returns:
      timestamp data
    • getSignatureTimestampData

      protected byte[] getSignatureTimestampData​(TimestampToken timestampToken, String canonicalizationMethod)
    • getTimestampX1Data

      public DSSDocument getTimestampX1Data​(TimestampToken timestampToken)
      Description copied from interface: TimestampDataBuilder
      Returns the data to be time-stamped. The data contains the digital signature (XAdES example: ds:SignatureValue element), the signature time-stamp(s) present in the AdES-T form, the certification path references and the revocation status references.
      Specified by:
      getTimestampX1Data in interface TimestampDataBuilder
      Parameters:
      timestampToken - TimestampToken or null during the creation process
      Returns:
      DSSDocument representing the canonicalized data to be timestamped
    • getTimestampX1Data

      public byte[] getTimestampX1Data​(String canonicalizationMethod)
      Returns SigAndRefsTimestamp/SigAndRefsTimestampV2 message-imprint data for a new timestamp
      Parameters:
      canonicalizationMethod - String canonicalization method to use
      Returns:
      message-imprint octets
    • getTimestampX1Data

      protected byte[] getTimestampX1Data​(TimestampToken timestampToken, String canonicalizationMethod)
      Computes the message-imprint for SigAndRefsTimestamp/SigAndRefsTimestampV2
      Parameters:
      timestampToken - TimestampToken on signature validation
      canonicalizationMethod - String the canonicalization method
      Returns:
      message-imprint octets
    • getTimestampX2Data

      public DSSDocument getTimestampX2Data​(TimestampToken timestampToken)
      Description copied from interface: TimestampDataBuilder
      Returns the data to be time-stamped which contains the concatenation of CompleteCertificateRefs and CompleteRevocationRefs elements (XAdES example).
      Specified by:
      getTimestampX2Data in interface TimestampDataBuilder
      Parameters:
      timestampToken - TimestampToken
      Returns:
      DSSDocument representing the canonicalized data to be timestamped
    • getTimestampX2Data

      public byte[] getTimestampX2Data​(String canonicalizationMethod)
      Returns RefsOnlyTimestamp/RefsOnlyTimestampV2 message-imprint data for a new timestamp
      Parameters:
      canonicalizationMethod - String canonicalization method to use
      Returns:
      message-imprint octets
    • getTimestampX2Data

      protected byte[] getTimestampX2Data​(TimestampToken timestampToken, String canonicalizationMethod)
      Computes the message-imprint for RefsOnlyTimestamp/RefsOnlyTimestampV2
      Parameters:
      timestampToken - TimestampToken on signature validation
      canonicalizationMethod - String the canonicalization method
      Returns:
      message-imprint octets
    • getArchiveTimestampData

      public DSSDocument getArchiveTimestampData​(TimestampToken timestampToken)
      Description copied from interface: TimestampDataBuilder
      Archive timestamp seals the data of the signature in a specific order. We need to retrieve the data for each timestamp.
      Specified by:
      getArchiveTimestampData in interface TimestampDataBuilder
      Parameters:
      timestampToken - TimestampToken null when adding a new archive timestamp
      Returns:
      DSSDocument representing the canonicalized data to be timestamped
    • getArchiveTimestampData

      public byte[] getArchiveTimestampData​(String canonicalizationMethod)
      Returns ArchiveTimestamp message-imprint data for a new timestamp
      Parameters:
      canonicalizationMethod - String canonicalization method to use
      Returns:
      message-imprint octets
    • getArchiveTimestampData

      protected byte[] getArchiveTimestampData​(TimestampToken timestampToken, String canonicalizationMethod)
      Gathers the data to be used to calculate the hash value sent to the TSA (messageImprint).
      Parameters:
      timestampToken - TimestampToken to validate, or null when adding a new archive timestamp
      canonicalizationMethod - String
      Returns:
      byte array containing the canonicalized and concatenated timestamped data