DAOpenFromStreamWithEncryptionKey

Document management, Direct access functionality, Security, Stream input

Description

Opens an encrypted seekable stream for authorised recovery or investigation by accepting the hexadecimal file-encryption key directly instead of deriving it from a password

Syntax

Delphi

Function TPDFlib.DAOpenFromStreamWithEncryptionKey(InStream: TStream; Const EncryptionKeyHex: WideString; Options: Integer = 0): Integer;

Parameters

InStreamA non-nil seekable PDF stream that remains owned by the caller
EncryptionKeyHexAn even-length ASCII hexadecimal key with no prefix or whitespace and the exact length required by the encryption revision
OptionsZero requires an available verifier; PDF_RAW_KEY_ALLOW_UNVERIFIED permits an otherwise valid key only when the document has no usable verifier

Return values

Non-zeroA Direct Access file handle
0The input could not be opened; inspect LastErrorCode

Remarks

The library never takes ownership of InStream and closing the Direct Access handle leaves it usable by the caller

Available verifiers are always checked and a mismatch is never accepted

Call DAGetEncryptionKeyValidation after opening to inspect the validation result