Class IdentityDecrypter

java.lang.Object
org.loboevolution.pdfview.decrypt.IdentityDecrypter
All Implemented Interfaces:
PDFDecrypter

public class IdentityDecrypter extends Object implements PDFDecrypter
Performs identity decryption; that is, inputs aren't encrypted and are returned right back.

Author Luke Kirby

  • Constructor Details

    • IdentityDecrypter

      public IdentityDecrypter()
  • Method Details

    • getInstance

      public static IdentityDecrypter getInstance()

      getInstance.

      Returns:
      a IdentityDecrypter object.
    • decryptBuffer

      public ByteBuffer decryptBuffer(String cryptFilterName, PDFObject streamObj, ByteBuffer streamBuf) throws PDFParseException
      Decrypt a buffer of data
      Specified by:
      decryptBuffer in interface PDFDecrypter
      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 any.
    • decryptString

      public String decryptString(int objNum, int objGen, String inputBasicString)
      Decrypt a basic string.
      Specified by:
      decryptString in interface PDFDecrypter
      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
    • isEncryptionPresent

      public boolean isEncryptionPresent()
      Determine whether this actually applies a decryption other than identity decryption.
      Specified by:
      isEncryptionPresent in interface PDFDecrypter
      Returns:
      whether encryption is present
    • isEncryptionPresent

      public boolean isEncryptionPresent(String cryptFilterName)
      Determines whether decryption applies for a given crypt filter name
      Specified by:
      isEncryptionPresent in interface PDFDecrypter
      Parameters:
      cryptFilterName - the crypt filter name
      Returns:
      whether the given crypt filter decrypts or not
    • isOwnerAuthorised

      public 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 PDFDecrypter.isEncryptionPresent() to determine whether any permissions apply.
      Specified by:
      isOwnerAuthorised in interface PDFDecrypter
      Returns:
      whether owner authentication is being used to decrypt the document