GetPermissionsVerified

Security and signatures

Description

For an AES-256 document the /Perms entry carries an authenticated encrypted copy of the permission word. When that entry is missing or has the wrong length the library still opens the document, because /U and /UE continue to prove the password. This function reports whether the permission word was actually validated, so an application that needs stronger guarantees can decide how to handle an unverifiable /Perms without the library refusing to read the file.

For a complete 16-byte /Perms entry, authentication checks the marker, the four reserved bytes and the encrypted metadata flag before marking permissions as verified; inconsistent values reject the password

A missing entry or an entry of the wrong length retains the existing compatibility behaviour and remains unverified

Syntax

Delphi

Function TPDFlib.GetPermissionsVerified: Integer;

Return values

1The /Perms entry decrypted successfully and its permission word matched
0An AES-256 document where /Perms could not be verified; the document still opens
-1Not applicable: the document is either unencrypted or uses a security handler revision below 5