Class TimestampToken
- java.lang.Object
-
- eu.europa.esig.dss.model.x509.Token
-
- eu.europa.esig.dss.validation.timestamp.TimestampToken
-
- All Implemented Interfaces:
Serializable
public class TimestampToken extends Token
SignedToken containing a TimeStamp.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class eu.europa.esig.dss.model.x509.Token
publicKeyOfTheSigner, signatureAlgorithm, signatureInvalidityReason, signatureValid
-
-
Constructor Summary
Constructors Constructor Description TimestampToken(byte[] binaries, TimestampType type)TimestampToken(byte[] binaries, TimestampType type, CertificatePool certPool)TimestampToken(byte[] binaries, TimestampType type, CertificatePool certPool, TimestampLocation timeStampLocation)TimestampToken(byte[] binaries, TimestampType type, CertificatePool certPool, List<TimestampedReference> timestampedReferences, TimestampLocation timeStampLocation)TimestampToken(TimestampToken timestampToken)Creates a new instance ofTimestampTokenTimestampToken(org.bouncycastle.cms.CMSSignedData cms, TimestampType type, CertificatePool certPool)TimestampToken(org.bouncycastle.cms.CMSSignedData cms, TimestampType type, CertificatePool certPool, TimestampLocation timeStampLocation)TimestampToken(org.bouncycastle.cms.CMSSignedData cms, TimestampType type, CertificatePool certPool, List<TimestampedReference> timestampedReferences, TimestampLocation timeStampLocation)TimestampToken(org.bouncycastle.tsp.TimeStampToken timeStamp, TimestampType type)TimestampToken(org.bouncycastle.tsp.TimeStampToken timeStamp, TimestampType type, CertificatePool certPool)TimestampToken(org.bouncycastle.tsp.TimeStampToken timeStamp, TimestampType type, CertificatePool certPool, TimestampLocation timeStampLocation)TimestampToken(org.bouncycastle.tsp.TimeStampToken timeStamp, TimestampType type, CertificatePool certPool, List<TimestampedReference> timestampedReferences, TimestampLocation timeStampLocation)Constructor with an indication of the timestamp type.
-
Method Summary
Modifier and Type Method Description protected booleancheckIsSignedBy(CertificateToken candidate)StringgetAbbreviation()This method returns the DSS abbreviation of the token.ArchiveTimestampTypegetArchiveTimestampType()StringgetCanonicalizationMethod()Applies only from XAdES timestampsList<CertificateRef>getCertificateRefs()Returns the list of contained certificate references.List<CertificateToken>getCertificates()Returns the list of wrapped certificates.DategetCreationDate()Returns the creation date of this token.TimestampCRLSourcegetCRLSource()ReturnsTimestampCRLSourcefor the timestampStringgetDSSIdAsString()Returns a string representation of the unique DSS token identifier.byte[]getEncoded()Returns the encoded form of the wrapped token.DategetGenerationTime()Retrieves the timestamp generation time.intgetHashCode()Used only with XAdES timestamps.X500PrincipalgetIssuerX500Principal()Returns theX500Principalof the certificate which was used to sign this token.byte[]getMessageImprintDigest()Retrieves the message-imprint digest value.TimestampOCSPSourcegetOCSPSource()ReturnsTimestampOCSPSourcefor the timestampDigestAlgorithmgetSignedDataDigestAlgo()Retrieves theDigestAlgorithmused to generate the digest value to timestamp.org.bouncycastle.cms.SignerIdgetSignerId()List<TimestampedReference>getTimestampedReferences()List<TimestampInclude>getTimestampIncludes()Returns the covered references by the current timestamp (XAdES IndividualDataObjectsTimeStamp)TimestampLocationgetTimestampLocation()Retrieves the location of timestamp token.TimestampTypegetTimeStampType()Retrieves the type of the timestamp token.org.bouncycastle.asn1.cms.AttributeTablegetUnsignedAttributes()BooleanisMessageImprintDataFound()BooleanisMessageImprintDataIntact()The methodmatchDatamust be invoked previously.booleanisProcessed()booleanmatchData(byte[] data)Checks if theTimeStampTokenmatches the signed data.booleanmatchData(byte[] data, boolean suppressMatchWarnings)Checks if theTimeStampTokenmatches the signed data.voidsetArchiveTimestampType(ArchiveTimestampType archiveTimestampType)Archive timestamps can be of different sub type.voidsetCanonicalizationMethod(String canonicalizationMethod)Allows to set the canonicalization method used by the timestamp.voidsetHashCode(int hashCode)Used only with XAdES timestamps.voidsetTimestampIncludes(List<TimestampInclude> timestampIncludes)StringtoString(String indentStr)Returns a string representation of the token.-
Methods inherited from class eu.europa.esig.dss.model.x509.Token
equals, getDigest, getDSSId, getPublicKeyOfTheSigner, getSignatureAlgorithm, hashCode, isSelfSigned, isSignatureValid, isSignedBy, toString
-
-
-
-
Constructor Detail
-
TimestampToken
public TimestampToken(byte[] binaries, TimestampType type) throws org.bouncycastle.tsp.TSPException, IOException, org.bouncycastle.cms.CMSException- Throws:
org.bouncycastle.tsp.TSPExceptionIOExceptionorg.bouncycastle.cms.CMSException
-
TimestampToken
public TimestampToken(byte[] binaries, TimestampType type, CertificatePool certPool) throws org.bouncycastle.tsp.TSPException, IOException, org.bouncycastle.cms.CMSException- Throws:
org.bouncycastle.tsp.TSPExceptionIOExceptionorg.bouncycastle.cms.CMSException
-
TimestampToken
public TimestampToken(byte[] binaries, TimestampType type, CertificatePool certPool, TimestampLocation timeStampLocation) throws org.bouncycastle.tsp.TSPException, IOException, org.bouncycastle.cms.CMSException- Throws:
org.bouncycastle.tsp.TSPExceptionIOExceptionorg.bouncycastle.cms.CMSException
-
TimestampToken
public TimestampToken(byte[] binaries, TimestampType type, CertificatePool certPool, List<TimestampedReference> timestampedReferences, TimestampLocation timeStampLocation) throws org.bouncycastle.tsp.TSPException, IOException, org.bouncycastle.cms.CMSException- Throws:
org.bouncycastle.tsp.TSPExceptionIOExceptionorg.bouncycastle.cms.CMSException
-
TimestampToken
public TimestampToken(org.bouncycastle.cms.CMSSignedData cms, TimestampType type, CertificatePool certPool) throws org.bouncycastle.tsp.TSPException, IOException- Throws:
org.bouncycastle.tsp.TSPExceptionIOException
-
TimestampToken
public TimestampToken(org.bouncycastle.cms.CMSSignedData cms, TimestampType type, CertificatePool certPool, TimestampLocation timeStampLocation) throws org.bouncycastle.tsp.TSPException, IOException- Throws:
org.bouncycastle.tsp.TSPExceptionIOException
-
TimestampToken
public TimestampToken(org.bouncycastle.cms.CMSSignedData cms, TimestampType type, CertificatePool certPool, List<TimestampedReference> timestampedReferences, TimestampLocation timeStampLocation) throws org.bouncycastle.tsp.TSPException, IOException- Throws:
org.bouncycastle.tsp.TSPExceptionIOException
-
TimestampToken
public TimestampToken(org.bouncycastle.tsp.TimeStampToken timeStamp, TimestampType type)
-
TimestampToken
public TimestampToken(org.bouncycastle.tsp.TimeStampToken timeStamp, TimestampType type, CertificatePool certPool)
-
TimestampToken
public TimestampToken(org.bouncycastle.tsp.TimeStampToken timeStamp, TimestampType type, CertificatePool certPool, TimestampLocation timeStampLocation)
-
TimestampToken
public TimestampToken(org.bouncycastle.tsp.TimeStampToken timeStamp, TimestampType type, CertificatePool certPool, List<TimestampedReference> timestampedReferences, TimestampLocation timeStampLocation)Constructor with an indication of the timestamp type. The default constructor forTimestampToken.- Parameters:
timeStamp-TimeStampTokentype-TimestampTypecertPool-CertificatePoolwhich is used to identify the signing certificate of the timestamptimeStampLocation-TimestampLocationdefines where the timestamp comes from
-
TimestampToken
public TimestampToken(TimestampToken timestampToken)
Creates a new instance ofTimestampToken- Parameters:
timestampToken-TimestampTokento be cloned
-
-
Method Detail
-
getIssuerX500Principal
public X500Principal getIssuerX500Principal()
Description copied from class:TokenReturns theX500Principalof the certificate which was used to sign this token.- Specified by:
getIssuerX500Principalin classToken- Returns:
- the issuer's
X500Principal
-
getAbbreviation
public String getAbbreviation()
Description copied from class:TokenThis method returns the DSS abbreviation of the token. It is used for debugging purpose.- Overrides:
getAbbreviationin classToken- Returns:
- an abbreviation for the certificate
-
getCRLSource
public TimestampCRLSource getCRLSource()
ReturnsTimestampCRLSourcefor the timestamp- Returns:
TimestampCRLSource
-
getOCSPSource
public TimestampOCSPSource getOCSPSource()
ReturnsTimestampOCSPSourcefor the timestamp- Returns:
TimestampOCSPSource
-
checkIsSignedBy
protected boolean checkIsSignedBy(CertificateToken candidate)
- Specified by:
checkIsSignedByin classToken
-
matchData
public boolean matchData(byte[] data)
Checks if theTimeStampTokenmatches the signed data.- Parameters:
data- the array ofbyterepresenting the timestamped data- Returns:
- true if the data is verified by the TimeStampToken
-
matchData
public boolean matchData(byte[] data, boolean suppressMatchWarnings)Checks if theTimeStampTokenmatches the signed data. This method is used when we want to test whether theTimeStampTokenmatches the signed data calculated according to ETSI TS 101 733 v2.2.1 and depending on the result re-run the message imprint calculation according to ETSI TS 101 733 v1.8.3. It is part of solution for the issue DSS-1401 (https://ec.europa.eu/cefdigital/tracker/browse/DSS-1401)- Parameters:
data- the array ofbyterepresenting the timestamped datasuppressMatchWarnings- if true the message imprint match warning logs are suppressed.- Returns:
- true if the data is verified by the TimeStampToken
-
isProcessed
public boolean isProcessed()
-
getTimeStampType
public TimestampType getTimeStampType()
Retrieves the type of the timestamp token.- Returns:
TimestampType
-
getTimestampLocation
public TimestampLocation getTimestampLocation()
Retrieves the location of timestamp token.- Returns:
TimestampLocation
-
getGenerationTime
public Date getGenerationTime()
Retrieves the timestamp generation time.- Returns:
Date
-
getCreationDate
public Date getCreationDate()
Description copied from class:TokenReturns the creation date of this token. This date is mainly used to retrieve the correct issuer within a collection of renewed certificates (new certificate with the same key pair).- Specified by:
getCreationDatein classToken- Returns:
- the creation date of the token (notBefore for a certificate, productionDate for revocation data,...)
-
getSignedDataDigestAlgo
public DigestAlgorithm getSignedDataDigestAlgo()
Retrieves theDigestAlgorithmused to generate the digest value to timestamp.- Returns:
DigestAlgorithm
-
getMessageImprintDigest
public byte[] getMessageImprintDigest()
Retrieves the message-imprint digest value.- Returns:
- the byte array with the message-imprint digest value
-
isMessageImprintDataFound
public Boolean isMessageImprintDataFound()
- 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
-
getTimestampedReferences
public List<TimestampedReference> getTimestampedReferences()
- Returns:
ListofTimestampReferences
-
getArchiveTimestampType
public ArchiveTimestampType getArchiveTimestampType()
- Returns:
ArchiveTimestampTypein the case of an archive timestamp,nullotherwise
-
setArchiveTimestampType
public void setArchiveTimestampType(ArchiveTimestampType archiveTimestampType)
Archive timestamps can be of different sub type.- Parameters:
archiveTimestampType-ArchiveTimestampType
-
getCanonicalizationMethod
public String getCanonicalizationMethod()
Applies only from XAdES timestamps- Returns:
Stringrepresenting the canonicalization method used by the timestamp
-
setCanonicalizationMethod
public void setCanonicalizationMethod(String canonicalizationMethod)
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()
Description copied from class:TokenReturns the encoded form of the wrapped token.- Specified by:
getEncodedin classToken- Returns:
- the encoded form of the wrapped token
-
getTimestampIncludes
public List<TimestampInclude> getTimestampIncludes()
Returns the covered references by the current timestamp (XAdES IndividualDataObjectsTimeStamp)- Returns:
-
setTimestampIncludes
public void setTimestampIncludes(List<TimestampInclude> timestampIncludes)
-
getCertificates
public List<CertificateToken> getCertificates()
Returns the list of wrapped certificates.- Returns:
ListofCertificateToken
-
getCertificateRefs
public List<CertificateRef> getCertificateRefs()
Returns the list of contained certificate references.- Returns:
ListofCertificateRef
-
getUnsignedAttributes
public org.bouncycastle.asn1.cms.AttributeTable getUnsignedAttributes()
-
setHashCode
public void setHashCode(int hashCode)
Used only with XAdES timestamps.- Parameters:
hashCode- the hash code of the DOM element containing the timestamp
-
getHashCode
public int getHashCode()
Used only with XAdES timestamps.- Returns:
- the hash code of the DOM element containing the timestamp
-
toString
public String toString(String indentStr)
Description copied from class:TokenReturns a string representation of the token.
-
getSignerId
public org.bouncycastle.cms.SignerId getSignerId()
-
getDSSIdAsString
public String getDSSIdAsString()
Description copied from class:TokenReturns a string representation of the unique DSS token identifier.- Overrides:
getDSSIdAsStringin classToken- Returns:
- the unique string for the token
-
-