IAIK TSP
version 2.32

iaik.tsp
Class TSTInfo

java.lang.Object
  extended by iaik.tsp.TSTInfo
All Implemented Interfaces:
Content, ContentStream

public class TSTInfo
extends java.lang.Object
implements Content

This class implements the TSP ASN.1 type TSTInfo as it is specified in RFC 3161.

 id-smime-ct-TSTInfo OBJECT IDENTIFIER ::= {id-smime-ct 4} with: id-smime-ct
 OBJECT IDENTIFIER ::= { id-smime 1 } id-smime OBJECT IDENTIFIER ::= {
     iso(1)
     member-body(2)
     us(840)
     rsadsi(113549)
     pkcs(1)
     pkcs-9(9)
     16
 }
 
 TSTInfo ::= SEQUENCE {
     version        INTEGER { v1(1) },
     policy         TSAPolicyID,
     messageImprint MessageImprint,
         -- MUST have the same value as the similar field in
         -- TimeStampReq serialNumber INTEGER,
         -- Time Stamps users MUST be ready to accommodate integers
         -- up to 160 bits.
     genTime        GeneralizedTime,
     accuracy       Accuracy     OPTIONAL,
     ordering       BOOLEAN DEFAULT FALSE,
     nonce          INTEGER      OPTIONAL,
         -- MUST be present if the similar field was present
         -- in TimeStampReq. In that case it MUST have the same value.
     tsa [0]        GeneralName  OPTIONAL,
     extensions [1] IMPLICIT Extensions OPTIONAL
 }
 
This class handles the ASN.1 structure and the DER encoding and decoding of this structure.

The version field (currently v1) describes the version of the Timestamp token.

The policy field MUST indicate the TSA's policy under which the response was produced. If a similar field was present in the TimeStampReq, then it MUST have the same value, otherwise an error (unacceptedPolicy) MUST be returned. This policy MAY include the following types of information (although this list is certainly not exhaustive):

The messageImprint MUST have the same value as the similar field in TimeStampReq, provided that the size of the hash value matches the expected size of the hash algorithm identified in hashAlgorithm.

The serialNumber field is an integer assigned by the TSA to each TimeStampToken. It MUST be unique for each TimeStampToken issued by a given TSA (i.e., the TSA name and serial number identify a unique TimeStampToken). It should be noticed that the property must remain valid even after a possible interruption (e.g. crash) of the service.

Element genTime is the time at which the timestamp has been created by the TSA. The ASN.1 GeneralizedTime syntax can include fraction-of-second details. Such syntax, without the restrictions from RFC 2459 Section 4.1.2.5.2, where GeneralizedTime is limited to represent time with one second, may used here. However, when there is no need to have precision better than one second, then GeneralizedTime with a precision limited to one second SHOULD be used (as in RFC 2459).

Element accuracy represents the time deviation around the UTC time contained in GeneralizedTime.

By adding the accuracy value to the GeneralizedTime, an upper limit of the time at which the time stamp has been created by the TSA can be obtained. In the same way, by subtracting the accuracy from the GeneralizedTime, a lower limit of the time at which the timestamp has been created by the TSA can be obtained. When the accuracy optional field is not present, then the accuracy may be available through other means, e.g. the PolicyInformation.

If the ordering field is missing, or if the ordering field is present and set to false, then the genTime field only indicates the time at which the timestamp has been created by the TSA. In such a case, the ordering of Time Stamp tokens issued by the same TSA or different TSAs is only possible when the difference between the genTime of the first Time Stamp token and the genTime of the second Time Stamp token is greater than the sum of the accuracies of the genTime for each Time Stamp token.

If the ordering field is present and set to true, every Time Stamp token from the same TSA can always be ordered by only looking at the genTime parameter, whatever the accuracy of the genTime is.

The nonce field MUST be present if it was present in the TimeStampReq. In such a case it MUST be equal the value provided in the TimeStampReq structure.

The purpose of the tsa field is to give a hint for identifying the name of the TSA. If present, it MUST correspond to one of the subject names included in the certificate that is to be used to verify the token. However, the actual identification of the entity that signed the response will always occur through the use of the certificate identifier (ESSCertID Attribute) which is part of the SignerInfo. Extensions are a generic way to add additional information in the future. Extensions are defined in RFC 2459.


Field Summary
static ObjectID ID_CT_TSTINFO
          The ObjectID of this object
 
Constructor Summary
TSTInfo()
          Default constructor.
TSTInfo(ASN1Object component)
          This constructor tries to reconstruct a TSTInfo object from the given ASN.1 structure.
TSTInfo(ObjectID policy, MessageImprint message_imprint, java.math.BigInteger serial_number, java.util.Date gen_time)
          To create a new TSTInfo object a PolicyInformation object, a MessageImprint object, a serial number and a generalized time must be provided.
 
