Table of contents
Namespace: Com\Tecnick\Pdf\Sign\Output
Final: Yes
File: Signature.php line 45
Emits the /Sig value dictionary (the object referenced by a signature field’s /V): the fixed skeleton, the /SubFilter, and the /ByteRange and /Contents placeholders that the host rewrites while signing, plus the optional Name/Location/Reason/ContactInfo strings.
The /Reference (DocMDP or UR3 transform) and the /M date token are supplied by the caller as ready fragments, their content and formatting depending on host state (certification level, user rights, timezone, encryption). String encoding (escaping, UTF-16, encryption) of the info values is delegated to an injected encoder.
Tags
- since: 2026-07-15
- category: Library
- author: Nicola Asuni info@tecnick.com
- copyright: 2026 Nicola Asuni - Tecnick.com LTD
- license: https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
- link: https://github.com/tecnickcom/tc-lib-pdf-sign
Constants
BYTE_RANGE_PLACEHOLDER
File: Signature.php line 50
public mixed BYTE_RANGE_PLACEHOLDER = '/ByteRange[0 ********** ********** **********]'
DEFAULT_CONTENTS_LENGTH
File: Signature.php line 55
public mixed DEFAULT_CONTENTS_LENGTH = 11742
MAX_CONTENTS_LENGTH
File: Signature.php line 64
public mixed MAX_CONTENTS_LENGTH = 1048576
The window holds one CMS signature or one RFC 3161 token, so a megabyte of hex is far beyond what either needs. Past it str_repeat() would exhaust memory rather than throw.
Methods
objectHead()
File: Signature.php line 142
public static objectHead(int $objectId, string $type, string $subFilter, int $contentsLength, string $label) : string
ISO 32000-2 section 12.8.5 gives a /Sig and a /DocTimeStamp the same shape: the Adobe.PPKLite filter, the ByteRange placeholder the host rewrites once it knows the offsets, and a /Contents window reserved as hex zeros. Emitted here for both.
Parameters
- $objectId : int: Object number for the value object.
- $type : string: /Type name, without the leading solidus.
- $subFilter : string: /SubFilter name, without the leading solidus.
- $contentsLength : int: Placeholder length reserved for the signature, in hex digits; must be even and positive.
- $label : string: Name of the object, for the error message.
Tags
- throws: Exception If a name, the object number, or the placeholder length is invalid.
Return values
string
valueObject()
File: Signature.php line 91
public valueObject(int $objectId, string $subFilter, string $reference, array<string, string> $info, string $dateValue[, int $contentsLength = self::DEFAULT_CONTENTS_LENGTH ][, callable|null $stringEncoder = null ]) : string
Parameters
- $objectId : int: Object number for the /Sig value object.
- $subFilter : string: e.g. “ETSI.CAdES.detached” or “adbe.pkcs7.detached”.
- $reference : string: Ready /Reference fragment (DocMDP or UR3 transform), leading space included, or ’’ for an approval signature.
- $info : array<string, string>: Optional Name/Location/Reason/ContactInfo.
- $dateValue : string: Ready (already encoded) PDF string token for /M, or ’’ to omit the entry.
- $contentsLength : int = self::DEFAULT_CONTENTS_LENGTH: Placeholder length for /Contents, in hex digits; must be even and positive.
- $stringEncoder : callable|null = null: fn(string $text, int $objectId): string returning a PDF string token.
Tags
- throws: Exception If the object number, the /SubFilter, an info value, or the placeholder length is invalid, or the string encoder returns a non-string value.
Return values
string