Class SecurityHandler

java.lang.Object
com.itextpdf.kernel.crypto.securityhandler.SecurityHandler
Direct Known Subclasses:
PubKeySecurityHandler, StandardSecurityHandler

public abstract class SecurityHandler extends Object
  • Field Details

    • mkey

      protected byte[] mkey
      The global encryption key
    • nextObjectKey

      protected byte[] nextObjectKey
      The encryption key for a particular object/generation. It is recalculated with setHashKeyForNextObject(int, int) for every object individually based in its object/generation.
    • nextObjectKeySize

      protected int nextObjectKeySize
      The encryption key length for a particular object/generation It is recalculated with setHashKeyForNextObject(int, int) for every object individually based in its object/generation.
    • md5

      protected MessageDigest md5
    • extra

      protected byte[] extra
      Work area to prepare the object/generation bytes
  • Constructor Details

    • SecurityHandler

      protected SecurityHandler()
  • Method Details

    • setHashKeyForNextObject

      public void setHashKeyForNextObject (int objNumber, int objGeneration)
      Note: For most of the supported security handlers algorithm to calculate encryption key for particular object is the same.
      Parameters:
      objNumber - number of particular object for encryption
      objGeneration - generation of particular object for encryption
    • getEncryptionStream

      public abstract OutputStreamEncryption getEncryptionStream (OutputStream os)
      Gets a stream wrapper, responsible for encryption.
      Parameters:
      os - OutputStream to be wrapped
      Returns:
      OutputStreamEncryption, responsible for encryption.
    • getDecryptor

      public abstract IDecryptor getDecryptor()
      Gets decryptor object.
      Returns:
      IDecryptor
    • getNextObjectKey

      public byte[] getNextObjectKey()
      Gets encryption key for a particular object/generation.
      Returns:
      encryption key for a particular object/generation.
    • getMkey

      public byte[] getMkey()
      Gets global encryption key.
      Returns:
      global encryption key.