Creates a new V5 security handler with AES-256 encryption.
Configuration options including optional pre-computed keys.
OptionaldocumentId?: string | ByteArray | PdfIdDocument identifier for key derivation.
OptionalownerKey?: ByteArrayPre-computed owner key.
OptionalownerPassword?: string | ByteArrayOwner password for full document access.
Optionalpassword?: string | ByteArrayUser password for opening the document.
OptionaluserKey?: ByteArrayPre-computed user key.
ProtectedcryptMap of named crypt filters.
ProtectedcryptMapping of content types to crypt filter names.
The encryption dictionary containing all encryption parameters.
Protected OptionaldocumentDocument identifier for key derivation.
Whether to encrypt document metadata.
Protected OptionalfilePromise resolving to the file encryption key.
Protected OptionalmasterDerived master encryption key.
Protected OptionalownerOwner encrypted file key (OE value).
Protected OptionalownerComputed owner key (O value).
Protected OptionalownerOwner password for full access.
ProtectedpasswordUser password for authentication.
Numeric permission flags.
Protected OptionalpermsPermissions entry (Perms value).
Protected OptionaluserUser encrypted file key (UE value).
Protected OptionaluserComputed user key (U value).
ProtectedbuildBuilds the numeric permission flags from a PdfPermissions object.
The permissions to encode.
The numeric permission flags.
Checks if metadata encryption is enabled.
True if metadata should be encrypted.
ProtectedcomputeComputes the object encryption key (same as master key for V5).
The master encryption key.
ProtectedcomputeComputes the owner key (O value) using RC4-128 algorithm.
The computed owner key.
ProtectedcomputeComputes the user key (U value) using RC4-128 algorithm.
The computed user key.
Decodes the numeric permission flags into a PdfPermissions object.
An object with boolean flags for each permission.
Decrypts data using the appropriate crypt filter for the content type.
The type of content being decrypted.
The encrypted data.
OptionalobjectNumber: numberThe PDF object number.
OptionalgenerationNumber: numberThe PDF generation number.
The decrypted data.
Recursively decrypts all strings and streams within an indirect object.
The indirect object to decrypt.
Encrypts data using the appropriate crypt filter for the content type.
The type of content being encrypted.
The data to encrypt.
OptionalobjectNumber: numberThe PDF object number.
OptionalgenerationNumber: numberThe PDF generation number.
The encrypted data.
Recursively encrypts all strings and streams within an indirect object.
The indirect object to encrypt.
ProtectedgetGets a crypt filter by name.
The crypt filter name.
The crypt filter, or undefined if not found.
Gets the crypt filter assigned to a content type.
The content type ('string', 'stream', or 'file').
The assigned crypt filter, or null if none.
Gets the encryption key length in bits.
256 for V5 encryption.
Gets the security handler filter name.
'Standard' for password-based encryption.
Gets the encryption revision number.
6 for V5 encryption.
Gets the encryption version number.
5 for AES-256 encryption.
ProtectedinitInitializes encryption keys, either deriving from existing values or generating new ones.
Checks if the handler is ready (has user encrypted file key).
True if the handler has the required keys.
Reads V5-specific encryption parameters from the dictionary.
The encryption dictionary from the PDF.
Recovers the user password from the owner password. Not supported for AES-256 encryption.
OptionalownerPassword: string | ByteArrayRegisters a named crypt filter.
The filter name.
The crypt filter instance.
Assigns a crypt filter to a content type.
The content type.
The crypt filter name.
Sets the master encryption key directly.
The master key to use.
Sets the owner password.
The owner password string or bytes.
Sets the user password.
The user password string or bytes.
V5 security handler implementing AES-256-CBC encryption. This is the most secure encryption method (PDF 2.0).
Example