SetSignatureFieldSeedValue

Security and signatures

Description

Creates or replaces the /SV seed-value dictionary of an unsigned signature field and selects which constraints a signing operation must enforce

Syntax

Delphi

Function TPDFlib.SetSignatureFieldSeedValue(Index, Flags: Integer; Const SubFilters, DigestMethods, Reasons: WideString; Const LegalAttestations: WideString= ''): Integer;

ActiveX

Function PDFlib::SetSignatureFieldSeedValue(Index As Long, Flags As Long, SubFilters As String, DigestMethods As String, Reasons As String) As Long

DLL

int DLSetSignatureFieldSeedValue(int InstanceID, int Index, int Flags, const wchar_t* SubFilters, const wchar_t* DigestMethods, const wchar_t* Reasons);
int DLSetSignatureFieldSeedValueA(int InstanceID, int Index, int Flags, const char* SubFilters, const char* DigestMethods, const char* Reasons);

Parameters

IndexOne-based form-field index identifying an unsigned signature field
FlagsBit mask selecting the required constraints: PDF_SIGNATURE_SEED_FILTER (1) filter, PDF_SIGNATURE_SEED_SUBFILTER (2) SubFilter, PDF_SIGNATURE_SEED_VERSION (4) seed-value version, PDF_SIGNATURE_SEED_REASON (8) reason, PDF_SIGNATURE_SEED_LEGAL_ATTESTATION (16) legal attestation, PDF_SIGNATURE_SEED_ADD_REV_INFO (32) revocation information and PDF_SIGNATURE_SEED_DIGEST_METHOD (64) digest method
SubFiltersSemicolon-delimited allowed SubFilter names such as ETSI.CAdES.detached or adbe.pkcs7.detached
DigestMethodsSemicolon-delimited allowed digest names: SHA1, SHA256, SHA384, SHA512, SHA3-256, SHA3-384, or SHA3-512
ReasonsSemicolon-delimited allowed signing reasons; an empty list or . prohibits a custom reason when the reason flag is required
LegalAttestationsSemicolon-delimited allowed legal attestation names for the /LegalAttestation seed-value constraint; empty by default; the compatible SetSignatureFieldSeedValueEx entry points expose this argument through the DLL and ActiveX

Return values

1The seed-value dictionary was written
0The field, the flags or a required value list was invalid, or an indirect seed object could not be registered

Remarks

The original DLL and ActiveX signatures keep the empty LegalAttestations default; use the Ex entry points to pass this list

The method writes seed-value version 2 and filter Adobe.PPKLite

The SV value is an indirect dictionary reference, as the signature field format requires; the replacement is only published once object registration has succeeded, and if registration is unavailable the previous field value is left intact

Seed reading handles existing direct dictionaries as a compatibility path, as well as saved indirect dictionaries, referenced members and array elements; reference chains are capped at 32 hops, and pending replacements and cached edits keep their current values

Required constraints that this release cannot enforce are rejected when the dictionary is authored and fail closed when read from an existing PDF

When a seeded field is signed, the signing process enforces Filter, SubFilter, V, Reasons, LegalAttestation, AddRevInfo and DigestMethod, the /MDP permission level (0 for an approval signature, 1 to 3 for a certification at that level), a required /LockDocument (true demands a level 1 certification, false forbids one), and the certificate constraints Subject, Issuer (the issuer may appear anywhere in the chain carried by the signing identity), OID (certificate policies), SubjectDN (every attribute of one listed name, compared case-insensitively) and KeyUsage. A required /AppearanceFilter is refused, since named appearances are not applied. /TimeStamp is not checked at signing time: apply the signature time stamp afterwards with ApplyPAdESSignatureTimeStamp. Any violation stops the process with result 13, and GetSignProcessSeedValueError names the offending constraint

The ANSI DLL variant is DLSetSignatureFieldSeedValueA

See also

AddSignatureFieldSeedCertificate, ClearSignatureFieldSeedValue, GetSignProcessSeedValueError