Class Biff8EncryptionKey

java.lang.Object
org.apache.poi.hssf.record.crypto.Biff8EncryptionKey

public final class Biff8EncryptionKey extends Object
  • Constructor Details

    • Biff8EncryptionKey

      public Biff8EncryptionKey()
  • Method Details

    • setCurrentUserPassword

      public static void setCurrentUserPassword(String password)
      Sets the BIFF8 encryption/decryption password for the current thread.

      It is strongly recommended that you call `setCurrentUserPassword(null)` as soon as you are finished with the calls that need the password. One option is to use a try block with a `finally` clause that calls `setCurrentUserPassword(null)`.

      The POI APIs for newer OOXML based file formats like xlsx, docx and pptx have never used this Biff8EncryptionKey support. Passwords are passed using dedicated parameters in the relevant APIs, and are not stored in thread-locals.

      POI 6.0.0 introduces alternatives API methods for HSSF and other H**F classes that take an explicit password parameter, and do not rely on this thread-local. It is recommended to use those APIs instead of the ones that rely on this thread-local.

      Parameters:
      password - pass null to clear user password (and use default)
    • getCurrentUserPassword

      public static String getCurrentUserPassword()
      Returns:
      the BIFF8 encryption/decryption password for the current thread. null if it is currently unset.