PLBuildCMSSignatureTimeStampAttribute

signature utilities

Description

Encodes one CMS signature-time-stamp attribute around a DER-encoded time-stamp token. The result is a DER SEQUENCE that holds the OBJECT IDENTIFIER 1.2.840.113549.1.9.16.2.14 (signature-time-stamp) followed by a SET containing the token bytes exactly as passed

The function encodes only. It does not parse or validate the token, does not check that it is an RFC 3161 TimeStampToken or that its imprint matches a digest, and does not insert the attribute into a CMS blob or a PDF signature. It is declared in the read-only PDFlibCMSRead unit available in every edition and needs no TPDFlib instance

In the Enterprise edition TPDFlib.BuildPAdESSignatureTimeStampAttribute returns this same encoding for the same token, and PLExtractCMSSignatureTimeStampTokens reads attributes in this form back out of a SignedData blob

Syntax

Delphi

Function PLBuildCMSSignatureTimeStampAttribute(Const TimeStampTokenDER: AnsiString): AnsiString;

Parameters

TimeStampTokenDERThe DER-encoded time-stamp token to wrap, as binary DER bytes. The value is embedded unchanged and nothing is decoded or stripped from it, so pass the plain token and not PDF hexadecimal text or a value that still carries /Contents reservation padding

Return values

AnsiStringThe complete DER attribute: a SEQUENCE of the OBJECT IDENTIFIER 1.2.840.113549.1.9.16.2.14 and a SET holding TimeStampTokenDER. The function has no failure path and never returns an empty string
''Never returned, not even for an empty TimeStampTokenDER: an empty token produces a SET with a length of zero, which is still a well-formed attribute

Remarks

The attribute is returned on its own; it becomes part of a signature only when a caller adds it to the unsigned attributes ([1] set) of a SignerInfo. The signature time-stamp application path of the Enterprise edition validates the token and its imprint first, then uses this function and injects the attribute into the selected signer, where it replaces an existing signature-time-stamp attribute before the set is sorted and the enclosing lengths are rebuilt

PLExtractCMSSignatureTimeStampTokens finds attributes built this way: it matches the same OBJECT IDENTIFIER in the unsigned attributes of every signer and returns each value of the set that is a SEQUENCE

Lengths are encoded in the definite DER form: the short form for up to 127 content bytes and the long form with one to four length octets above that. The indefinite-length form is never produced

This Pascal unit function has no separate DLL or ActiveX forwarding entry point.

See also

PLExtractCMSSignatureTimeStampTokens, BuildPAdESSignatureTimeStampAttribute, PLExtractCMSCertificates, PLCheckCMSSignedDataStructure, SetPAdESSignatureTimeStampToken