Method Summary
 void decode(ASN1Object component)
          This method tries to reconstruct a TSTInfo object from the given ASN.1 structure.
 void decode(byte[] tstInfo)
          This method tries to reconstruct a TSTInfo object from an encoded ASN.1 object.
 void decode(java.io.InputStream input_stream)
          This method tries to reconstruct a TSTInfo object from the given InputStream.
 Accuracy getAccuracy()
          Returns the Accuracy object.
 int getBlockSize()
          This method has no effect and is only provided to fully implement the iaik.cms.Content interface.
 ObjectID getContentType()
          Returns the OID of the implemented CMS content type.
 byte[] getEncoded()
          This method DER encodes the ASN.1 TSTInfo object.
 X509Extensions getExtensions()
          Returns the X509Extensions object.
 java.util.Date getGenTime()
          Returns the time string.
 MessageImprint getMessageImprint()
          Returns the MessageImprint object.
 java.math.BigInteger getNonce()
          Returns the nonce number.
 boolean getOrdering()
          Returns the ordering information.
 java.math.BigInteger getSerialNumber()
          Returns the serial number.
 GeneralName getTsa()
          Returns the GeneralName object describing the TSA.
 ObjectID getTSAPolicyID()
          Returns the PolicyInformation object.
 int getVersion()
          Returns the version of the implemented TSP.
 void setAccuracy(Accuracy accuracy)
          This method sets a new Accuracy object.
 void setBlockSize(int blockSize)
          This method has no effect and is only provided to fully implement the iaik.cms.Content interface.
 void setExtensions(X509Extensions extensions)
          This method sets the X509Extensions.
 void setGenTime(java.util.Date gen_time)
          This method sets a new generalized time.
 void setMessageImprint(MessageImprint message_imprint)
          This method sets a new MessageImprint object.
 void setNonce(java.math.BigInteger nonce)
          This method sets the nonce field.
 void setOrdering(boolean ordering)
          This method sets ordering to true or false.
 void setSerialNumber(java.math.BigInteger serial_number)
          This method sets a new serial number.
 void setTsa(GeneralName genName)
          This method sets a new GeneralName object.
 void setTSAPolicyID(ObjectID policy)
          This method sets a new PolicyInformation object.
 ASN1Object toASN1Object()
          Returns the ASN.1 structure of the TSTInfo object.
 java.lang.String toString()
          This method returns a string representation of this object.
 java.lang.String toString(boolean detailed)
          This method returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ID_CT_TSTINFO

public static final ObjectID ID_CT_TSTINFO
The ObjectID of this object

Constructor Detail

TSTInfo

public TSTInfo()
Default constructor. To create an empty TSTInfo object.


TSTInfo

public TSTInfo(ObjectID policy,
               MessageImprint message_imprint,
               java.math.BigInteger serial_number,
               java.util.Date gen_time)
        throws java.lang.NullPointerException
To create a new TSTInfo object a PolicyInformation object, a MessageImprint object, a serial number and a generalized time must be provided.

Parameters:
policy - Policy under which this TSTInfo object is constructed.
message_imprint - The hashed message and its algorithm identifier.
serial_number - A unique serial number.
gen_time - The current time.
Throws:
java.lang.NullPointerException - Thrown if one of the arguments is null.

TSTInfo

public TSTInfo(ASN1Object component)
        throws CodingException
This constructor tries to reconstruct a TSTInfo object from the given ASN.1 structure.

Parameters:
component - The ASN.1 structure.
Throws:
CodingException - Thrown if the given ASN1Object is not a valid TSTInfo ASN.1 object.
Method Detail

decode

public void decode(java.io.InputStream input_stream)
            throws java.io.IOException,
                   CMSParsingException
This method tries to reconstruct a TSTInfo object from the given InputStream.

Specified by:
decode in interface ContentStream
Parameters:
input_stream - The stream to read from.
Throws:
java.io.IOException - Thrown if the stream cannot be read.
CMSParsingException - Thrown if the given ASN1Object is not a TSTInfo ASN.1 object.

decode

public void decode(ASN1Object component)
            throws CMSParsingException
This method tries to reconstruct a TSTInfo object from the given ASN.1 structure.

Specified by:
decode in interface Content
Parameters:
component - The ASN.1 structure.
Throws:
CMSParsingException - Thrown if the given ASN.1 Object is not a TSTInfo ASN.1 object.

decode

public void decode(byte[] tstInfo)
            throws CMSParsingException,
                   CodingException
This method tries to reconstruct a TSTInfo object from an encoded ASN.1 object.

Parameters:
tstInfo - The encoded TSTInfo object.
Throws:
CMSParsingException - Thrown if the given ASN.1 Object is not a TSTInfo.
CodingException - Thrown if the given argument cannot be decoded.

getEncoded

public byte[] getEncoded()
This method DER encodes the ASN.1 TSTInfo object.

