com.sun.pdfview.decrypt

## Interface PDFDecrypter

All Known Implementing Classes:
  CryptFilterDecrypter, IdentityDecrypter, StandardDecrypter

    public interface PDFDecrypter

A decrypter decrypts streams and strings in a PDF document. `decryptBuffer(String, PDFObject, ByteBuffer)` } should be used for decoding streams, and `decryptString(int, int, String)` for string values in the PDF. It is possible for strings and streams to be encrypted with different mechanisms, so the appropriate method must alwayus be used.

See Also:
  "PDFReference 1.7, Section 3.5 Encryption"

### Method Summary

Methods
`java.nio.ByteBuffer` `decryptBuffer(java.lang.String cryptFilterName, PDFObject streamObj, java.nio.ByteBuffer streamBuf)` Decrypt a buffer of data
`java.lang.String` `decryptString(int objNum, int objGen, java.lang.String inputBasicString)` Decrypt a `basic string`.
`boolean` `isEncryptionPresent()` Determine whether this actually applies a decryption other than identity decryption.
`boolean` `isEncryptionPresent(java.lang.String cryptFilterName)` Determines whether decryption applies for a given crypt filter name
`boolean` `isOwnerAuthorised()` Determine whether the password known by the decrypter indicates that the user is the owner of the document.

### Method Detail

#### decryptBuffer

    java.nio.ByteBuffer decryptBuffer(java.lang.String cryptFilterName,
                                    PDFObject streamObj,
                                    java.nio.ByteBuffer streamBuf)
                                      throws PDFParseException

Decrypt a buffer of data

Parameters:
  `cryptFilterName` - the name of the crypt filter, if V4 encryption is being used, where individual crypt filters may be specified for individual streams. If encryption is not using V4 encryption (indicated by V=4 in the Encrypt dictionary) then this must be null. Null may also be specified with V4 encryption to indicate that the default filter should be used.
  `streamObj` - the object whose stream is being decrypted. The containing object's number and generation contribute to the key used for stream encrypted with the document's default encryption, so this is typically required. Should be null only if a cryptFilterName is specified, as objects with specific stream filters use the general document key, rather than a stream-specific key.
  `streamBuf` - the buffer to decrypt
Returns:
  a buffer containing the decrypted stream, positioned at its beginning; will only be the same buffer as streamBuf if the identity decrypter is being used
Throws:
  `PDFParseException` - if the named crypt filter does not exist, or if a crypt filter is named when named crypt filters are not supported. Problems due to incorrect passwords are revealed prior to this point.

#### decryptString

    java.lang.String decryptString(int objNum,
                                 int objGen,
                                 java.lang.String inputBasicString)
                                   throws PDFParseException

Decrypt a `basic string`.

Parameters:
  `objNum` - the object number of the containing object
  `objGen` - the generation number of the containing object
  `inputBasicString` - the string to be decrypted
Returns:
  the decrypted string
Throws:
  `PDFParseException` - if the named crypt filter does not exist, or if a crypt filter is named when named crypt filters are not supported. Problems due to incorrect passwords are revealed prior to this point.

#### isOwnerAuthorised

    boolean isOwnerAuthorised()

Determine whether the password known by the decrypter indicates that the user is the owner of the document. Can be used, in conjunction with `isEncryptionPresent()` to determine whether any permissions apply.

Returns:
  whether owner authentication is being used to decrypt the document

#### isEncryptionPresent

    boolean isEncryptionPresent()

Determine whether this actually applies a decryption other than identity decryption.

Returns:
  whether encryption is present

#### isEncryptionPresent

    boolean isEncryptionPresent(java.lang.String cryptFilterName)

Determines whether decryption applies for a given crypt filter name

Parameters:
  `cryptFilterName` - the crypt filter name
Returns:
  whether the given crypt filter decrypts or not