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

## com.lowagie.text.pdf
Class PdfEncryption

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

    public class PdfEncryption

extends Object

Author:
  Paulo Soares (psoares@consiste.pt), Kazuya Ujihara

Field Summary
`static int` | `AES_128`
`private ARCFOUREncryption` | `arcfour`
`private int` | `cryptoMode`
`(package private) byte[]` | `documentID`
`private boolean` | `encryptMetadata`
`(package private) byte[]` | `extra` Work area to prepare the object/generation bytes
`(package private) byte[]` | `key` The encryption key for a particular object/generation
`private int` | `keyLength` The generic key length.
`(package private) int` | `keySize` The encryption key length for a particular object/generation
`(package private) MessageDigest` | `md5` The message digest algorithm MD5
`private static byte[]` | `metadataPad`
`(package private) byte[]` | `mkey` The global encryption key
`(package private) byte[]` | `ownerKey` The encryption key for the owner
`private static byte[]` | `pad`
`(package private) int` | `permissions`
`protected PdfPublicKeySecurityHandler` | `publicKeyHandler` The public key security handler for certificate encryption
`private int` | `revision`
`private static byte[]` | `salt`
`(package private) static long` | `seq`
`static int` | `STANDARD_ENCRYPTION_128`
`static int` | `STANDARD_ENCRYPTION_40`
`(package private) byte[]` | `userKey` The encryption key for the user

Constructor Summary
`PdfEncryption()`
`PdfEncryption(PdfEncryption enc)`

Method Summary
`void` | `addRecipient(Certificate cert, int permission)`
`int` | `calculateStreamSize(int n)`
`private byte[]` | `computeOwnerKey(byte[] userPad, byte[] ownerPad)`
`byte[]` | `computeUserPassword(byte[] ownerPassword)`
`static byte[]` | `createDocumentId()`
`static PdfObject` | `createInfoId(byte[] id)`
`byte[]` | `decryptByteArray(byte[] b)`
`byte[]` | `encryptByteArray(byte[] b)`
`int` | `getCryptoMode()`
`StandardDecryption` | `getDecryptor()`
`PdfDictionary` | `getEncryptionDictionary()`
`OutputStreamEncryption` | `getEncryptionStream(OutputStream os)`
`PdfObject` | `getFileID()`
`boolean` | `isMetadataEncrypted()`
`private byte[]` | `padPassword(byte[] userPassword)`
`void` | `setCryptoMode(int mode, int kl)`
`void` | `setHashKey(int number, int generation)`
`void` | `setupAllKeys(byte[] userPassword, byte[] ownerPassword, int permissions)`
`void` | `setupByEncryptionKey(byte[] key, int keylength)`
`private void` | `setupByOwnerPad(byte[] documentID, byte[] ownerPad, byte[] userKey, byte[] ownerKey, int permissions)`
`void` | `setupByOwnerPassword(byte[] documentID, byte[] ownerPassword, byte[] userKey, byte[] ownerKey, int permissions)`
`private void` | `setupByUserPad(byte[] documentID, byte[] userPad, byte[] ownerKey, int permissions)`
`void` | `setupByUserPassword(byte[] documentID, byte[] userPassword, byte[] ownerKey, int permissions)`
`private void` | `setupGlobalEncryptionKey(byte[] documentID, byte[] userPad, byte[] ownerKey, int permissions)` ownerKey, documentID must be setuped
`private void` | `setupUserKey()` mkey must be setuped

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

Field Detail

### STANDARD_ENCRYPTION_40

    public static final int STANDARD_ENCRYPTION_40

See Also:
  Constant Field Values

### STANDARD_ENCRYPTION_128

    public static final int STANDARD_ENCRYPTION_128

See Also:
  Constant Field Values

### AES_128

    public static final int AES_128

See Also:
  Constant Field Values

### pad

    private static final byte[] pad

### salt

    private static final byte[] salt

### metadataPad

    private static final byte[] metadataPad

### key

    byte[] key

  The encryption key for a particular object/generation

### keySize

    int keySize

  The encryption key length for a particular object/generation

### mkey

    byte[] mkey

  The global encryption key

### extra

    byte[] extra

  Work area to prepare the object/generation bytes

### md5

    MessageDigest md5

  The message digest algorithm MD5

### ownerKey

    byte[] ownerKey

  The encryption key for the owner

### userKey

    byte[] userKey

  The encryption key for the user

### publicKeyHandler

    protected PdfPublicKeySecurityHandler publicKeyHandler

  The public key security handler for certificate encryption

### permissions

    int permissions

### documentID

    byte[] documentID

### seq

    static long seq

### revision

    private int revision

### arcfour

    private ARCFOUREncryption arcfour

### keyLength

    private int keyLength

  The generic key length. It may be 40 or 128.

### encryptMetadata

    private boolean encryptMetadata

### cryptoMode

    private int cryptoMode

Constructor Detail

### PdfEncryption

    public PdfEncryption()

### PdfEncryption

    public PdfEncryption(PdfEncryption enc)

Method Detail

### setCryptoMode

    public void setCryptoMode(int mode,
                              int kl)

### getCryptoMode

    public int getCryptoMode()

### isMetadataEncrypted

    public boolean isMetadataEncrypted()

### padPassword

    private byte[] padPassword(byte[] userPassword)

### computeOwnerKey

    private byte[] computeOwnerKey(byte[] userPad,
                                   byte[] ownerPad)

### setupGlobalEncryptionKey

    private void setupGlobalEncryptionKey(byte[] documentID,
                                          byte[] userPad,
                                          byte[] ownerKey,
                                          int permissions)

  ownerKey, documentID must be setuped

### setupUserKey

    private void setupUserKey()

  mkey must be setuped

### setupAllKeys

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

### createDocumentId

    public static byte[] createDocumentId()

### setupByUserPassword

    public void setupByUserPassword(byte[] documentID,
                                    byte[] userPassword,
                                    byte[] ownerKey,
                                    int permissions)

### setupByUserPad

    private void setupByUserPad(byte[] documentID,
                                byte[] userPad,
                                byte[] ownerKey,
                                int permissions)

### setupByOwnerPassword

    public void setupByOwnerPassword(byte[] documentID,
                                     byte[] ownerPassword,
                                     byte[] userKey,
                                     byte[] ownerKey,
                                     int permissions)

### setupByOwnerPad

    private void setupByOwnerPad(byte[] documentID,
                                 byte[] ownerPad,
                                 byte[] userKey,
                                 byte[] ownerKey,
                                 int permissions)

### setupByEncryptionKey

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

### setHashKey

    public void setHashKey(int number,
                           int generation)

### createInfoId

    public static PdfObject createInfoId(byte[] id)

### getEncryptionDictionary

    public PdfDictionary getEncryptionDictionary()

### getFileID

    public PdfObject getFileID()

### 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)

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