Returns:
DER encoded TSTInfo object.

toASN1Object

public ASN1Object toASN1Object()
Returns the ASN.1 structure of the TSTInfo object.

Specified by:
toASN1Object in interface ContentStream
Returns:
The ASN1Object of the TSTInfo object.

getBlockSize

public int getBlockSize()
This method has no effect and is only provided to fully implement the iaik.cms.Content interface.

Specified by:
getBlockSize in interface ContentStream
Returns:
This method always returns 0 as block size.

setBlockSize

public void setBlockSize(int blockSize)
This method has no effect and is only provided to fully implement the iaik.cms.Content interface.

Specified by:
setBlockSize in interface ContentStream
Parameters:
blockSize - This method has no effect.

setTSAPolicyID

public void setTSAPolicyID(ObjectID policy)
                    throws java.lang.NullPointerException
This method sets a new PolicyInformation object.

Parameters:
policy - The PolicyInformation object.
Throws:
java.lang.NullPointerException - Thrown if the given argument is null.

setMessageImprint

public void setMessageImprint(MessageImprint message_imprint)
                       throws java.lang.NullPointerException
This method sets a new MessageImprint object.

Parameters:
message_imprint - The MessageImprint object.
Throws:
java.lang.NullPointerException - Thrown if the given argument is null.

setSerialNumber

public void setSerialNumber(java.math.BigInteger serial_number)
                     throws java.lang.NullPointerException
This method sets a new serial number.

Parameters:
serial_number - The new unique serial number.
Throws:
java.lang.NullPointerException - Thrown if the given argument is null.

setGenTime

public void setGenTime(java.util.Date gen_time)
                throws java.lang.NullPointerException
This method sets a new generalized time.

Parameters:
gen_time - The generalized time.
Throws:
java.lang.NullPointerException - Thrown if the argument is null.

setAccuracy

public void setAccuracy(Accuracy accuracy)
                 throws java.lang.NullPointerException
This method sets a new Accuracy object.

Parameters:
accuracy - The Accuracy object.
Throws:
java.lang.NullPointerException - Thrown if the provided parameter is null.

setOrdering

public void setOrdering(boolean ordering)
This method sets ordering to true or false.

Parameters:
ordering - true or false.

setNonce

public void setNonce(java.math.BigInteger nonce)
              throws java.lang.NullPointerException
This method sets the nonce field.

Parameters:
nonce - The nonce.
Throws:
java.lang.NullPointerException - Thrown if the provided parameter is null.

setTsa

public void setTsa(GeneralName genName)
            throws java.lang.IllegalArgumentException
This method sets a new GeneralName object.

Parameters:
genName - The GeneralName object
Throws:
java.lang.NullPointerException - Thrown if the provided parameter is null.
java.lang.IllegalArgumentException

setExtensions

public void setExtensions(X509Extensions extensions)
                   throws java.lang.NullPointerException
This method sets the X509Extensions.

Parameters:
extensions - The X509Extensions object.
Throws:
java.lang.NullPointerException - Thrown if the provided parameter is null.

getContentType

public ObjectID getContentType()
Returns the OID of the implemented CMS content type.

Specified by:
getContentType in interface ContentStream
Returns:
The content type object identifier.

getVersion

public int getVersion()
Returns the version of the implemented TSP.

Returns:
The TSP version.

getTSAPolicyID

public ObjectID getTSAPolicyID()
Returns the PolicyInformation object.

Returns:
The PolicyInformation object.

getMessageImprint

public MessageImprint getMessageImprint()
Returns the MessageImprint object.

Returns:
The MessageImprint object.

getSerialNumber

public java.math.BigInteger getSerialNumber()
Returns the serial number.

Returns:
The serial number.

getGenTime

public java.util.Date getGenTime()
Returns the time string.

Returns:
The time generalized time.

getAccuracy

public Accuracy getAccuracy()
Returns the Accuracy object.

Returns:
The Accuracy object.

getOrdering

public boolean getOrdering()
Returns the ordering information.

Returns:
The ordering information.

getNonce

public java.math.BigInteger getNonce()
Returns the nonce number.

Returns:
The nonce number.

getTsa

public GeneralName getTsa()
Returns the GeneralName object describing the TSA.

Returns:
The GeneralName object.

getExtensions

public X509Extensions getExtensions()
Returns the X509Extensions object.

Returns:
The X509Extensions object.

toString

public java.lang.String toString(boolean detailed)
This method returns a string representation of this object.

Specified by:
toString in interface ContentStream
Parameters:
detailed - True if a detailed message should be displayed.
Returns:
A String which represents the TSTInfo object.

toString

public java.lang.String toString()
This method returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
A detailed String which represents the TSTInfo object.

This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note).

IAIK TSP, © 2002 IAIK, © 2003 - 2014 Stiftung SIC