org.bouncycastle.tsp

Class TimeStampToken


public class TimeStampToken
extends java.lang.Object

Constructor Summary

TimeStampToken(CMSSignedData signedData)
TimeStampToken(ContentInfo contentInfo)

Method Summary

CertStore
getCertificatesAndCRLs(String type, String provider)
byte[]
getEncoded()
Return a ASN.1 encoded byte stream representing the encoded object.
SignerId
getSID()
AttributeTable
getSignedAttributes()
TimeStampTokenInfo
getTimeStampInfo()
AttributeTable
getUnsignedAttributes()
CMSSignedData
toCMSSignedData()
Return the underlying CMSSignedData object.
void
validate(X509Certificate cert, String provider)
Validate the time stamp token.

Constructor Details

TimeStampToken

public TimeStampToken(CMSSignedData signedData)
            throws TSPException,
                   IOException

TimeStampToken

public TimeStampToken(ContentInfo contentInfo)
            throws TSPException,
                   IOException

Method Details

getCertificatesAndCRLs

public CertStore getCertificatesAndCRLs(String type,
                                        String provider)
            throws NoSuchAlgorithmException,
                   NoSuchProviderException,
                   CMSException

getEncoded

public byte[] getEncoded()
            throws IOException
Return a ASN.1 encoded byte stream representing the encoded object.

getSID

public SignerId getSID()

getSignedAttributes

public AttributeTable getSignedAttributes()

getTimeStampInfo

public TimeStampTokenInfo getTimeStampInfo()

getUnsignedAttributes

public AttributeTable getUnsignedAttributes()

toCMSSignedData

public CMSSignedData toCMSSignedData()
Return the underlying CMSSignedData object.
Returns:
the underlying CMS structure.

validate

public void validate(X509Certificate cert,
                     String provider)
            throws TSPException,
                   TSPValidationException,
                   CertificateExpiredException,
                   CertificateNotYetValidException,
                   NoSuchProviderException
Validate the time stamp token.

To be valid the token must be signed by the passed in certificate and the certificate must be the one referred to by the SigningCertificate attribute included in the hashed attributes of the token. The certificate must also have the ExtendedKeyUsageExtension with only KeyPurposeId.id_kp_timeStamping and have been valid at the time the timestamp was created.

A successful call to validate means all the above are true.