SynPDF now implements 40 bit and 128 bit security
The trunk version of our Open Source SynPdf library now features encryption using 40 bit or 128 bit key size.
This is a long awaiting feature, and sounds working just fine from my
Speed has been optimized (as usual with our libraries), as a consequence encrypting the content will only be slightly slower.
TPdfEncryption.New() will create the expected
TPdfEncryption instance, depending on the supplied encryption
class function TPdfEncryption.New(aLevel: TPdfEncryptionLevel; const aUserPassword, aOwnerPassword: string; aPermissions: TPdfEncryptionPermissions): TPdfEncryption;
Here are some comments about this new method:
- to be called as parameter of
- currently, only elRC4_40 and elRC4_128 levels are implemented
- both passwords are expected to be ASCII-7 characters only
- aUserPassword will be asked at file opening: to be set to '' for not blocking display, but optional permission
- aOwnerPassword shall not be '', and will be used internally to cypher the pdf file content
- aPermissions can be either one of the
PDF_PERMISSION_ALL / PDF_PERMISSION_NOMODIF / PDF_PERSMISSION_NOPRINT / PDF_PERMISSION_NOCOPY / PDF_PERMISSION_NOCOPYNORPRINTset of options
In practice, typical use may be:
Doc := TPdfDocument.Create(false,0,false, TPdfEncryption.New(elRC4_40,'','toto',PDF_PERMISSION_NOMODIF)); Doc := TPdfDocument.Create(false,0,false, TPdfEncryption.New(elRC4_128,'','toto',PDF_PERMISSION_NOCOPYNORPRINT));
Follow this link to get the latest trunk (unstable) version.
Feedback is welcome on our forum, as usual!