Bouncy Castle Cryptography Library 1.87

org.bouncycastle.tsp
Class TimeStampRequest

java.lang.Object
  extended byorg.bouncycastle.tsp.TimeStampRequest

public class TimeStampRequest
extends java.lang.Object

Base class for an RFC 3161 Time Stamp Request.


Constructor Summary
TimeStampRequest(byte[] req)
          Create a TimeStampRequest from the past in byte array.
TimeStampRequest(java.io.InputStream in)
          Create a TimeStampRequest from the past in input stream.
TimeStampRequest(org.bouncycastle.asn1.tsp.TimeStampReq req)
          Create a TimeStampRequest from the passed in ASN.1 structure.
 
Method Summary
 boolean getCertReq()
           
 java.util.Set getCriticalExtensionOIDs()
          Returns a set of ASN1ObjectIdentifiers giving the critical extensions.
 byte[] getEncoded()
          return the ASN.1 encoded representation of this object.
 org.bouncycastle.asn1.x509.Extension getExtension(org.bouncycastle.asn1.ASN1ObjectIdentifier oid)
          Return the extension with the passed in OID.
 java.util.List getExtensionOIDs()
           
 org.bouncycastle.asn1.tsp.MessageImprint getMessageImprint()
           
 org.bouncycastle.asn1.x509.AlgorithmIdentifier getMessageImprintAlgID()
           
 org.bouncycastle.asn1.ASN1ObjectIdentifier getMessageImprintAlgOID()
           
 byte[] getMessageImprintDigest()
           
 java.math.BigInteger getNonce()
           
 java.util.Set getNonCriticalExtensionOIDs()
          Returns a set of ASN1ObjectIdentifiers giving the non-critical extensions.
 org.bouncycastle.asn1.ASN1ObjectIdentifier getReqPolicy()
           
 int getVersion()
           
 boolean hasExtensions()
           
 org.bouncycastle.asn1.tsp.TimeStampReq toASN1Structure()
           
 void validate(java.util.Set algorithms, java.util.Set policies, java.util.Set extensions)
          Validate the timestamp request, checking the digest to see if it is of an accepted type and whether it is of the correct length for the algorithm specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeStampRequest

public TimeStampRequest(org.bouncycastle.asn1.tsp.TimeStampReq req)
Create a TimeStampRequest from the passed in ASN.1 structure.

Parameters:
req - the ASN.1 TimeStampReq the request is based on.

TimeStampRequest

public TimeStampRequest(byte[] req)
                 throws java.io.IOException
Create a TimeStampRequest from the past in byte array.

Parameters:
req - byte array containing the request.
Throws:
java.io.IOException - if the request is malformed.

TimeStampRequest

public TimeStampRequest(java.io.InputStream in)
                 throws java.io.IOException
Create a TimeStampRequest from the past in input stream.

Parameters:
in - input stream containing the request.
Throws:
java.io.IOException - if the request is malformed.
Method Detail

toASN1Structure

public org.bouncycastle.asn1.tsp.TimeStampReq toASN1Structure()
Returns:
the underlying ASN.1 TimeStampReq structure.

getVersion

public int getVersion()
Returns:
the version of the request (1 for RFC 3161).

getMessageImprint

public org.bouncycastle.asn1.tsp.MessageImprint getMessageImprint()
Returns:
the message imprint (hash algorithm plus digest) to be stamped.

getMessageImprintAlgOID

public org.bouncycastle.asn1.ASN1ObjectIdentifier getMessageImprintAlgOID()
Returns:
the OID of the hash algorithm used for the message imprint.

getMessageImprintAlgID

public org.bouncycastle.asn1.x509.AlgorithmIdentifier getMessageImprintAlgID()
Returns:
the algorithm identifier of the hash used for the message imprint.

getMessageImprintDigest

public byte[] getMessageImprintDigest()
Returns:
the digest value to be stamped.

getReqPolicy

public org.bouncycastle.asn1.ASN1ObjectIdentifier getReqPolicy()
Returns:
the OID of the TSA policy the requester asks the token to be issued under, null if not set.

getNonce

public java.math.BigInteger getNonce()
Returns:
the nonce included in the request, null if there is none.

getCertReq

public boolean getCertReq()
Returns:
true if the requester asked the TSA to include its certificate(s) in the response, false if absent (the RFC 3161 default).

validate

public void validate(java.util.Set algorithms,
                     java.util.Set policies,
                     java.util.Set extensions)
              throws TSPException
Validate the timestamp request, checking the digest to see if it is of an accepted type and whether it is of the correct length for the algorithm specified.

Parameters:
algorithms - a set of OIDs giving accepted algorithms.
policies - if non-null a set of policies OIDs we are willing to sign under.
extensions - if non-null a set of extensions OIDs we are willing to accept.
Throws:
TSPException - if the request is invalid, or processing fails.

getEncoded

public byte[] getEncoded()
                  throws java.io.IOException
return the ASN.1 encoded representation of this object.

Returns:
the default ASN.1 byte encoding for the object.
Throws:
java.io.IOException

hasExtensions

public boolean hasExtensions()
Returns:
true if the request carries any extensions, false otherwise.

getExtension

public org.bouncycastle.asn1.x509.Extension getExtension(org.bouncycastle.asn1.ASN1ObjectIdentifier oid)
Return the extension with the passed in OID.

Parameters:
oid - the OID of the extension of interest.
Returns:
the extension, null if not present.

getExtensionOIDs

public java.util.List getExtensionOIDs()
Returns:
a list of the OIDs of the extensions present, in order, empty if there are none.

getNonCriticalExtensionOIDs

public java.util.Set getNonCriticalExtensionOIDs()
Returns a set of ASN1ObjectIdentifiers giving the non-critical extensions.

Returns:
a set of ASN1ObjectIdentifiers.

getCriticalExtensionOIDs

public java.util.Set getCriticalExtensionOIDs()
Returns a set of ASN1ObjectIdentifiers giving the critical extensions.

Returns:
a set of ASN1ObjectIdentifiers.

Bouncy Castle Cryptography Library 1.87