Adding PDF Encryption using PDFSignDll SDK

Password Security

Owner password is set for changing the rights of the PDF file. The owner password is not requested when opening the PDF file but it is requesting when you want to change something in the password protected PDF file that was restricted from modifying.

 

To set the owner password you can use:

'owner password is used to set the permissions
PDFEncrypt.OwnerPassword = "owner P@ssw0rD"

 

User password is for opening (and reading) the PDF file. If you define an user password before generating the PDF file, when someone will want to open the resulting PDF file it will have to enter the user password to open it. So only the ones that know this password can read/open the password protected PDF file.

 

To set the user password you can use:

'optionally, user password is used to open the document with a password
PDFEncrypt.UserPassword= "user P@ssw0rD"

 

Certificate Security

Encrypts a PDF document by using a certificate. The certificate can be loaded from Microsoft Store, PFX, CER, PKCS#7, or X509Certificate2 object.

'set the encryption certificate
PDFEncrypt.SetEncryptionCertificate()

 

Encryption Algorithms

The library can use Standard Encryption RC4 (40 bit)Standard Encryption RC4 (128 bit), and Enhanced Encryption AES (128 bit)

 

Document Restrictions 

Setting document restrictions allows you to customize if a user can copy content, filling form fields, edit content, or print the PDF file.

The library can allow content copying, content copying for accessibility, filling of form fields, printing, or none of them. 

 

Encrypt a PDF Using Passwords 

'owner password is used to set the permissions
PDFEncrypt.OwnerPassword = "owner P@ssw0rD"
'optionally, user password is used to open the document with a password
PDFEncrypt.UserPassword= "user P@ssw0rD"

PDFEncrypt.EncryptPDFFile("c:\\source.pdf", "c:\\encrypt.pdf",
PDFEncryptionType.EnhancedEncryption128BitAES,
PDFEncryptionMethod.Passwords,
PDFDocumentRestrictions.AllowContentCopying Or
PDFDocumentRestrictions.AllowPrinting)

 

Encrypt a PDF Using Digital Certificates 

'set the encryption certificate
PDFEncrypt.SetEncryptionCertificate()

PDFEncrypt.EncryptPDFFile("c:\\source.pdf", "c:\\encrypt.pdf",
PDFEncryptionType.EnhancedEncryption128BitAES,
PDFEncryptionMethod.DigitalCertificates,
PDFDocumentRestrictions.AllowContentCopying Or
PDFDocumentRestrictions.AllowPrinting)

 

Encryption methods are a free part of PDFSignDll SDK.

If you want to sign a PDF document, please remember that the encryption must be done before the signing operation.

Save a tree! Use digital signatures.