Class PdfEncryption

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

@Deprecated public class PdfEncryption extends Object
Deprecated.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Deprecated.
     
    static final int
    Deprecated.
     
    Deprecated.
     
    private int
    Deprecated.
     
    (package private) byte[]
    Deprecated.
     
    private boolean
    Deprecated.
    Indicates if the encryption is only necessary for embedded files.
    private boolean
    Deprecated.
     
    (package private) byte[]
    Deprecated.
    Work area to prepare the object/generation bytes
    (package private) byte[]
    Deprecated.
    The encryption key for a particular object/generation
    private int
    Deprecated.
    The generic key length.
    (package private) int
    Deprecated.
    The encryption key length for a particular object/generation
    (package private) MessageDigest
    Deprecated.
    The message digest algorithm MD5
    private static final byte[]
    Deprecated.
     
    (package private) byte[]
    Deprecated.
    The global encryption key
    (package private) byte[]
    Deprecated.
    Additional keys for AES_256_V3
    (package private) byte[]
    Deprecated.
    The encryption key for the owner
    private static final byte[]
    Deprecated.
     
    (package private) int
    Deprecated.
     
    (package private) byte[]
    Deprecated.
     
    Deprecated.
    The public key security handler for certificate encryption
    private int
    Deprecated.
     
    private static final byte[]
    Deprecated.
     
    (package private) static long
    Deprecated.
     
    static final int
    Deprecated.
     
    static final int
    Deprecated.
     
    (package private) byte[]
    Deprecated.
     
    (package private) byte[]
    Deprecated.
    The encryption key for the user
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addRecipient(Certificate cert, int permission)
    Deprecated.
     
    int
    Deprecated.
     
    (package private) void
    computeOAndOeAlg9(byte[] ownerPassword)
    Deprecated.
    implements Algorithm 9: Computing the encryption dictionary’s O (owner password) and OE (owner encryption) values (Security handlers of revision 6) - ISO 32000-2 section 7.6.4.4.8
    private byte[]
    computeOwnerKey(byte[] userPad, byte[] ownerPad)
    Deprecated.
     
    (package private) void
    computePermsAlg10(int permissions)
    Deprecated.
    implements Algorithm 10: Computing the encryption dictionary’s Perms (permissions) value (Security handlers of revision 6) - ISO 32000-2 section 7.6.4.4.9
    (package private) void
    computeUAndUeAlg8(byte[] userPassword)
    Deprecated.
    implements Algorithm 8: Computing the encryption dictionary’s U (user password) and UE (user encryption) values (Security handlers of revision 6) - ISO 32000-2 section 7.6.4.4.7
    byte[]
    computeUserPassword(byte[] ownerPassword)
    Deprecated.
     
    static byte[]
    Deprecated.
     
    static PdfObject
    createInfoId(byte[] id)
    Deprecated.
     
    static PdfObject
    createInfoId(byte[] idPartOne, byte[] idPartTwo)
    Deprecated.
     
    private static byte[]
    decodeHex(byte[] hexEncoded)
    Deprecated.
     
    boolean
    decryptAndCheckPerms(byte[] permsValue)
    Deprecated.
    implements step f of Algorithm 2.A: Retrieving the file encryption key from an encrypted document in order to decrypt it (revision 6 and later) - ISO 32000-2 section 7.6.4.3.3
    byte[]
    decryptByteArray(byte[] b)
    Deprecated.
     
    byte[]
    encryptByteArray(byte[] b)
    Deprecated.
     
    int
    Deprecated.
     
    Deprecated.
     
    Deprecated.
     
    Deprecated.
     
    Deprecated.
     
    static byte[]
    Deprecated.
    This method returns a changing part of the fileId when can be identified.
    (package private) byte[]
    hashAlg2B(byte[] input, byte[] salt, byte[] userKey)
    Deprecated.
    implements Algorithm 2.B: Computing a hash (revision 6 and later) - ISO 32000-2 section 7.6.4.3.4
    boolean
    Deprecated.
    Indicates if only the embedded files have to be encrypted.
    private static boolean
    isHexEncoded(byte[] str)
    Deprecated.
     
    boolean
    Deprecated.
     
    private byte[]
    padPassword(byte[] userPassword)
    Deprecated.
     
    void
    setCryptoMode(int mode, int kl)
    Deprecated.
     
    void
    setHashKey(int number, int generation)
    Deprecated.
     
    void
    setupAllKeys(byte[] userPassword, byte[] ownerPassword, int permissions)
    Deprecated.
     
    void
    setupByEncryptionKey(byte[] key, int keylength)
    Deprecated.
     
    private void
    setupByOwnerPad(byte[] documentID, byte[] ownerPad, byte[] userKey, byte[] ownerKey, int permissions)
    Deprecated.
     
    void
    setupByOwnerPassword(byte[] documentID, byte[] ownerPassword, byte[] uValue, byte[] ueValue, byte[] oValue, byte[] oeValue, int permissions)
    Deprecated.
    implements step d of Algorithm 2.A: Retrieving the file encryption key from an encrypted document in order to decrypt it (revision 6 and later) - ISO 32000-2 section 7.6.4.3.3
    void
    setupByOwnerPassword(byte[] documentID, byte[] ownerPassword, byte[] userKey, byte[] ownerKey, int permissions)
    Deprecated.
     
    private void
    setupByUserPad(byte[] documentID, byte[] userPad, byte[] ownerKey, int permissions)
    Deprecated.
     
    void
    setupByUserPassword(byte[] documentID, byte[] userPassword, byte[] uValue, byte[] ueValue, byte[] oValue, byte[] oeValue, int permissions)
    Deprecated.
    implements step e of Algorithm 2.A: Retrieving the file encryption key from an encrypted document in order to decrypt it (revision 6 and later) - ISO 32000-2 section 7.6.4.3.3
    void
    setupByUserPassword(byte[] documentID, byte[] userPassword, byte[] ownerKey, int permissions)
    Deprecated.
     
    private void
    setupGlobalEncryptionKey(byte[] documentID, byte[] userPad, byte[] ownerKey, int permissions)
    Deprecated.
    ownerKey, documentID must be setup
    private void
    Deprecated.
    mkey must be setup

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • STANDARD_ENCRYPTION_40

      public static final int STANDARD_ENCRYPTION_40
      Deprecated.
      See Also:
    • STANDARD_ENCRYPTION_128

      public static final int STANDARD_ENCRYPTION_128
      Deprecated.
      See Also:
    • AES_128

      public static final int AES_128
      Deprecated.
      See Also:
    • AES_256_V3

      public static final int AES_256_V3
      Deprecated.
      See Also:
    • pad

      private static final byte[] pad
      Deprecated.
    • salt

      private static final byte[] salt
      Deprecated.
    • metadataPad

      private static final byte[] metadataPad
      Deprecated.
    • seq

      static long seq
      Deprecated.
    • publicKeyHandler

      protected PdfPublicKeySecurityHandler publicKeyHandler
      Deprecated.
      The public key security handler for certificate encryption
    • key

      byte[] key
      Deprecated.
      The encryption key for a particular object/generation
    • keySize

      int keySize
      Deprecated.
      The encryption key length for a particular object/generation
    • mkey

      byte[] mkey
      Deprecated.
      The global encryption key
    • extra

      byte[] extra
      Deprecated.
      Work area to prepare the object/generation bytes
    • md5

      Deprecated.
      The message digest algorithm MD5
    • ownerKey

      byte[] ownerKey
      Deprecated.
      The encryption key for the owner
    • userKey

      byte[] userKey
      Deprecated.
      The encryption key for the user
    • oeKey

      byte[] oeKey
      Deprecated.
      Additional keys for AES_256_V3
    • ueKey

      byte[] ueKey
      Deprecated.
    • perms

      byte[] perms
      Deprecated.
    • permissions

      int permissions
      Deprecated.
    • documentID

      byte[] documentID
      Deprecated.
    • revision

      private int revision
      Deprecated.
    • arcfour

      private ARCFOUREncryption arcfour
      Deprecated.
    • keyLength

      private int keyLength
      Deprecated.
      The generic key length. It may be 40 or 128.
    • encryptMetadata

      private boolean encryptMetadata
      Deprecated.
    • embeddedFilesOnly

      private boolean embeddedFilesOnly
      Deprecated.
      Indicates if the encryption is only necessary for embedded files.
      Since:
      2.1.3
    • cryptoMode

      private int cryptoMode
      Deprecated.
  • Constructor Details

    • PdfEncryption

      public PdfEncryption()
      Deprecated.
    • PdfEncryption

      public PdfEncryption(PdfEncryption enc)
      Deprecated.
  • Method Details

    • createDocumentId

      public static byte[] createDocumentId()
      Deprecated.
    • createInfoId

      public static PdfObject createInfoId(byte[] id)
      Deprecated.
    • createInfoId

      public static PdfObject createInfoId(byte[] idPartOne, byte[] idPartTwo)
      Deprecated.
    • getFileIdChangingPart

      public static byte[] getFileIdChangingPart(PdfObject fileId)
      Deprecated.
      This method returns a changing part of the fileId when can be identified. Returns a complete fileId of the changing part is not found.
      Parameters:
      fileId - PdfObject
      Returns:
      byte array representing the changing part of the document identifier
    • isHexEncoded

      private static boolean isHexEncoded(byte[] str)
      Deprecated.
    • decodeHex

      private static byte[] decodeHex(byte[] hexEncoded)
      Deprecated.
    • setCryptoMode

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

      public int getCryptoMode()
      Deprecated.
    • isMetadataEncrypted

      public boolean isMetadataEncrypted()
      Deprecated.
    • isEmbeddedFilesOnly

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

      private byte[] padPassword(byte[] userPassword)
      Deprecated.
    • computeOwnerKey

      private byte[] computeOwnerKey(byte[] userPad, byte[] ownerPad)
      Deprecated.
    • setupGlobalEncryptionKey

      private void setupGlobalEncryptionKey(byte[] documentID, byte[] userPad, byte[] ownerKey, int permissions)
      Deprecated.
      ownerKey, documentID must be setup
    • setupUserKey

      private void setupUserKey()
      Deprecated.
      mkey must be setup
    • setupAllKeys

      public void setupAllKeys(byte[] userPassword, byte[] ownerPassword, int permissions)
      Deprecated.
    • setupByUserPassword

      public void setupByUserPassword(byte[] documentID, byte[] userPassword, byte[] ownerKey, int permissions)
      Deprecated.
      Parameters:
      documentID - byte array of document id
      userPassword - byte array of user password
      ownerKey - byte array of owner key
      permissions - permissions
    • setupByUserPad

      private void setupByUserPad(byte[] documentID, byte[] userPad, byte[] ownerKey, int permissions)
      Deprecated.
    • setupByOwnerPassword

      public void setupByOwnerPassword(byte[] documentID, byte[] ownerPassword, byte[] userKey, byte[] ownerKey, int permissions)
      Deprecated.
      Parameters:
      documentID - byte array of document id
      ownerPassword - byte array of owner password
      userKey - byte array of user key
      ownerKey - byte array of owner key
      permissions - permissions
    • setupByOwnerPad

      private void setupByOwnerPad(byte[] documentID, byte[] ownerPad, byte[] userKey, byte[] ownerKey, int permissions)
      Deprecated.
    • setupByEncryptionKey

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

      public void setHashKey(int number, int generation)
      Deprecated.
    • getEncryptionDictionary

      public PdfDictionary getEncryptionDictionary()
      Deprecated.
    • getFileID

      public PdfObject getFileID()
      Deprecated.
    • getEncryptionStream

      public OutputStreamEncryption getEncryptionStream(OutputStream os)
      Deprecated.
    • calculateStreamSize

      public int calculateStreamSize(int n)
      Deprecated.
    • encryptByteArray

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

      public StandardDecryption getDecryptor()
      Deprecated.
    • decryptByteArray

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

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

      public byte[] computeUserPassword(byte[] ownerPassword)
      Deprecated.
    • setupByOwnerPassword

      public void setupByOwnerPassword(byte[] documentID, byte[] ownerPassword, byte[] uValue, byte[] ueValue, byte[] oValue, byte[] oeValue, int permissions) throws GeneralSecurityException
      Deprecated.
      implements step d of Algorithm 2.A: Retrieving the file encryption key from an encrypted document in order to decrypt it (revision 6 and later) - ISO 32000-2 section 7.6.4.3.3
      Throws:
      GeneralSecurityException
    • setupByUserPassword

      public void setupByUserPassword(byte[] documentID, byte[] userPassword, byte[] uValue, byte[] ueValue, byte[] oValue, byte[] oeValue, int permissions) throws GeneralSecurityException
      Deprecated.
      implements step e of Algorithm 2.A: Retrieving the file encryption key from an encrypted document in order to decrypt it (revision 6 and later) - ISO 32000-2 section 7.6.4.3.3
      Throws:
      GeneralSecurityException
    • decryptAndCheckPerms

      public boolean decryptAndCheckPerms(byte[] permsValue) throws GeneralSecurityException
      Deprecated.
      implements step f of Algorithm 2.A: Retrieving the file encryption key from an encrypted document in order to decrypt it (revision 6 and later) - ISO 32000-2 section 7.6.4.3.3
      Throws:
      GeneralSecurityException
    • hashAlg2B

      byte[] hashAlg2B(byte[] input, byte[] salt, byte[] userKey) throws GeneralSecurityException
      Deprecated.
      implements Algorithm 2.B: Computing a hash (revision 6 and later) - ISO 32000-2 section 7.6.4.3.4
      Throws:
      GeneralSecurityException
    • computeUAndUeAlg8

      void computeUAndUeAlg8(byte[] userPassword) throws GeneralSecurityException
      Deprecated.
      implements Algorithm 8: Computing the encryption dictionary’s U (user password) and UE (user encryption) values (Security handlers of revision 6) - ISO 32000-2 section 7.6.4.4.7
      Throws:
      GeneralSecurityException
    • computeOAndOeAlg9

      void computeOAndOeAlg9(byte[] ownerPassword) throws GeneralSecurityException
      Deprecated.
      implements Algorithm 9: Computing the encryption dictionary’s O (owner password) and OE (owner encryption) values (Security handlers of revision 6) - ISO 32000-2 section 7.6.4.4.8
      Throws:
      GeneralSecurityException
    • computePermsAlg10

      void computePermsAlg10(int permissions) throws GeneralSecurityException
      Deprecated.
      implements Algorithm 10: Computing the encryption dictionary’s Perms (permissions) value (Security handlers of revision 6) - ISO 32000-2 section 7.6.4.4.9
      Throws:
      GeneralSecurityException