Class TimeStampToken
java.lang.Object
org.bouncycastle.tsp.TimeStampToken
Carrier class for an RFC 3161 time-stamp token - the
SignedData (CMS) structure, with
content type id-ct-TSTInfo, signed by the TSA. Provides access to the embedded
TimeStampTokenInfo and the means to verify the token against the signing certificate
(see validate(SignerInformationVerifier)).-
Constructor Summary
ConstructorsConstructorDescriptionTimeStampToken(org.bouncycastle.asn1.cms.ContentInfo contentInfo) TimeStampToken(CMSSignedData signedData) -
Method Summary
Modifier and TypeMethodDescriptionorg.bouncycastle.util.Store<X509AttributeCertificateHolder> org.bouncycastle.util.Store<X509CertificateHolder> org.bouncycastle.util.Store<X509CRLHolder> getCRLs()byte[]Return a ASN.1 encoded byte stream representing the encoded object.byte[]getEncoded(String encoding) return the ASN.1 encoded representation of this object using the specified encoding.getSID()org.bouncycastle.asn1.cms.AttributeTableorg.bouncycastle.asn1.cms.AttributeTablebooleanisSignatureValid(SignerInformationVerifier sigVerifier) Return true if the signature on time stamp token is valid.Return the underlying CMSSignedData object.voidvalidate(SignerInformationVerifier sigVerifier) Validate the time stamp token.
-
Constructor Details
-
TimeStampToken
public TimeStampToken(org.bouncycastle.asn1.cms.ContentInfo contentInfo) throws TSPException, IOException - Throws:
TSPExceptionIOException
-
TimeStampToken
- Throws:
TSPExceptionIOException
-
-
Method Details
-
getTimeStampInfo
- Returns:
- the parsed TSTInfo carried by this token.
-
getSID
- Returns:
- the identifier of the signer (the TSA) of this token.
-
getSignedAttributes
public org.bouncycastle.asn1.cms.AttributeTable getSignedAttributes()- Returns:
- the table of signed (authenticated) attributes on the token.
-
getUnsignedAttributes
public org.bouncycastle.asn1.cms.AttributeTable getUnsignedAttributes()- Returns:
- the table of unsigned attributes on the token, null if there are none.
-
getCertificates
- Returns:
- a Store of the X.509 certificates carried by the token.
-
getCRLs
- Returns:
- a Store of the CRLs carried by the token.
-
getAttributeCertificates
- Returns:
- a Store of the X.509 attribute certificates carried by the token.
-
validate
public void validate(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.IllegalArgumentException- if the sigVerifierProvider has no associated certificate.
-
isSignatureValid
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
Return the underlying CMSSignedData object.- Returns:
- the underlying CMS structure.
-
getEncoded
Return a ASN.1 encoded byte stream representing the encoded object.- Throws:
IOException- if encoding fails.
-
getEncoded
return the ASN.1 encoded representation of this object using the specified encoding.- Parameters:
encoding- the ASN.1 encoding format to use ("BER", "DL", or "DER").- Throws:
IOException
-