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 behavior and remains unverified
Syntax
Delphi
Function TPDFlib.GetPermissionsVerified: Integer;
Return values
| 1 | The /Perms entry was decrypted and its permission word matched |
|---|---|
| 0 | An AES-256 document whose /Perms could not be verified; the document still opens |
| -1 | Not applicable, either because the document is unencrypted or because it uses a security handler revision below 5 |