Class PdfEncryption

java.lang.Object
com.itextpdf.text.pdf.PdfEncryption

public class PdfEncryption extends Object
Author:
Paulo Soares, Kazuya Ujihara
  • Field Details

  • Constructor Details

    • PdfEncryption

      public PdfEncryption()
    • PdfEncryption

      public PdfEncryption(PdfEncryption enc)
  • Method Details

    • setCryptoMode

      public void setCryptoMode(int mode, int kl)
    • getCryptoMode

      public int getCryptoMode()
    • isMetadataEncrypted

      public boolean isMetadataEncrypted()
    • getPermissions

      public long getPermissions()
    • isEmbeddedFilesOnly

      public boolean isEmbeddedFilesOnly()
      Indicates if only the embedded files have to be encrypted.
      Returns:
      if true only the embedded files will be encrypted
      Since:
      2.1.3
    • setupAllKeys

      public void setupAllKeys(byte[] userPassword, byte[] ownerPassword, int permissions)
    • readKey

      public boolean readKey(PdfDictionary enc, byte[] password) throws BadPasswordException
      Throws:
      BadPasswordException
    • createDocumentId

      public static byte[] createDocumentId()
    • setupByUserPassword

      public void setupByUserPassword(byte[] documentID, byte[] userPassword, byte[] ownerKey, long permissions)
    • setupByOwnerPassword

      public void setupByOwnerPassword(byte[] documentID, byte[] ownerPassword, byte[] userKey, byte[] ownerKey, long permissions)
    • setKey

      public void setKey(byte[] key)
    • setupByEncryptionKey

      public void setupByEncryptionKey(byte[] key, int keylength)
    • setHashKey

      public void setHashKey(int number, int generation)
    • createInfoId

      public static PdfObject createInfoId(byte[] id, boolean modified) throws IOException
      Throws:
      IOException
    • getEncryptionDictionary

      public PdfDictionary getEncryptionDictionary()
    • getFileID

      public PdfObject getFileID(boolean modified) throws IOException
      Throws:
      IOException
    • getEncryptionStream

      public OutputStreamEncryption getEncryptionStream(OutputStream os)
    • calculateStreamSize

      public int calculateStreamSize(int n)
    • encryptByteArray

      public byte[] encryptByteArray(byte[] b)
    • getDecryptor

      public StandardDecryption getDecryptor()
    • decryptByteArray

      public byte[] decryptByteArray(byte[] b)
    • addRecipient

      public void addRecipient(Certificate cert, int permission)
    • computeUserPassword

      public byte[] computeUserPassword(byte[] ownerPassword)
      Computes user password if standard encryption handler is used with Standard40, Standard128 or AES128 algorithm (Revision 2 - 4).
      Parameters:
      ownerPassword - owner password of the encrypted document.
      Returns:
      user password, or null if revision 5 (AES256) or greater of standard encryption handler was used.