pdfGetEncryptionFingerprint
A Lumas-specific extension (not part of the standard
int32_t __stdcall pdfEncryptWithFingerprintA(PPDF IPDF, const char* Fingerprint);
const char* __stdcall pdfGetEncryptionFingerprintA(PPDF IPDF);
function pdfEncryptWithFingerprintA(const IPDF: PPDF; Fingerprint: PAnsiChar): Integer; stdcall;
function pdfGetEncryptionFingerprintA(const IPDF: PPDF): PAnsiChar; stdcall;
Purpose. A Lumas-specific extension (not part of the standard flat-C-API-compatible ABI surface): encrypt the document with an AES-256 key deterministically derived from a caller-supplied "fingerprint" string (e.g. a device ID or license identifier) — effectively a device/identity-locked PDF, rather than a human-memorized password.
Description. pdfEncryptWithFingerprint stores the raw Fingerprint string and calls SetEncryption(klAES256, pwd, pwd, -1) where pwd := SHA256Hex(Fingerprint) — the SHA-256 hex digest of the fingerprint is used as BOTH the open and owner password, and permissions are set to -1 (all permissions granted — this mechanism is about *identity-locking who can open the file*, not about restricting what an already-authorized opener can do). Verified: pdfGetEncryptionFingerprint returns exactly the same value used as the password — GetEncFingerprintStr computes SHA256Hex(FEncFingerprint), the identical hash EncryptWithFP used to derive pwd. This means calling pdfGetEncryptionFingerprint after pdfEncryptWithFingerprint discloses the document's actual open/owner password to any caller with document-handle access — by design for this mechanism (the whole point is a reproducible, re-derivable key from the same fingerprint input, not secrecy from a caller who already holds the document), but worth flagging explicitly since the name "fingerprint" might suggest a non-reversible identifier rather than the literal password material.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Fingerprint | Arbitrary caller-supplied identity string; its SHA-256 hex digest becomes the actual AES-256 open/owner password. |
Return value. pdfEncryptWithFingerprint: 1 on success (always, once SetEncryption succeeds — subject to the same PDF/A guard as pdfEncryptPDF above), 0 if IPDF is invalid. pdfGetEncryptionFingerprint: the SHA-256 hex digest (i.e., the actual password) as a transient string; empty if no fingerprint has been set via pdfEncryptWithFingerprint.
C# (P/Invoke)
public static extern IntPtr pdfGetEncryptionFingerprintW(IntPtr IPDF);
public static extern IntPtr pdfGetEncryptionFingerprint(IntPtr IPDF);
public static extern IntPtr pdfGetEncryptionFingerprintA(IntPtr IPDF);
Getters
pdfGetEncryptionFingerprintW
pdfGetEncryptionFingerprint
pdfGetEncryptionFingerprintA
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.