public abstract class TimeStampToken extends java.lang.Object implements ASN1Type
It was specifically designed to allow PKCS7 to support time-stamps, but not be dependant on CMS when being used without time-stamps.
A TimeStampToken is as follows. It is defined as a ContentInfo ([CMS]) and SHALL encapsulate a signed data content type.
TimeStampToken ::= ContentInfo
-- contentType is id-signedData ([CMS])
-- content is SignedData ([CMS])
id-ct-TSTInfo OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840)
rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) ct(1) 4}
The fields of type EncapsulatedContentInfo of the SignedData construct have the following meanings:
| Constructor and Description |
|---|
TimeStampToken() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
decode(ASN1Object obj)
Decodes a
TimeStampToken object from an
ASN1Object. |
abstract java.security.cert.Certificate[] |
getCertificates()
Returns all the certificates contained in the time-stamp token; this WILL
contain the TimeStamp Authority certificate if it was included in the
time-stamp token by the TimeStamp Authority.
|
X509Certificate |
getTsaCert()
Returns the TimeStamp Authority certificate if it was included in the
time-stamp token by the TimeStamp Authority, otherwise
null
is returned. |
abstract byte[] |
getTsaCertHash()
Returns the 'SHA'-hash certificate identifier for the TimeStamp Authority
certificate.
|
abstract GeneralNames |
getTsaCertIssuer()
Returns the issuer component of the issuer/serial number certificate
identifier for the TimeStamp Authority certificate if it exists, otherwise
null is returned. |
abstract java.math.BigInteger |
getTsaCertSerialNumber()
Returns the serial number component of the issuer/serial number certificate
identifier for the TimeStamp Authority certificate if it exists, otherwise
null is returned. |
TSTInfo |
getTstInfo()
Returns the time-stamp information.
|
abstract boolean |
isSigner(X509Certificate cert)
Determines whether the indicated certificate can be used to verify the
signature protection.
|
static TimeStampToken |
newInstance(ASN1Object obj)
Creates a new
TimeStampToken object using the default
implementation (CMS). |
abstract ASN1Object |
toASN1Object()
Encodes this
TimeStampToken object as an
ASN1Object. |
java.lang.String |
toString()
Creates a text representation of the ASN.1 structure of this
TimeStampToken object. |
void |
verifySignature()
Verifies the signature protecting this TimeStampToken structure.
|
abstract void |
verifySignature(X509Certificate tsaCert)
Verifies the signature protecting this TimeStampToken structure using the
TimeStamp Authority certificate provided.
|
public static TimeStampToken newInstance(ASN1Object obj) throws java.lang.ClassNotFoundException, CodingException
TimeStampToken object using the default
implementation (CMS).obj - the ASN.1 representation of a TimeStampToken structureCodingException - thrown if an error occurs while decoding the ANS1Objectjava.lang.ClassNotFoundException - thrown if the classes containing CMS functionality cannot be found.public TSTInfo getTstInfo()
public X509Certificate getTsaCert()
null
is returned.
public void verifySignature()
throws java.security.SignatureException
The TimeStamp Authority certificate used in the validation is extracted from the TimeStampToken structure. If the TimeStampToken structure does not contain the TimeStamp Authority certificate, the validation will fail.
java.security.SignatureException - thrown if the signature protection could not be verifier; the
TimeStampToken structure may have been tamperedpublic java.lang.String toString()
TimeStampToken object.toString in class java.lang.Objectpublic abstract java.security.cert.Certificate[] getCertificates()
public abstract byte[] getTsaCertHash()
public abstract GeneralNames getTsaCertIssuer()
null is returned.
public abstract java.math.BigInteger getTsaCertSerialNumber()
null is returned.
public abstract void decode(ASN1Object obj) throws CodingException, java.lang.SecurityException
TimeStampToken object from an
ASN1Object.
The ASN1Object must be a ContentInfo structure, which contains
a SignedData structure, which contains a TSTInfo structure in its
encapContentInfo component. The SignedData structure must also contain a
SigningCertificate attribute in its signed attributes, which contains a
single ESSCertID structure.
decode in interface ASN1Typeobj - the ASN.1 representation of a TimeStampToken structureCodingException - thrown if an errors occurs while decoding the ANS1Objectjava.lang.SecurityException - thrown if an implementation for the SHA message digest algorithm is
not available from any of the installed JCA providerspublic abstract ASN1Object toASN1Object() throws CodingException
TimeStampToken object as an
ASN1Object.toASN1Object in interface ASN1TypeCodingException - if an de/encoding error occurspublic abstract void verifySignature(X509Certificate tsaCert) throws java.security.SignatureException
tsaCert - the TimeStamp Authority certificatejava.security.SignatureException - thrown if the signature protection could not be verifier; the
TimeStampToken structure may have been tamperedpublic abstract boolean isSigner(X509Certificate cert)
cert - the certificatetrue if the indicate certificate can be used to verify
the signature protection; false otherwise