Bouncy Castle Cryptography Library 1.46

org.bouncycastle.tsp
Class TimeStampToken

java.lang.Object
  extended by org.bouncycastle.tsp.TimeStampToken

public class TimeStampToken
extends java.lang.Object


Constructor Summary
TimeStampToken(org.bouncycastle.cms.CMSSignedData signedData)
           
TimeStampToken(org.bouncycastle.asn1.cms.ContentInfo contentInfo)
           
 
Method Summary
 org.bouncycastle.util.Store getAttributeCertificates()
           
 org.bouncycastle.util.Store getCertificates()
           
 java.security.cert.CertStore getCertificatesAndCRLs(java.lang.String type, java.lang.String provider)
           
 org.bouncycastle.util.Store getCRLs()
           
 byte[] getEncoded()
          Return a ASN.1 encoded byte stream representing the encoded object.
 org.bouncycastle.cms.SignerId getSID()
           
 org.bouncycastle.asn1.cms.AttributeTable getSignedAttributes()
           
 TimeStampTokenInfo getTimeStampInfo()
           
 org.bouncycastle.asn1.cms.AttributeTable getUnsignedAttributes()
           
 boolean isSignatureValid(org.bouncycastle.cms.SignerInformationVerifier sigVerifier)
          Return true if the signature on time stamp token is valid.
 org.bouncycastle.cms.CMSSignedData toCMSSignedData()
          Return the underlying CMSSignedData object.
 void validate(org.bouncycastle.cms.SignerInformationVerifier sigVerifier)
          Validate the time stamp token.
 void validate(java.security.cert.X509Certificate cert, java.lang.String provider)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeStampToken

public TimeStampToken(org.bouncycastle.asn1.cms.ContentInfo contentInfo)
               throws TSPException,
                      java.io.IOException
Throws:
TSPException
java.io.IOException

TimeStampToken

public TimeStampToken(org.bouncycastle.cms.CMSSignedData signedData)
               throws TSPException,
                      java.io.IOException
Throws:
TSPException
java.io.IOException
Method Detail

getTimeStampInfo

public TimeStampTokenInfo getTimeStampInfo()

getSID

public org.bouncycastle.cms.SignerId getSID()

getSignedAttributes

public org.bouncycastle.asn1.cms.AttributeTable getSignedAttributes()

getUnsignedAttributes

public org.bouncycastle.asn1.cms.AttributeTable getUnsignedAttributes()

getCertificatesAndCRLs

public java.security.cert.CertStore getCertificatesAndCRLs(java.lang.String type,
                                                           java.lang.String provider)
                                                    throws java.security.NoSuchAlgorithmException,
                                                           java.security.NoSuchProviderException,
                                                           org.bouncycastle.cms.CMSException
Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
org.bouncycastle.cms.CMSException

getCertificates

public org.bouncycastle.util.Store getCertificates()

getCRLs

public org.bouncycastle.util.Store getCRLs()

getAttributeCertificates

public org.bouncycastle.util.Store getAttributeCertificates()

validate

public void validate(java.security.cert.X509Certificate cert,
                     java.lang.String provider)
              throws TSPException,
                     TSPValidationException,
                     java.security.cert.CertificateExpiredException,
                     java.security.cert.CertificateNotYetValidException,
                     java.security.NoSuchProviderException
Deprecated. 

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.

Throws:
TSPException
TSPValidationException
java.security.cert.CertificateExpiredException
java.security.cert.CertificateNotYetValidException
java.security.NoSuchProviderException

validate

public void validate(org.bouncycastle.cms.SignerInformationVerifier sigVerifier)
              throws TSPException,
                     TSPValidationException
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.

Parameters:
sigVerifier - the content verifier create the objects required to verify the CMS object in the timestamp.
Throws:
TSPException - if an exception occurs in processing the token.
TSPValidationException - if the certificate or signature fail to be valid.
java.lang.IllegalArgumentException - if the sigVerifierProvider has no associated certificate.

isSignatureValid

public boolean isSignatureValid(org.bouncycastle.cms.SignerInformationVerifier sigVerifier)
                         throws TSPException
Return true if the signature on time stamp token is valid.

Note: this is a much weaker proof of correctness than calling validate().

Parameters:
sigVerifier - the content verifier create the objects required to verify the CMS object in the timestamp.
Returns:
true if the signature matches, false otherwise.
Throws:
TSPException - if the signature cannot be processed or the provider cannot match the algorithm.

toCMSSignedData

public org.bouncycastle.cms.CMSSignedData toCMSSignedData()
Return the underlying CMSSignedData object.

Returns:
the underlying CMS structure.

getEncoded

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

Throws:
java.io.IOException - if encoding fails.

Bouncy Castle Cryptography Library 1.46