TPDFlibDigestAlgorithm
Data types, security and signatures
Description
TPDFlibDigestAlgorithm selects the hash used for the signed byte range and the digest algorithms written into the CMS SignerInfo and its signing-certificate attribute.
daAuto leaves the choice to the library and resolves it per subfilter; an explicit value is used as given, subject to the constraints of the signing path.
Syntax
Delphi
TPDFlibDigestAlgorithm = (daAuto= 0, daSHA1= 1, daSHA256= 2, daSHA384= 3,
daSHA512= 4, daSHA3_256= 5, daSHA3_384= 6, daSHA3_512= 7, daSM3= 8);Values
| daAuto | Resolve from the subfilter: SHA-1 for the legacy adbe.pkcs7.sha1 path and SHA-256 for every other path, including ETSI.CAdES.detached, adbe.pkcs7.detached and custom subfilters |
|---|---|
| daSHA1 | SHA-1 (1.3.14.3.2.26), retained for legacy validators and not allowed by the PAdES baseline profile |
| daSHA256 | SHA-256 (2.16.840.1.101.3.4.2.1), the modern minimum and the default resolution for non-legacy paths |
| daSHA384 | SHA-384 (2.16.840.1.101.3.4.2.2) |
| daSHA512 | SHA-512 (2.16.840.1.101.3.4.2.3) |
| daSHA3_256 | SHA3-256 (2.16.840.1.101.3.4.2.8) |
| daSHA3_384 | SHA3-384 (2.16.840.1.101.3.4.2.9) |
| daSHA3_512 | SHA3-512 (2.16.840.1.101.3.4.2.10) |
| daSM3 | SM3 (1.2.156.10197.1.401); a CMS signature made with it requires an SM2 identity, and it is rejected on the precomputed-digest paths |
Remarks
The resolved algorithm appears as SignerInfo.digestAlgorithm and drives the ESS signing-certificate-v2 hash; for that attribute SHA-1 and SHA-256 both hash as SHA-256, and the optional hashAlgorithm field is omitted because SHA-256 is the DER default.
The legacy adbe.pkcs7.sha1 subfilter always encapsulates a SHA-1 digest of the byte range (ISO 32000-1 12.8.3.3.1); the selector then chooses the digest the signer signs over that content.
daSM3 is rejected when the subfilter uses the caller-precomputed digest path, and on the CMS paths it is accepted only when the identity is SM2.
SHAKE256 has no value here: within the CMS profile it is only legal as the internal digest of Ed448, and it is exposed separately as a digest primitive.
A field seed value that constrains digest methods is checked against the resolved algorithm, so daAuto is compared as SHA-1 or SHA-256 rather than as auto.
See also
SetSignProcessDigestAlgorithm, SetPAdESSignatureTimeStampDigestAlgorithm, TPDFlibSigner