private void setPublicKeyEncryption(List<int> permissionsList)
{
if (DocumentSecurity.EncryptionPreferences.EncryptionType != EncryptionType.PublicKeyEncryption) return;
if (permissionsList.Count == 0) permissionsList.Add(PdfWriter.AllowScreenReaders);
var certs = PfxReader.ReadCertificate(DocumentSecurity.EncryptionPreferences.PublicKeyEncryption.PfxPath, DocumentSecurity.EncryptionPreferences.PublicKeyEncryption.PfxPassword);
PdfWriter.SetEncryption(
certs: certs.X509PrivateKeys,
permissions: permissionsList.ToArray(),
encryptionType: PdfWriter.ENCRYPTION_AES_128);
}