public final class CMSTimeStampToken extends TimeStampToken implements ASN1Type
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:
The CMS structures are defined in RFC 2630, the Cryptographic Message Syntax specification.
ContentInfo,
SignedData,
SigningCertificate,
ESSCertID,
RFC 3161,
RFC 2630| Constructor and Description |
|---|
CMSTimeStampToken(ASN1Object obj)
Creates a new
CMSTimeStampToken object from an
ASN1Object. |
CMSTimeStampToken(TSTInfo tstInfo,
X509Certificate tsaCert,
java.security.PrivateKey tsaSigningKey)
Creates a new
CMSTimeStampToken object that contains the
indicated time-stamp information and TimeStamp Authority certificate. |
CMSTimeStampToken(TSTInfo tstInfo,
X509Certificate tsaCert,
java.security.PrivateKey tsaSigningKey,
AlgorithmID digestAlgorithm,
boolean includeIssuerSerial,
boolean includeTsaCert)
Creates a new
CMSTimeStampToken object that contains the
indicated time-stamp information and TimeStamp Authority certificate. |
| Modifier and Type | Method and Description |
|---|---|
void |
decode(ASN1Object obj)
Decodes a
CMSTimeStampToken object from an
ASN1Object. |
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.
|
byte[] |
getTsaCertHash()
Returns the 'SHA'-hash certificate identifier for the TimeStamp Authority
certificate.
|
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. |
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. |
boolean |
isSigner(X509Certificate cert)
Determines whether the indicated certificate can be used to verify the
signature protection.
|
ASN1Object |
toASN1Object()
Encodes this
CMSTimeStampToken object as an
ASN1Object. |
void |
verifySignature(X509Certificate tsaCert)
Verifies the signature protecting this TimeStampToken structure using the
TimeStamp Authority certificate provided.
|
getTsaCert, getTstInfo, newInstance, toString, verifySignaturepublic CMSTimeStampToken(TSTInfo tstInfo, X509Certificate tsaCert, java.security.PrivateKey tsaSigningKey) throws java.lang.IllegalArgumentException, java.lang.SecurityException
CMSTimeStampToken object that contains the
indicated time-stamp information and TimeStamp Authority certificate.
The TimeStamp Authority certificate identifier this object contains is
created to always have an issuer/serial number. When converted to an
ASN1Obejct, the ESSCertID in the structure will
always include the 'SHA'-hash and the issuer/serial number.
tstInfo - the time-stamp informationtsaCert - the certificate of the TimeStamp Authority that issued the time-stamp
informationtsaSigningKey - the private signing key of the TimeStamp Authority that corresponds to
the TimeStamp Authority certificate; used to protect the time-stamp
token with a signature (currently only RSA, DSA , and ECDSA keys are
supported)java.lang.IllegalArgumentException - thrown if any of the parameters are null or the tsaCert
cannot be encoded successfullyjava.lang.SecurityException - thrown if an implementation for the SHA message digest algorithm is
not available from any of the installed JCA providerspublic CMSTimeStampToken(TSTInfo tstInfo, X509Certificate tsaCert, java.security.PrivateKey tsaSigningKey, AlgorithmID digestAlgorithm, boolean includeIssuerSerial, boolean includeTsaCert) throws java.lang.IllegalArgumentException, java.lang.SecurityException
CMSTimeStampToken object that contains the
indicated time-stamp information and TimeStamp Authority certificate.
The TimeStamp Authority certificate identifier this object contains is
created to have an issuer/serial number only when requested. When converted
to an ASN1Obejct, the ESSCertID in the structure
will include the 'SHA'-hash, and the issuer/serial number only if requested.
tstInfo - the time-stamp informationtsaCert - the certificate of the TimeStamp Authority that issued the time-stamp
informationtsaSigningKey - the private signing key of the TimeStamp Authority that corresponds to
the TimeStamp Authority certificate; used to protect the time-stamp
token with a signature (currently only RSA, DSA , and ECDSA keys are
supported)digestAlgorithm - the message digest algorithm that will be used in the signature
protection (OPTIONAL)includeIssuerSerial - indicates whether the issuer/serial number should be used in addition
to the certificate hash as an identifier for the TimeStamp Authority
certificateincludeTsaCert - indicates whether the TimeStamp Authority certificate should be
included in the certificates field of the SignedData structurejava.lang.IllegalArgumentException - thrown if any of the required parameters are null or the
tsaCert cannot be encoded successfullyjava.lang.SecurityException - thrown if an implementation for the SHA or 'digestAlgorithm' message
digest algorithm is not available from any of the installed JCA
providerspublic CMSTimeStampToken(ASN1Object obj) throws CodingException
CMSTimeStampToken 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.
obj - the ASN.1 representation of an CMSTimeStampToken structureCodingException - thrown if an errors occurs while decoding the ANS1Objectpublic java.security.cert.Certificate[] getCertificates()
getCertificates in class TimeStampTokenpublic byte[] getTsaCertHash()
getTsaCertHash in class TimeStampTokenpublic GeneralNames getTsaCertIssuer()
null is returned.
getTsaCertIssuer in class TimeStampTokenpublic java.math.BigInteger getTsaCertSerialNumber()
null is returned.
getTsaCertSerialNumber in class TimeStampTokenpublic void decode(ASN1Object obj) throws CodingException, java.lang.SecurityException
CMSTimeStampToken object from an
ASN1Object.
The ASN1Object must be an 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 ASN1Typedecode in class TimeStampTokenobj - the ASN.1 representation of an CMSTimeStampToken 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 ASN1Object toASN1Object() throws CodingException
CMSTimeStampToken object as an
ASN1Object.toASN1Object in interface ASN1TypetoASN1Object in class TimeStampTokenCodingException - if an de/encoding error occurspublic void verifySignature(X509Certificate tsaCert) throws java.security.SignatureException
verifySignature in class TimeStampTokentsaCert - the TimeStamp Authority certificatejava.security.SignatureException - thrown if the signature protection could not be verifier; the
TimeStampToken structure may have been tamperedpublic boolean isSigner(X509Certificate cert) throws java.lang.SecurityException
isSigner in class TimeStampTokencert - the certificatetrue if the indicate certificate can be used to verify
the signature protection; false otherwisejava.lang.SecurityException - thrown if an implementation for the SHA message digest algorithm is
not available from any of the installed JCA providers