Class ERSArchiveTimeStamp
java.lang.Object
org.bouncycastle.tsp.ers.ERSArchiveTimeStamp
Carrier for an RFC 4998 ArchiveTimeStamp - an RFC 3161 time-stamp token
together with the reduced hash tree (a sequence of PartialHashtrees) that
binds a particular data object or data group to the time-stamped root hash.
Provides operations to recover the root hash, confirm a data object is
present, and validate the underlying time-stamp signature.
-
Constructor Summary
ConstructorsConstructorDescriptionERSArchiveTimeStamp(byte[] archiveTimeStamp, DigestCalculatorProvider digCalcProv) Create an archive time-stamp from an encoded ArchiveTimeStamp.ERSArchiveTimeStamp(org.bouncycastle.asn1.tsp.ArchiveTimeStamp archiveTimeStamp, DigestCalculatorProvider digCalcProv) Create an archive time-stamp from a parsed ArchiveTimeStamp structure. -
Method Summary
Modifier and TypeMethodDescriptionstatic ERSArchiveTimeStampfromTimeStampToken(TimeStampToken tspToken, DigestCalculatorProvider digCalcProv) Build an ArchiveTimeStamp from a regular time stamp token.org.bouncycastle.asn1.x509.AlgorithmIdentifierbyte[]return the ASN.1 encoded representation of this object.Return the not-after date for the time-stamp's signing certificate if it is present.Return the generation time of the time-stamp associated with this archive time stamp.Return the TimeStamp signing certificate if it is present.booleanisContaining(ERSData data, Date atDate) Return true if the passed in data object/group is present in this archive time-stamp at the given date.org.bouncycastle.asn1.tsp.ArchiveTimeStampReturn the underlying ASN.1 ArchiveTimeStamp structure.voidvalidate(SignerInformationVerifier verifier) Validate the time stamp associated with this ArchiveTimeStamp.voidvalidatePresent(boolean isDataGroup, byte[] hash, Date atDate) Validate that data with the given hash is present in this archive time-stamp at the given date.voidvalidatePresent(ERSData data, Date atDate) Validate that the passed in data object/group is present in this archive time-stamp at the given date - that its hash appears in the reduced hash tree and the recovered root hash matches the time-stamp imprint.
-
Constructor Details
-
ERSArchiveTimeStamp
public ERSArchiveTimeStamp(byte[] archiveTimeStamp, DigestCalculatorProvider digCalcProv) throws TSPException, ERSException Create an archive time-stamp from an encoded ArchiveTimeStamp.- Parameters:
archiveTimeStamp- the DER encoded ArchiveTimeStamp.digCalcProv- provider for the digest calculator matching the structure's digest algorithm.- Throws:
TSPExceptionERSException
-
ERSArchiveTimeStamp
public ERSArchiveTimeStamp(org.bouncycastle.asn1.tsp.ArchiveTimeStamp archiveTimeStamp, DigestCalculatorProvider digCalcProv) throws TSPException, ERSException Create an archive time-stamp from a parsed ArchiveTimeStamp structure.- Parameters:
archiveTimeStamp- the ArchiveTimeStamp to wrap.digCalcProv- provider for the digest calculator matching the structure's digest algorithm.- Throws:
TSPExceptionERSException
-
-
Method Details
-
getDigestAlgorithmIdentifier
public org.bouncycastle.asn1.x509.AlgorithmIdentifier getDigestAlgorithmIdentifier() -
validatePresent
Validate that the passed in data object/group is present in this archive time-stamp at the given date - that its hash appears in the reduced hash tree and the recovered root hash matches the time-stamp imprint.- Parameters:
data- the data object or data group to check for.atDate- date the data is expected to be valid at; the time-stamp must not be in the future relative to it.- Throws:
ERSException- if the data is not present, or the time-stamp generation time is after atDate.
-
isContaining
Return true if the passed in data object/group is present in this archive time-stamp at the given date. Equivalent tovalidatePresent(ERSData, Date)but returning a boolean rather than throwing on absence.- Parameters:
data- the data object or data group to check for.atDate- date the data is expected to be valid at.- Returns:
- true if the data is present, false otherwise.
- Throws:
ArchiveTimeStampValidationException- if the time-stamp generation time is after atDate.ERSException
-
validatePresent
Validate that data with the given hash is present in this archive time-stamp at the given date.- Parameters:
isDataGroup- true if the hash represents a data group rather than a single object.hash- the (pre-computed) hash of the data object/group to check for.atDate- date the data is expected to be valid at.- Throws:
ERSException- if the hash is not present, or the time-stamp generation time is after atDate.
-
getTimeStampToken
-
getSigningCertificate
Return the TimeStamp signing certificate if it is present.- Returns:
- the TimeStamp signing certificate.
-
validate
Validate the time stamp associated with this ArchiveTimeStamp.- Parameters:
verifier- signer verifier for the contained time stamp.- Throws:
TSPException- in case of validation failure or error.
-
getGenTime
Return the generation time of the time-stamp associated with this archive time stamp.- Returns:
- the time the associated time-stamp was created.
-
getExpiryTime
Return the not-after date for the time-stamp's signing certificate if it is present.- Returns:
- the issuing TSP server not-after date, or null if not present.
-
toASN1Structure
public org.bouncycastle.asn1.tsp.ArchiveTimeStamp toASN1Structure()Return the underlying ASN.1 ArchiveTimeStamp structure.- Returns:
- the ArchiveTimeStamp this object wraps.
-
getEncoded
return the ASN.1 encoded representation of this object.- Throws:
IOException
-
fromTimeStampToken
public static ERSArchiveTimeStamp fromTimeStampToken(TimeStampToken tspToken, DigestCalculatorProvider digCalcProv) throws TSPException, ERSException Build an ArchiveTimeStamp from a regular time stamp token.- Parameters:
tspToken- the TimeStampToken in the regular time stamp.digCalcProv- a digest calculator provider for use with the time stamp.- Returns:
- an ERSArchiveTimeStamp containing the time stamp.
- Throws:
TSPException- on a failure to parse the time stamp token data.ERSException- on a failure to convert the time stamp token to an archive time stamp.
-