Table of Contents

Class TSAClientBouncyCastle

Namespace
iText.Signatures
Assembly
itext.sign.dll

Time Stamp Authority Client interface implementation using Bouncy Castle org.bouncycastle.tsp package.

public class TSAClientBouncyCastle : ITSAClient
Inheritance
TSAClientBouncyCastle
Implements
Inherited Members

Remarks

Time Stamp Authority Client interface implementation using Bouncy Castle org.bouncycastle.tsp package.

Created by Aiken Sam, 2006-11-15, refactored by Martin Brunecky, 07/15/2007 for ease of subclassing.

Constructors

TSAClientBouncyCastle(string)

Creates an instance of a TSAClient that will use BouncyCastle.

public TSAClientBouncyCastle(string url)

Parameters

url string

String - Time Stamp Authority URL (i.e. "http://tsatest1.digistamp.com/TSA")

TSAClientBouncyCastle(string, string, string)

Creates an instance of a TSAClient that will use BouncyCastle.

public TSAClientBouncyCastle(string url, string username, string password)

Parameters

url string

String - Time Stamp Authority URL (i.e. "http://tsatest1.digistamp.com/TSA")

username string

String - user(account) name

password string

String - password

TSAClientBouncyCastle(string, string, string, int, string)

Constructor.

public TSAClientBouncyCastle(string url, string username, string password, int tokSzEstimate, string digestAlgorithm)

Parameters

url string

Time Stamp Authority URL (i.e. "http://tsatest1.digistamp.com/TSA")

username string

user(account) name, optional

password string

password, optional if used in combination with username, the credentials will be used in basic authentication. Use only in combination with a https url to ensure encryption

tokSzEstimate int

estimated size of received time stamp token (DER encoded)

digestAlgorithm string

is a hash algorithm

Remarks

Constructor. Note the token size estimate is updated by each call, as the token size is not likely to change (as long as we call the same TSA using the same imprint length).

Fields

DEFAULTHASHALGORITHM

The default value for the hash algorithm

public const string DEFAULTHASHALGORITHM = "SHA-256"

Field Value

string

DEFAULTTOKENSIZE

The default value for token size estimation.

public const int DEFAULTTOKENSIZE = 10240

Field Value

int

digestAlgorithm

Hash algorithm

protected string digestAlgorithm

Field Value

string

tokenSizeEstimate

Estimate of the received time stamp token

protected int tokenSizeEstimate

Field Value

int

tsaInfo

An interface that allows you to inspect the timestamp info.

protected ITSAInfoBouncyCastle tsaInfo

Field Value

ITSAInfoBouncyCastle

tsaPassword

TSA password

protected string tsaPassword

Field Value

string

tsaURL

URL of the Time Stamp Authority

protected string tsaURL

Field Value

string

tsaUsername

TSA Username

protected string tsaUsername

Field Value

string

Methods

GetMessageDigest()

Gets the MessageDigest to digest the data imprint

public virtual IDigest GetMessageDigest()

Returns

IDigest

the digest algorithm name

GetTSAReqPolicy()

Gets the TSA request policy that will be used when retrieving timestamp token.

public virtual string GetTSAReqPolicy()

Returns

string

policy id, or null if not set

GetTSAResponse(byte[])

Get timestamp token - communications layer

protected virtual byte[] GetTSAResponse(byte[] requestBytes)

Parameters

requestBytes byte[]

is a byte representation of TSA request

Returns

byte[]
  • byte[] - TSA response, raw bytes (RFC 3161 encoded)

GetTimeStampToken(byte[])

Get RFC 3161 timeStampToken.

public virtual byte[] GetTimeStampToken(byte[] imprint)

Parameters

imprint byte[]

data imprint to be time-stamped

Returns

byte[]

encoded, TSA signed data of the timeStampToken

Remarks

Get RFC 3161 timeStampToken. Method may return null indicating that timestamp should be skipped.

GetTokenSizeEstimate()

Get the token size estimate.

public virtual int GetTokenSizeEstimate()

Returns

int

an estimate of the token size

Remarks

Get the token size estimate. Returned value reflects the result of the last succesfull call, padded

SetTSAInfo(ITSAInfoBouncyCastle)

public virtual void SetTSAInfo(ITSAInfoBouncyCastle tsaInfo)

Parameters

tsaInfo ITSAInfoBouncyCastle

the tsaInfo to set

SetTSAReqPolicy(string)

Sets the TSA request policy that will be used when retrieving timestamp token.

public virtual void SetTSAReqPolicy(string tsaReqPolicy)

Parameters

tsaReqPolicy string

policy id