iText 7 7.1.8 API
iText.Kernel.Pdf.EncryptionProperties Class Reference

Public Member Functions

virtual EncryptionProperties  SetStandardEncryption (byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionAlgorithm)
  Sets the encryption options for the document. More...
 
virtual EncryptionProperties  SetPublicKeyEncryption (X509Certificate[] certs, int[] permissions, int encryptionAlgorithm)
  Sets the certificate encryption options for the document. More...
 

Member Function Documentation

◆ SetPublicKeyEncryption()

virtual EncryptionProperties iText.Kernel.Pdf.EncryptionProperties.SetPublicKeyEncryption ( X509Certificate[]  certs,
int[]  permissions,
int  encryptionAlgorithm 
)
inlinevirtual

Sets the certificate encryption options for the document.

Sets the certificate encryption options for the document. An array of one or more public certificates must be provided together with an array of the same size for the permissions for each certificate. The open permissions for the document can be AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. The permissions can be combined by ORing them. Optionally DO_NOT_ENCRYPT_METADATA can be ORed to output the metadata in cleartext See EncryptionConstants

Parameters
certs the public certificates to be used for the encryption
permissions the user permissions for each of the certificates
encryptionAlgorithm the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128, ENCRYPTION_AES128 or ENCRYPTION_AES256.

◆ SetStandardEncryption()

virtual EncryptionProperties iText.Kernel.Pdf.EncryptionProperties.SetStandardEncryption ( byte[]  userPassword,
byte[]  ownerPassword,
int  permissions,
int  encryptionAlgorithm 
)
inlinevirtual

Sets the encryption options for the document.

Sets the encryption options for the document. The userPassword and the ownerPassword can be null or have zero length. In this case the ownerPassword is replaced by a random string. The open permissions for the document can be ALLOW_PRINTING, ALLOW_MODIFY_CONTENTS, ALLOW_COPY, ALLOW_MODIFY_ANNOTATIONS, ALLOW_FILL_IN, ALLOW_SCREENREADERS, ALLOW_ASSEMBLY and ALLOW_DEGRADED_PRINTING. The permissions can be combined by ORing them. See EncryptionConstants

Parameters
userPassword the user password. Can be null or empty
ownerPassword the owner password. Can be null or empty
permissions the user permissions
encryptionAlgorithm the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128, ENCRYPTION_AES128 or ENCRYPTION_AES256 Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext