Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

StreamSec.DSI.Tsp

Classes, interfaces and records

classeTspError

inherits from Exception

(no public members)

interfaceiMessageImprint

(no public members)

interfaceiTimeStampReq

(no public members)

interfaceiPKIStatusInfo

(no public members)

interfaceiTimeStampResp

(no public members)

interfaceiTSTInfo

(no public members)

classtTspAlgorithmIdentifier

inherits from tASN1CustomStruct

tTspAlgorithmIdentifier AlgorithmIdentifier ::= SEQUENCE {
algorithm OBJECT IDENTIFIER, parameters NULL OPTIONAL The digest AlgorithmIdentifier of a MessageImprint (absent or NULL parameters; RFC 5816 prefers absent for the SHA-2 family).

(no public members)

interfaceiMessageImprint

inherits from iASN1CustomStruct

iMessageImprint / tMessageImprint MessageImprint ::= SEQUENCE { hashAlgorithm AlgorithmIdentifier, hashedMessage OCTET STRING The digest of the data being time-stamped (RFC 3161 2.4.1).

function get_hashAlgorithm: ObjectIdentifier; function get_hashedMessage: OctetString; procedure set_hashAlgorithm(const aValue: ObjectIdentifier); procedure set_hashedMessage(const aValue: OctetString); property hashAlgorithm: ObjectIdentifier read get_hashAlgorithm write set_hashAlgorithm; property hashedMessage: OctetString read get_hashedMessage write set_hashedMessage;

classtMessageImprint

inherits from tASN1CustomStruct

implements iMessageImprint

property hashAlgorithm: ObjectIdentifier read get_hashAlgorithm write set_hashAlgorithm; property hashedMessage: OctetString read get_hashedMessage write set_hashedMessage;

interfaceiTimeStampReq

inherits from iASN1CustomStruct

iTimeStampReq / tTimeStampReq TimeStampReq ::= SEQUENCE {
version INTEGER { v1(1) }, messageImprint MessageImprint,
reqPolicy TSAPolicyId OPTIONAL,
nonce INTEGER OPTIONAL,
certReq BOOLEAN DEFAULT FALSE,
extensions [0] IMPLICIT Extensions OPTIONAL The request that is DER encoded and posted to the TSA (RFC 3161 2.4.1).

function get_version: Integer; function get_messageImprint: iMessageImprint; function get_hasNonce: Boolean; function get_nonce: OctetString; function get_certReq: Boolean; property version: Integer read get_version; property messageImprint: iMessageImprint read get_messageImprint; property hasNonce: Boolean read get_hasNonce; property nonce: OctetString read get_nonce;
nonce returns the content octets of the nonce INTEGER (big endian).
property certReq: Boolean read get_certReq;

classtTimeStampReq

inherits from tASN1CustomStruct

implements iTimeStampReq

property version: Integer read get_version; property messageImprint: iMessageImprint read get_messageImprint; property hasNonce: Boolean read get_hasNonce; property nonce: OctetString read get_nonce; property certReq: Boolean read get_certReq;

classtPKIFreeText

inherits from tASN1CustomOFStruct

tPKIFreeText PKIFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String

(no public members)

interfaceiPKIStatusInfo

inherits from iASN1CustomStruct

iPKIStatusInfo / tPKIStatusInfo PKIStatusInfo ::= SEQUENCE {
status PKIStatus, statusString PKIFreeText OPTIONAL,
failInfo PKIFailureInfo OPTIONAL The TSA verdict; see the cPKIStatus* constants (RFC 3161 2.4.2).

function get_status: Integer; function get_statusText: string; function get_hasFailInfo: Boolean; function get_failInfo: OctetString; property status: Integer read get_status; property statusText: string read get_statusText;
statusText concatenates the PKIFreeText lines, '; ' separated.
property hasFailInfo: Boolean read get_hasFailInfo; property failInfo: OctetString read get_failInfo;
failInfo returns the raw PKIFailureInfo BIT STRING contents (first octet = unused-bit count), for diagnostics.

classtPKIStatusInfo

inherits from tASN1CustomStruct

implements iPKIStatusInfo

property status: Integer read get_status; property statusText: string read get_statusText; property hasFailInfo: Boolean read get_hasFailInfo; property failInfo: OctetString read get_failInfo;

interfaceiTimeStampResp

inherits from iASN1CustomStruct

iTimeStampResp / tTimeStampResp TimeStampResp ::= SEQUENCE {
status PKIStatusInfo, timeStampToken TimeStampToken OPTIONAL where TimeStampToken ::= ContentInfo (a CMS SignedData whose eContent is a TSTInfo). The token is decoded with the StreamSec.DSI.CMS classes.

function get_status: iPKIStatusInfo; function get_hasToken: Boolean; function get_token: iContentInfo; property status: iPKIStatusInfo read get_status; property hasToken: Boolean read get_hasToken; property token: iContentInfo read get_token;

classtTimeStampResp

inherits from tASN1CustomStruct

implements iTimeStampResp

property status: iPKIStatusInfo read get_status; property hasToken: Boolean read get_hasToken; property token: iContentInfo read get_token;

classtAccuracy

inherits from tASN1CustomStruct

tAccuracy Accuracy ::= SEQUENCE { seconds INTEGER OPTIONAL,
millis [0] IMPLICIT INTEGER (1..999) OPTIONAL,
micros [1] IMPLICIT INTEGER (1..999) OPTIONAL

(no public members)

interfaceiTSTInfo

inherits from iASN1CustomStruct

iTSTInfo / tTSTInfo TSTInfo ::= SEQUENCE {
version INTEGER { v1(1) },
policy TSAPolicyId, messageImprint MessageImprint,
serialNumber INTEGER,
genTime GeneralizedTime,
accuracy Accuracy OPTIONAL,
ordering BOOLEAN DEFAULT FALSE,
nonce INTEGER OPTIONAL,
tsa [0] GeneralName OPTIONAL,
extensions [1] IMPLICIT Extensions OPTIONAL The signed payload of a time-stamp token (RFC 3161 2.4.2). The tsa field is encoded explicitly because GeneralName is a CHOICE.

function get_version: Integer; function get_policy: ObjectIdentifier; function get_messageImprint: iMessageImprint; function get_serialNumber: OctetString; function get_genTime: TDateTime; function get_hasAccuracy: Boolean; function get_accuracySeconds: Integer; function get_accuracyMillis: Integer; function get_accuracyMicros: Integer; function get_ordering: Boolean; function get_hasNonce: Boolean; function get_nonce: OctetString; property version: Integer read get_version; property policy: ObjectIdentifier read get_policy; property messageImprint: iMessageImprint read get_messageImprint; property serialNumber: OctetString read get_serialNumber;
serialNumber returns the content octets of the serial INTEGER.
property genTime: TDateTime read get_genTime;
genTime is the UTC time asserted by the TSA.
property hasAccuracy: Boolean read get_hasAccuracy; property accuracySeconds: Integer read get_accuracySeconds;
accuracySeconds/Millis/Micros return -1 when the component is absent.
property accuracyMillis: Integer read get_accuracyMillis; property accuracyMicros: Integer read get_accuracyMicros; property ordering: Boolean read get_ordering; property hasNonce: Boolean read get_hasNonce; property nonce: OctetString read get_nonce;
nonce returns the content octets of the nonce INTEGER (big endian).

classtTSTInfo

inherits from tASN1CustomStruct

implements iTSTInfo

property version: Integer read get_version; property policy: ObjectIdentifier read get_policy; property messageImprint: iMessageImprint read get_messageImprint; property serialNumber: OctetString read get_serialNumber; property genTime: TDateTime read get_genTime; property hasAccuracy: Boolean read get_hasAccuracy; property accuracySeconds: Integer read get_accuracySeconds; property accuracyMillis: Integer read get_accuracyMillis; property accuracyMicros: Integer read get_accuracyMicros; property ordering: Boolean read get_ordering; property hasNonce: Boolean read get_hasNonce; property nonce: OctetString read get_nonce;

classTstTimeStampClient — component reference

inherits from TComponent

TstTimeStampClient

RFC 3161 time-stamp client. Configure TsaURL (plus HashAlgorithm / Nonce / RequestCertificates / PolicyOID as needed), then call RequestTimeStamp with the data to stamp - for a CMS signature time-stamp that is the SignerInfo signature value, which AddSignatureTimeStamp does for you. The returned token has already passed the full verification described in the unit header; the TSA certificate is in LastTsaCertificate for the caller's trust decision. VerifyToken / VerifyTokenDigest re-verify a stored token without any network exchange (nonce and clock-skew checks do not apply there - a stored token is historical).

constructor Create(aOwner: TComponent); override; function RequestTimeStamp(const aData : OctetString; out aToken: iContentInfo): Boolean;
RequestTimeStamp hashes aData with HashAlgorithm and performs the complete transaction; on True aToken is the verified time-stamp token. Diagnostic detail for the most recent call is available through the LastError / LastStatus / LastStatusText / LastGenTime / LastTsaCertificate / LastTokenDER properties. » member page
function RequestTimeStampDigest(const aDigest : OctetString; aDigestAlg: tHashAlgorithm; out aToken : iContentInfo): Boolean;
RequestTimeStampDigest is RequestTimeStamp for a caller-computed digest (the digest length must match aDigestAlg). » member page
function VerifyToken(const aToken: iContentInfo; const aData : OctetString; out aInfo : iTSTInfo): Boolean;
VerifyToken verifies a stored token against the data it stamped: the message imprint is recomputed from aData with the token's own imprint algorithm. No network exchange; nonce and clock skew are not checked. On True, aInfo carries the decoded TSTInfo and LastTsaCertificate / LastGenTime are updated. » member page
function VerifyTokenDigest(const aToken : iContentInfo; const aDigest : OctetString; aDigestAlg: tHashAlgorithm; out aInfo : iTSTInfo): Boolean;
VerifyTokenDigest is VerifyToken for a caller-computed digest: the token's imprint must use exactly aDigestAlg and equal aDigest. » member page
property LastError: string read fLastError;
LastError describes the failure when the most recent call returned False; it is empty otherwise. » member page
property LastStatus: Integer read fLastStatus;
LastStatus is the PKIStatus of the most recent exchange (see the cPKIStatus* constants), or -1 when no response was decoded. » member page
property LastStatusText: string read fLastStatusText;
LastStatusText carries the TSA's PKIFreeText explanation, if any. » member page
property LastGenTime: TDateTime read fLastGenTime;
LastGenTime is the genTime (UTC) of the most recently verified token. » member page
property LastTsaCertificate: iCertificate read fLastTsaCertificate;
LastTsaCertificate is the certificate that signed the most recently verified token. The client proves the token is signed by this certificate and that it carries the id-kp-timeStamping usage; whether the certificate chains to a trusted root is the caller's decision. » member page
property LastTokenDER: OctetString read fLastTokenDER;
LastTokenDER is the raw DER of the most recently obtained token - exactly the octets a CAdES/PAdES consumer embeds. » member page
property TsaURL: string read fTsaURL write fTsaURL;
TsaURL locates the TSA (http or https). An https URL borrows the GlobalServer TLS client session, like the OCSP/CRL transports. » member page
property Timeout: Cardinal read fTimeout write fTimeout default 15000;
Timeout is the per-read socket timeout in milliseconds (default 15000). » member page
property HashAlgorithm: tHashAlgorithm read fHashAlgorithm write fHashAlgorithm default haSHA256;
HashAlgorithm selects the message imprint digest (default haSHA256). » member page
property Nonce: Boolean read fNonce write fNonce default True;
Nonce adds a random nonce to each request and requires the response to echo it (RFC 3161 2.4.2). Default True. » member page
property NonceLength: Integer read fNonceLength write fNonceLength default 8;
NonceLength is the length, in octets, of the generated nonce (1..32, default 8 = the customary 64 bit nonce). » member page
property RequestCertificates: Boolean read fRequestCertificates write fRequestCertificates default True;
RequestCertificates asks the TSA to include its certificate chain in the token (certReq, RFC 3161 2.4.1). Default True - without it the token cannot be verified stand-alone. » member page
property PolicyOID: string read fPolicyOID write fPolicyOID;
PolicyOID optionally requests a specific TSA policy (reqPolicy). Leave empty to let the TSA choose. » member page
property TsaCertificate: iCertificate read fTsaCertificate write fTsaCertificate;
TsaCertificate is used to verify a token that embeds no certificate of its own - what RequestCertificates False produces. Full description »
property MaxClockSkew: Cardinal read fMaxClockSkew write fMaxClockSkew default 300;
MaxClockSkew is the tolerance, in seconds, applied to the token genTime against the local UTC clock during RequestTimeStamp (default 300; set 0 to disable the check). » member page
property ExtKeyUsagePolicy: tExtKeyUsagePolicy read fExtKeyUsagePolicy write fExtKeyUsagePolicy default ekupAllowUnconstrained;
ExtKeyUsagePolicy decides how strictly the TSA certificate is held to the id-kp-timeStamping key purpose that RFC 3161 2.3 requires of it. Full description »

Routines