Class ERSArchiveTimeStampGenerator

java.lang.Object
org.bouncycastle.tsp.ers.ERSArchiveTimeStampGenerator

public class ERSArchiveTimeStampGenerator extends Object
Generator for RFC 4998 ArchiveTimeStamps. Data objects (and data groups) are added, reduced to a single root hash via the Merkle hash tree built over their PartialHashtree leaves, and a time-stamp request for that root is produced; the returned time-stamp response is then turned into one or more ERSArchiveTimeStamps carrying the reduced hash tree for each object.
  • Constructor Details

    • ERSArchiveTimeStampGenerator

      public ERSArchiveTimeStampGenerator(DigestCalculator digCalc)
  • Method Details

    • addData

      public void addData(ERSData dataObject)
      Add a data object (or data group) to be covered by the archive time-stamp.
      Parameters:
      dataObject - the data object/group to add.
    • addAllData

      public void addAllData(List<ERSData> dataObjects)
      Add a list of data objects (or data groups) to be covered by the archive time-stamp.
      Parameters:
      dataObjects - the data objects/groups to add.
    • generateTimeStampRequest

      public TimeStampRequest generateTimeStampRequest(TimeStampRequestGenerator tspReqGenerator) throws TSPException, IOException
      Generate a time-stamp request for the root hash of the Merkle tree built over the data objects added so far.
      Parameters:
      tspReqGenerator - generator to use for building the request.
      Returns:
      a time-stamp request over the computed root hash.
      Throws:
      TSPException - on a time-stamp processing error.
      IOException - on an encoding error.
    • generateTimeStampRequest

      public TimeStampRequest generateTimeStampRequest(TimeStampRequestGenerator tspReqGenerator, BigInteger nonce) throws TSPException, IOException
      Generate a time-stamp request for the root hash with the passed in nonce.
      Parameters:
      tspReqGenerator - generator to use for building the request.
      nonce - nonce to include in the request.
      Returns:
      a time-stamp request over the computed root hash.
      Throws:
      TSPException - on a time-stamp processing error.
      IOException - on an encoding error.
    • generateArchiveTimeStamp

      public ERSArchiveTimeStamp generateArchiveTimeStamp(TimeStampResponse tspResponse) throws TSPException, ERSException
      Generate a single ArchiveTimeStamp from the passed in time-stamp response. The response's imprint must match the algorithm and root hash of the data added; this form requires exactly one data object (one reduced hash tree).
      Parameters:
      tspResponse - the response carrying the time-stamp over the root hash.
      Returns:
      the ArchiveTimeStamp covering the added data.
      Throws:
      TSPException - if the response has an error status or its imprint does not match.
      ERSException - if more than one reduced hash tree is present, or on a processing error.
    • generateArchiveTimeStamps

      public List<ERSArchiveTimeStamp> generateArchiveTimeStamps(TimeStampResponse tspResponse) throws TSPException, ERSException
      Generate one ArchiveTimeStamp per added data object from the passed in time-stamp response, each carrying the reduced hash tree (the sibling path through the Merkle tree) needed to recover the time-stamped root for that object.
      Parameters:
      tspResponse - the response carrying the time-stamp over the root hash.
      Returns:
      a list of ArchiveTimeStamps, one per data object, in the order the data was added.
      Throws:
      TSPException - if the response has an error status or its imprint does not match.
      ERSException - on a processing error.