|
Decrypts a loaded RC4 Standard encrypted PDF object graph in memory.
Delphi syntax:
procedure DecryptLoadedDocument(const Password: AnsiString);
Description
DecryptLoadedDocument validates the supplied user or owner password for a PDF already loaded with LoadFromFile or LoadFromStream. For RC4-40 and RC4-128 Standard security handler files, it decrypts loaded strings and streams, clears the loaded encryption state, and allows SaveLoadedDocument to write an unencrypted copy.
The password overloads of LoadFromFile and LoadFromStream call this method automatically. Unsupported encryption revisions raise an exception before output is written.Crypt filter can override StmF through an aligned DecodeParms entry whose Name selects Identity, V2, or AESV2. After decryption, the consumed filter and its aligned parameters are removed so later stream decoding starts with the next declared filter
Password-derived file keys, per-object keys, AES contexts, and temporary plaintext are explicitly overwritten on success and exception paths. The password overloads of LoadFromFile and LoadFromStream call this method automatically, while unsupported encryption revisions raise an exception before output is written
Code Example
PDF.LoadFromFile('Protected.pdf', 'user-password');
PDF.SaveLoadedDocument('Unencrypted.pdf');
|