Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.pdfbox.encryption
Class PDFEncryption

    java.lang.Object
      org.pdfbox.encryption.PDFEncryption

Deprecated. use the new security layer instead

public final class PDFEncryption
extends Object

This class will deal with PDF encryption algorithms.

Version:
  $Revision: 1.15 $
Author:
  Ben Litchfield
See Also:
  `StandardSecurityHandler`

Field Summary
`static byte[]` | `ENCRYPT_PADDING` Deprecated. The encryption padding defined in the PDF 1.4 Spec algorithm 3.2.

Constructor Summary
`PDFEncryption()` Deprecated.

Method Summary
`byte[]` | `computeEncryptedKey(byte[] password, byte[] o, int permissions, byte[] id, int revision, int length)` Deprecated. This will compute the encrypted key.
`byte[]` | `computeOwnerPassword(byte[] ownerPassword, byte[] userPassword, int revision, int length)` Deprecated. This algorithm is taked from PDF Reference 1.4 Algorithm 3.3 Page 79.
`byte[]` | `computeUserPassword(byte[] password, byte[] o, int permissions, byte[] id, int revision, int length)` Deprecated. This will compute the user password hash.
`void` | `encryptData(long objectNumber, long genNumber, byte[] key, InputStream data, OutputStream output)` Deprecated. This will encrypt a piece of data.
`byte[]` | `getUserPassword(byte[] ownerPassword, byte[] o, int revision, long length)` Deprecated. This will get the user password from the owner password and the documents o value.
`boolean` | `isOwnerPassword(byte[] ownerPassword, byte[] u, byte[] o, int permissions, byte[] id, int revision, int length)` Deprecated. This will tell if this is the owner password or not.
`boolean` | `isUserPassword(byte[] password, byte[] u, byte[] o, int permissions, byte[] id, int revision, int length)` Deprecated. This will tell if this is a valid user password.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ENCRYPT_PADDING

    public static final byte[] ENCRYPT_PADDING

  Deprecated.
  The encryption padding defined in the PDF 1.4 Spec algorithm 3.2.

Constructor Detail

### PDFEncryption

    public PDFEncryption()

  Deprecated.

Method Detail

### encryptData

    public final void encryptData(long objectNumber,
                                  long genNumber,
                                  byte[] key,
                                  InputStream data,
                                  OutputStream output)
                           throws CryptographyException,
                                  IOException

  Deprecated.
  This will encrypt a piece of data.

  Parameters:
    `objectNumber` - The id for the object.
    `genNumber` - The generation id for the object.
    `key` - The key used to encrypt the data.
    `data` - The data to encrypt/decrypt.
    `output` - The stream to write to.
  Throws:
    `CryptographyException` - If there is an error encrypting the data.
    `IOException` - If there is an io error.

### getUserPassword

    public final byte[] getUserPassword(byte[] ownerPassword,
                                        byte[] o,
                                        int revision,
                                        long length)
                                 throws CryptographyException,
                                        IOException

  Deprecated.
  This will get the user password from the owner password and the documents o value.

  Parameters:
    `ownerPassword` - The plaintext owner password.
    `o` - The document's o entry.
    `revision` - The document revision number.
    `length` - The length of the encryption.
  Returns:
    The plaintext padded user password.
  Throws:
    `CryptographyException` - If there is an error getting the user password.
    `IOException` - If there is an error reading data.

### isOwnerPassword

    public final boolean isOwnerPassword(byte[] ownerPassword,
                                         byte[] u,
                                         byte[] o,
                                         int permissions,
                                         byte[] id,
                                         int revision,
                                         int length)
                                  throws CryptographyException,
                                         IOException

  Deprecated.
  This will tell if this is the owner password or not.

  Parameters:
    `ownerPassword` - The plaintext owner password.
    `u` - The U value from the PDF Document.
    `o` - The owner password hash.
    `permissions` - The document permissions.
    `id` - The document id.
    `revision` - The revision of the encryption.
    `length` - The length of the encryption key.
  Returns:
    true if the owner password matches the one from the document.
  Throws:
    `CryptographyException` - If there is an error while executing crypt functions.
    `IOException` - If there is an error while checking owner password.

### isUserPassword

    public final boolean isUserPassword(byte[] password,
                                        byte[] u,
                                        byte[] o,
                                        int permissions,
                                        byte[] id,
                                        int revision,
                                        int length)
                                 throws CryptographyException,
                                        IOException

  Deprecated.
  This will tell if this is a valid user password. Algorithm 3.6 pg 80

  Parameters:
    `password` - The password to test.
    `u` - The U value from the PDF Document.
    `o` - The owner password hash.
    `permissions` - The document permissions.
    `id` - The document id.
    `revision` - The revision of the encryption.
    `length` - The length of the encryption key.
  Returns:
    true If this is the correct user password.
  Throws:
    `CryptographyException` - If there is an error computing the value.
    `IOException` - If there is an IO error while computing the owners password.

### computeUserPassword

    public final byte[] computeUserPassword(byte[] password,
                                            byte[] o,
                                            int permissions,
                                            byte[] id,
                                            int revision,
                                            int length)
                                     throws CryptographyException,
                                            IOException

  Deprecated.
  This will compute the user password hash.

  Parameters:
    `password` - The plain text password.
    `o` - The owner password hash.
    `permissions` - The document permissions.
    `id` - The document id.
    `revision` - The revision of the encryption.
    `length` - The length of the encryption key.
  Returns:
    The user password.
  Throws:
    `CryptographyException` - If there is an error computing the user password.
    `IOException` - If there is an IO error.

### computeEncryptedKey

    public final byte[] computeEncryptedKey(byte[] password,
                                            byte[] o,
                                            int permissions,
                                            byte[] id,
                                            int revision,
                                            int length)
                                     throws CryptographyException

  Deprecated.
  This will compute the encrypted key.

  Parameters:
    `password` - The password used to compute the encrypted key.
    `o` - The owner password hash.
    `permissions` - The permissions for the document.
    `id` - The document id.
    `revision` - The security revision.
    `length` - The length of the encryption key.
  Returns:
    The encryption key.
  Throws:
    `CryptographyException` - If there is an error computing the key.

### computeOwnerPassword

    public final byte[] computeOwnerPassword(byte[] ownerPassword,
                                             byte[] userPassword,
                                             int revision,
                                             int length)
                                      throws CryptographyException,
                                             IOException

  Deprecated.
  This algorithm is taked from PDF Reference 1.4 Algorithm 3.3 Page 79.

  Parameters:
    `ownerPassword` - The plain owner password.
    `userPassword` - The plain user password.
    `revision` - The version of the security.
    `length` - The length of the document.
  Returns:
    The computed owner password.
  Throws:
    `CryptographyException` - If there is an error computing O.
    `IOException` - If there is an error computing O.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD