IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

demo.cms.tsp
Class TSPDemoUtils

java.lang.Object
  extended by demo.cms.tsp.TSPDemoUtils

public class TSPDemoUtils
extends java.lang.Object

Some utils for creating and sending time stamp requests, validating responses and adding time stamp token attributes. Used by the TSP demo.

See Also:
TimeStampDemo, TimeStampListener

Constructor Summary
TSPDemoUtils()
           
 
Method Summary
static iaik.tsp.TimeStampReq createRequest(iaik.cms.SignerInfo signerInfo, iaik.asn1.ObjectID reqPolicy)
          Creates a TimeStampRequest for the given SignerInfo.
static iaik.tsp.TimeStampResp sendRequest(iaik.tsp.TimeStampReq request, java.lang.String tsaUrl)
          Sends the given time stamp request to the given TSA.
static void timeStamp(iaik.tsp.TimeStampToken tspToken, iaik.cms.SignerInfo signerInfo)
          Adds a SignatureTimeStampToken attribute to the given SignerInfo.
static void validateResponse(iaik.tsp.TimeStampResp response, iaik.tsp.TimeStampReq request)
          Validates the response received from the TSA.
static void validateSignatureTimeStampToken(iaik.cms.SignerInfo signerInfo)
          Validates an unsigned SignatureTimeStampToken contained in the given SignerInfo.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TSPDemoUtils

public TSPDemoUtils()
Method Detail

createRequest

public static iaik.tsp.TimeStampReq createRequest(iaik.cms.SignerInfo signerInfo,
                                                  iaik.asn1.ObjectID reqPolicy)
                                           throws iaik.tsp.TspException
Creates a TimeStampRequest for the given SignerInfo.

Parameters:
signerInfo - the SignerInfo to be time stamped
reqPolicy - the policy of the TSA from which to get a response, maybe null if we accept any TSA
Returns:
the time stamp request just created
Throws:
iaik.tsp.TspException - if some error occurs during time stamp creation

sendRequest

public static iaik.tsp.TimeStampResp sendRequest(iaik.tsp.TimeStampReq request,
                                                 java.lang.String tsaUrl)
                                          throws iaik.tsp.TspException
Sends the given time stamp request to the given TSA.

Parameters:
request - the time stamp request to be sent to the TSA
tsaUrl - the URL of the time stamp authority from which to get the time stamp
Throws:
iaik.tsp.TspException - if an error occurs during sending the request to the TSA (e.g. connecting to the TSA fails, ...)
java.lang.NullPointerException - if request or tsaUrl are null

timeStamp

public static void timeStamp(iaik.tsp.TimeStampToken tspToken,
                             iaik.cms.SignerInfo signerInfo)
                      throws iaik.tsp.TspException
Adds a SignatureTimeStampToken attribute to the given SignerInfo.

Parameters:
tspToken - the time stamp token to be added as attribute
signerInfo - the SignerInfo to be time stamped
Throws:
iaik.tsp.TspException - if some error occurs when adding the attribute

validateResponse

public static void validateResponse(iaik.tsp.TimeStampResp response,
                                    iaik.tsp.TimeStampReq request)
                             throws iaik.tsp.TspException
Validates the response received from the TSA.

Parameters:
response - the time stamp response to be validated
request - the time stamp request that has been sent
Throws:
iaik.tsp.TspException - if the response is invalid (wrong MessageImprint, missing certificate,...)

validateSignatureTimeStampToken

public static void validateSignatureTimeStampToken(iaik.cms.SignerInfo signerInfo)
                                            throws iaik.tsp.TspException
Validates an unsigned SignatureTimeStampToken contained in the given SignerInfo.

Parameters:
signerInfo - the SignerInfo containing the SignatureTimeStampToken attribute
Throws:
iaik.tsp.TspException - if the time stamp token validation fails
java.lang.NullPointerException - if the SignerInfo does not contain a SignatureTimeStampToken as expected

IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

v6.1
(c) 2002 IAIK, (c) 2003 - 2025 SIC