Class StandardSecurityHandler


  • public final class StandardSecurityHandler
    extends java.lang.Object
    Implements the PDF Standard security handler (ISO 32000-1 §7.6.3 / ISO 32000-2 §7.6.4): given a document's /Encrypt dictionary, its first /ID element, and a candidate password, derives the file encryption key and can then decrypt any string or stream belonging to an indirect object in that document.

    Supports /V 1, 2, 4 (RC4 and AESV2/AES-128 crypt filters) and 5 (AESV3/AES-256, both the R5 "Adobe extension level 3" and the R6/ISO 32000-2 hardened-hash schemes). The password is tried first as the user password, then as the owner password, matching how most PDF viewers behave for a document opened without prompting (typically an empty user password).

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] decryptStream​(byte[] data, long objectNumber, int generation)  
      byte[] decryptString​(byte[] data, long objectNumber, int generation)  
      boolean isEmptyKey()  
      boolean isEncryptMetadata()
      Whether the document's /Metadata stream is included in encryption (/EncryptMetadata, default true).
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isEmptyKey

        public boolean isEmptyKey()
      • isEncryptMetadata

        public boolean isEncryptMetadata()
        Whether the document's /Metadata stream is included in encryption (/EncryptMetadata, default true).