public class TSPDemoUtils extends java.lang.Object
TimeStampDemo
,
TimeStampListener
Constructor and Description |
---|
TSPDemoUtils() |
Modifier and Type | Method and Description |
---|---|
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.
|
public TSPDemoUtils()
public static iaik.tsp.TimeStampReq createRequest(iaik.cms.SignerInfo signerInfo, iaik.asn1.ObjectID reqPolicy) throws iaik.tsp.TspException
signerInfo
- the SignerInfo to be time stampedreqPolicy
- the policy of the TSA from which to get a response,
maybe null
if we accept any TSAiaik.tsp.TspException
- if some error occurs during time stamp creationpublic static iaik.tsp.TimeStampResp sendRequest(iaik.tsp.TimeStampReq request, java.lang.String tsaUrl) throws iaik.tsp.TspException
request
- the time stamp request to be sent to the TSAtsaUrl
- the URL of the time stamp authority from which to
get the time stampiaik.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
public static void timeStamp(iaik.tsp.TimeStampToken tspToken, iaik.cms.SignerInfo signerInfo) throws iaik.tsp.TspException
tspToken
- the time stamp token to be added as attributesignerInfo
- the SignerInfo to be time stampediaik.tsp.TspException
- if some error occurs when adding the attributepublic static void validateResponse(iaik.tsp.TimeStampResp response, iaik.tsp.TimeStampReq request) throws iaik.tsp.TspException
response
- the time stamp response to be validatedrequest
- the time stamp request that has been sentiaik.tsp.TspException
- if the response is invalid (wrong MessageImprint, missing certificate,...)public static void validateSignatureTimeStampToken(iaik.cms.SignerInfo signerInfo) throws iaik.tsp.TspException
signerInfo
- the SignerInfo containing the SignatureTimeStampToken attributeiaik.tsp.TspException
- if the time stamp token validation failsjava.lang.NullPointerException
- if the SignerInfo does not contain a
SignatureTimeStampToken as expected