Package eu.europa.esig.dss.spi.x509.tsp
Class TimestampToken
java.lang.Object
eu.europa.esig.dss.model.x509.Token
eu.europa.esig.dss.spi.x509.tsp.TimestampToken
- All Implemented Interfaces:
IdentifierBasedObject,Serializable
SignedToken containing a TimeStamp.
- See Also:
-
Field Summary
Fields inherited from class eu.europa.esig.dss.model.x509.Token
publicKeyOfTheSigner, signatureAlgorithm, signatureInvalidityReason, signatureValidity -
Constructor Summary
ConstructorsConstructorDescriptionTimestampToken(byte[] binaries, eu.europa.esig.dss.enumerations.TimestampType type) Default constructorTimestampToken(byte[] binaries, eu.europa.esig.dss.enumerations.TimestampType type, List<TimestampedReference> timestampedReferences) Default constructor with timestamped referencesTimestampToken(org.bouncycastle.cms.CMSSignedData cms, eu.europa.esig.dss.enumerations.TimestampType type, List<TimestampedReference> timestampedReferences) Default constructor with timestamped referencesTimestampToken(org.bouncycastle.tsp.TimeStampToken timeStamp, eu.europa.esig.dss.enumerations.TimestampType type, List<TimestampedReference> timestampedReferences) Constructor with an indication of the timestamp type. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanThis method verifies whether the corresponding reference validations are validprotected TokenIdentifierprotected eu.europa.esig.dss.enumerations.SignatureValiditycheckIsSignedBy(CertificateToken candidate) Checks if timestamp is signed by teh given certificateprotected eu.europa.esig.dss.enumerations.SignatureValiditycheckIsSignedBy(PublicKey publicKey) eu.europa.esig.dss.enumerations.ArchiveTimestampTypeGets theArchiveTimestampType, when applicableReturns an object with signing candidatesApplies only from XAdES timestampsReturns the Set of contained certificate references.Returns the list of wrapped certificates.ReturnsTimestampCertificateSourcefor the timestampReturnsTimestampCRLSourcefor the timestampeu.europa.esig.dss.enumerations.DigestAlgorithmThis method returns aDigestAlgorithmused for message-imprint computation of the timestamp tokenbyte[]This method returns the file name of a detached timestampRetrieves the timestamp generation time.This method returns the covered manifest file NOTE: applicable only for ASiC-E CAdESThis method returns the embedded message-imprint valueReturnsTimestampOCSPSourcefor the timestampReturns a list of timestamped data reference validations (used for Evidence Record timestamps)org.bouncycastle.cms.SignerInformationReturns used signer information from CMS Signed Data objectReturns a list of found CertificateIdentifier in the SignerInformationStoreorg.bouncycastle.tsp.TimeStampTokenGets BouncyCastle implementation of a TimestampTokenGets list ofTimestampedReferences covered by the current timestampReturns the covered references by the current timestamp (XAdES IndividualDataObjectsTimeStamp)Returns the scope of the current timestamp (detached timestamps only)eu.europa.esig.dss.enumerations.TimestampTypeRetrieves the type of the timestamp token.Returns a TSTInfo.tsa attribute identifying the timestamp issuer, when attribute is presentorg.bouncycastle.asn1.cms.AttributeTableGets unsigned attribute tablebooleanChecks if the data for message-imprint computation has been foundbooleanThe methodmatchDatamust be invoked previously.booleanChecks if the timestamp's signature has been validatedbooleanisSignedBy(CertificateToken certificateToken) Checks if the timestamp token is signed by the given publicKeybooleanisSignedBy(PublicKey publicKey) booleanisValid()Indicated if the signature is intact and the message-imprint matches the computed message-imprint.booleanmatchData(byte[] expectedMessageImprintDigest) Checks if theTimeStampTokenmatches the signed data.booleanmatchData(byte[] expectedMessageImprintDigest, boolean suppressMatchWarnings) Checks if theTimeStampTokenmatches the signed data.booleanmatchData(DSSDocument timestampedData) Checks if theTimeStampTokenmatches the signed data.booleanmatchData(DSSDocument timestampedData, boolean suppressMatchWarnings) Checks if theTimeStampTokenmatches the signed data.booleanmatchData(DSSMessageDigest messageDigest) Checks if theTimeStampTokenmatches the message-imprint digest with warning enabled.booleanmatchData(DSSMessageDigest messageDigest, boolean suppressMatchWarnings) Checks if theTimeStampTokenmatches the message-imprint digest.voidsetArchiveTimestampType(eu.europa.esig.dss.enumerations.ArchiveTimestampType archiveTimestampType) Archive timestamps can be of different sub type.voidsetCanonicalizationMethod(String canonicalizationMethod) Allows to set the canonicalization method used by the timestamp.voidsetFileName(String fileName) Sets the filename of a detached timestampvoidsetManifestFile(ManifestFile manifestFile) Sets the manifest file covered by the current timestamp NOTE: applicable only for ASiC-E CAdESvoidsetReferenceValidations(List<ReferenceValidation> referenceValidations) Sets a list of timestamped data reference validations (used for Evidence Record timestamps)voidsetTimestampIncludes(List<TimestampInclude> timestampIncludes) Sets the covered references by the current timestamp (XAdES IndividualDataObjectsTimeStamp)voidsetTimestampScopes(List<SignatureScope> timestampScopes) Sets timestamp's signature scopesMethods inherited from class eu.europa.esig.dss.model.x509.Token
equals, getDigest, getDSSId, getDSSIdAsString, getInvalidityReason, getPublicKeyOfTheSigner, getSignatureAlgorithm, getSignatureValidity, hashCode, isSelfSigned, isSignatureIntact, toString
-
Constructor Details
-
TimestampToken
public TimestampToken(byte[] binaries, eu.europa.esig.dss.enumerations.TimestampType type) throws org.bouncycastle.tsp.TSPException, IOException, org.bouncycastle.cms.CMSException Default constructor- Parameters:
binaries- byte arraytype-TimestampType- Throws:
org.bouncycastle.tsp.TSPException- if timestamp creation exception occursIOException- if IOException occursorg.bouncycastle.cms.CMSException- if CMS data building exception occurs
-
TimestampToken
public TimestampToken(byte[] binaries, eu.europa.esig.dss.enumerations.TimestampType type, List<TimestampedReference> timestampedReferences) throws org.bouncycastle.tsp.TSPException, IOException, org.bouncycastle.cms.CMSException Default constructor with timestamped references- Parameters:
binaries- byte arraytype-TimestampTypetimestampedReferences- a list ofTimestampedReferences- Throws:
org.bouncycastle.tsp.TSPException- if timestamp creation exception occursIOException- if IOException occursorg.bouncycastle.cms.CMSException- if CMS data building exception occurs
-
TimestampToken
public TimestampToken(org.bouncycastle.cms.CMSSignedData cms, eu.europa.esig.dss.enumerations.TimestampType type, List<TimestampedReference> timestampedReferences) throws org.bouncycastle.tsp.TSPException, IOException Default constructor with timestamped references- Parameters:
cms-CMSSignedDatatype-TimestampTypetimestampedReferences- a list ofTimestampedReferences- Throws:
org.bouncycastle.tsp.TSPException- if timestamp creation exception occursIOException- if IOException occurs
-
TimestampToken
public TimestampToken(org.bouncycastle.tsp.TimeStampToken timeStamp, eu.europa.esig.dss.enumerations.TimestampType type, List<TimestampedReference> timestampedReferences) Constructor with an indication of the timestamp type. The default constructor forTimestampToken.- Parameters:
timeStamp-TimeStampTokentype-TimestampTypetimestampedReferences- timestamped references timestamp comes from
-
-
Method Details
-
getIssuerX500Principal
- Specified by:
getIssuerX500Principalin classToken
-
getAbbreviation
- Overrides:
getAbbreviationin classToken
-
getCertificateSource
ReturnsTimestampCertificateSourcefor the timestamp- Returns:
TimestampCertificateSource
-
getCRLSource
ReturnsTimestampCRLSourcefor the timestamp- Returns:
TimestampCRLSource
-
getOCSPSource
ReturnsTimestampOCSPSourcefor the timestamp- Returns:
TimestampOCSPSource
-
isValid
public boolean isValid()Indicated if the signature is intact and the message-imprint matches the computed message-imprint. NOTE: The method isSignedBy(CertificateToken) must be called before calling the method. SeeTimestampToken.isSignatureIntact()for more details -
isSignedBy
Checks if the timestamp token is signed by the given publicKey- Overrides:
isSignedByin classToken- Parameters:
certificateToken- the candidate to be tested- Returns:
- true if this token is signed by the given public key
-
isSignedBy
- Overrides:
isSignedByin classToken
-
checkIsSignedBy
protected eu.europa.esig.dss.enumerations.SignatureValidity checkIsSignedBy(CertificateToken candidate) Checks if timestamp is signed by teh given certificate- Parameters:
candidate-CertificateToken- Returns:
SignatureValidity
-
checkIsSignedBy
- Specified by:
checkIsSignedByin classToken
-
matchData
Checks if theTimeStampTokenmatches the signed data.- Parameters:
timestampedData- aDSSDocumentrepresenting the timestamped data- Returns:
- true if the data is verified by the TimeStampToken
-
matchData
Checks if theTimeStampTokenmatches the signed data.- Parameters:
timestampedData- aDSSDocumentrepresenting the timestamped datasuppressMatchWarnings- if true the message imprint match warning logs are suppressed.- Returns:
- true if the data is verified by the TimeStampToken
-
matchData
Checks if theTimeStampTokenmatches the message-imprint digest with warning enabled.- Parameters:
messageDigest-DSSMessageDigestrepresenting the message-imprint digest- Returns:
- true if the data is verified by the TimeStampToken
-
matchData
Checks if theTimeStampTokenmatches the message-imprint digest.- Parameters:
messageDigest-DSSMessageDigestrepresenting the message-imprint digestsuppressMatchWarnings- if true the message imprint match warning logs are suppressed.- Returns:
- true if the data is verified by the TimeStampToken
-
matchData
public boolean matchData(byte[] expectedMessageImprintDigest) Checks if theTimeStampTokenmatches the signed data.- Parameters:
expectedMessageImprintDigest- the expected message-imprint digest value- Returns:
- true if the data is verified by the TimeStampToken
-
matchData
public boolean matchData(byte[] expectedMessageImprintDigest, boolean suppressMatchWarnings) Checks if theTimeStampTokenmatches the signed data.- Parameters:
expectedMessageImprintDigest- the expected message-imprint digest valuesuppressMatchWarnings- if true the message imprint match warning logs are suppressed.- Returns:
- true if the data is verified by the TimeStampToken
-
isProcessed
public boolean isProcessed()Checks if the timestamp's signature has been validated- Returns:
- TRUE if the timestamp's signature has been validated, FALSE otherwise
-
getTimeStampType
public eu.europa.esig.dss.enumerations.TimestampType getTimeStampType()Retrieves the type of the timestamp token.- Returns:
TimestampType
-
getGenerationTime
Retrieves the timestamp generation time.- Returns:
Date
-
getCreationDate
- Specified by:
getCreationDatein classToken
-
getMessageImprint
This method returns the embedded message-imprint value- Returns:
- a Digest DTO with the algorithm and the value
-
getDigestAlgorithm
public eu.europa.esig.dss.enumerations.DigestAlgorithm getDigestAlgorithm()This method returns aDigestAlgorithmused for message-imprint computation of the timestamp token- Returns:
DigestAlgorithm
-
isMessageImprintDataFound
public boolean isMessageImprintDataFound()Checks if the data for message-imprint computation has been found- Returns:
- true if the message imprint data was found, false otherwise
-
isMessageImprintDataIntact
public boolean isMessageImprintDataIntact()The methodmatchDatamust be invoked previously.- Returns:
- true if the message imprint data is intact, false otherwise
-
getFileName
This method returns the file name of a detached timestamp- Returns:
String
-
setFileName
Sets the filename of a detached timestamp- Parameters:
fileName-String
-
getManifestFile
This method returns the covered manifest file NOTE: applicable only for ASiC-E CAdES- Returns:
ManifestFile
-
setManifestFile
Sets the manifest file covered by the current timestamp NOTE: applicable only for ASiC-E CAdES- Parameters:
manifestFile-ManifestFile
-
getTimestampedReferences
Gets list ofTimestampedReferences covered by the current timestamp- Returns:
ListofTimestampReferences
-
getArchiveTimestampType
public eu.europa.esig.dss.enumerations.ArchiveTimestampType getArchiveTimestampType()Gets theArchiveTimestampType, when applicable- Returns:
ArchiveTimestampTypein the case of an archive timestamp,nullotherwise
-
setArchiveTimestampType
public void setArchiveTimestampType(eu.europa.esig.dss.enumerations.ArchiveTimestampType archiveTimestampType) Archive timestamps can be of different sub type.- Parameters:
archiveTimestampType-ArchiveTimestampType
-
getCanonicalizationMethod
Applies only from XAdES timestamps- Returns:
Stringrepresenting the canonicalization method used by the timestamp
-
setCanonicalizationMethod
Allows to set the canonicalization method used by the timestamp. Applies only with XAdES timestamps.- Parameters:
canonicalizationMethod-Stringrepresenting the canonicalization method
-
getEncoded
public byte[] getEncoded()- Specified by:
getEncodedin classToken
-
getTimestampIncludes
Returns the covered references by the current timestamp (XAdES IndividualDataObjectsTimeStamp)- Returns:
- a list of timestamp's includes
-
setTimestampIncludes
Sets the covered references by the current timestamp (XAdES IndividualDataObjectsTimeStamp)- Parameters:
timestampIncludes- a list of timestamp's includes
-
getReferenceValidations
Returns a list of timestamped data reference validations (used for Evidence Record timestamps)- Returns:
- a list of
ReferenceValidations
-
setReferenceValidations
Sets a list of timestamped data reference validations (used for Evidence Record timestamps)- Parameters:
referenceValidations- a list ofReferenceValidations
-
areReferenceValidationsValid
protected boolean areReferenceValidationsValid()This method verifies whether the corresponding reference validations are valid- Returns:
- TRUE if all reference validations are valid, FALSE otherwise
-
getTimestampScopes
Returns the scope of the current timestamp (detached timestamps only)- Returns:
- a list of SignatureScope
-
setTimestampScopes
Sets timestamp's signature scopes- Parameters:
timestampScopes- a list ofSignatureScopes
-
getCertificates
Returns the list of wrapped certificates.- Returns:
ListofCertificateToken
-
getCertificateRefs
Returns the Set of contained certificate references.- Returns:
SetofCertificateRef
-
getUnsignedAttributes
public org.bouncycastle.asn1.cms.AttributeTable getUnsignedAttributes()Gets unsigned attribute table- Returns:
AttributeTable
-
getTSTInfoTsa
Returns a TSTInfo.tsa attribute identifying the timestamp issuer, when attribute is present- Returns:
GeneralName
-
getTimeStamp
public org.bouncycastle.tsp.TimeStampToken getTimeStamp()Gets BouncyCastle implementation of a TimestampToken- Returns:
TimeStampToken
-
toString
-
getSignerInformationStoreInfos
Returns a list of found CertificateIdentifier in the SignerInformationStore- Returns:
- a list of
SignerIdentifiers
-
getCandidatesForSigningCertificate
Returns an object with signing candidates- Returns:
CandidatesForSigningCertificate
-
getSignerInformation
public org.bouncycastle.cms.SignerInformation getSignerInformation()Returns used signer information from CMS Signed Data object- Returns:
SignerInformation
-
buildTokenIdentifier
- Specified by:
buildTokenIdentifierin classToken
-