SetCryptFilterConfiguration

Security, Attachments

Description

Atomically selects which PDF object classes use the document standard crypt filter during the next encryption operation

Syntax

Delphi

Function TPDFlib.SetCryptFilterConfiguration(EncryptStrings, EncryptStreams, EncryptEmbeddedFiles: Integer): Integer;

DLL

Function DLSetCryptFilterConfiguration(InstanceID, EncryptStrings, EncryptStreams, EncryptEmbeddedFiles: Integer): Integer; Stdcall;

ActiveX

Function PDFlib::SetCryptFilterConfiguration(EncryptStrings As Long, EncryptStreams As Long, EncryptEmbeddedFiles As Long) As Long

Parameters

EncryptStrings1 selects the standard filter for /StrF; 0 selects Identity
EncryptStreams1 selects the standard filter for ordinary streams through /StmF; 0 selects Identity
EncryptEmbeddedFiles1 selects the standard filter for embedded-file streams through /EFF; 0 selects Identity

Return values

0A value is not zero or one, all three targets are disabled, no document is selected, or encryption has already begun
1The complete target configuration was accepted

Remarks

The default is 1, 1, 1, which encrypts strings, ordinary streams, and embedded files

Selective configurations require AES-128, AES-256, AES-256 Acrobat X, or AES-256-GCM and are applied consistently to password, public-key, and fingerprint encryption

The established SetEncryptEmbeddedFilesOnly method maps 1 to 0, 0, 1 and maps 0 back to 1, 1, 1

Example

PDF.SetCryptFilterConfiguration(0, 1, 0);
PDF.Encrypt('owner-password', 'user-password', 2, Permissions);
PDF.SaveToFile('selective-encryption.pdf');

See also

GetEncryptStrings, GetEncryptStreams, GetEncryptEmbeddedFiles, Encrypt, EncryptPublicKey