Package org.bouncycastle.tsp.ers
Class ERSArchiveTimeStampGenerator
- java.lang.Object
-
- org.bouncycastle.tsp.ers.ERSArchiveTimeStampGenerator
-
public class ERSArchiveTimeStampGenerator extends java.lang.ObjectGenerator 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 moreERSArchiveTimeStamps carrying the reduced hash tree for each object.
-
-
Constructor Summary
Constructors Constructor Description ERSArchiveTimeStampGenerator(DigestCalculator digCalc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAllData(java.util.List<ERSData> dataObjects)Add a list of data objects (or data groups) to be covered by the archive time-stamp.voidaddData(ERSData dataObject)Add a data object (or data group) to be covered by the archive time-stamp.ERSArchiveTimeStampgenerateArchiveTimeStamp(TimeStampResponse tspResponse)Generate a single ArchiveTimeStamp from the passed in time-stamp response.java.util.List<ERSArchiveTimeStamp>generateArchiveTimeStamps(TimeStampResponse tspResponse)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.TimeStampRequestgenerateTimeStampRequest(TimeStampRequestGenerator tspReqGenerator)Generate a time-stamp request for the root hash of the Merkle tree built over the data objects added so far.TimeStampRequestgenerateTimeStampRequest(TimeStampRequestGenerator tspReqGenerator, java.math.BigInteger nonce)Generate a time-stamp request for the root hash with the passed in nonce.
-
-
-
Constructor Detail
-
ERSArchiveTimeStampGenerator
public ERSArchiveTimeStampGenerator(DigestCalculator digCalc)
-
-
Method Detail
-
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(java.util.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, java.io.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.java.io.IOException- on an encoding error.
-
generateTimeStampRequest
public TimeStampRequest generateTimeStampRequest(TimeStampRequestGenerator tspReqGenerator, java.math.BigInteger nonce) throws TSPException, java.io.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.java.io.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 java.util.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.
-
-