Class EncryptionInfo

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class EncryptionInfo
    extends java.lang.Object
    implements java.lang.Cloneable
    This class may require poi-ooxml to be on the classpath to load some EncryptionModes.
    See Also:
    getBuilder(EncryptionMode)
    • Field Detail

      • flagCryptoAPI

        public static final BitField flagCryptoAPI
        A flag that specifies whether CryptoAPI RC4 or ECMA-376 encryption ECMA-376 is used. It MUST be 1 unless flagExternal is 1. If flagExternal is 1, it MUST be 0.
      • flagDocProps

        public static final BitField flagDocProps
        A value that MUST be 0 if document properties are encrypted. The encryption of document properties is specified in section 2.3.5.4.
      • flagExternal

        public static final BitField flagExternal
        A value that MUST be 1 if extensible encryption is used. If this value is 1, the value of every other field in this structure MUST be 0.
      • flagAES

        public static final BitField flagAES
        A value that MUST be 1 if the protected content is an ECMA-376 document ECMA-376. If the fAES bit is 1, the fCryptoAPI bit MUST also be 1.
    • Method Detail

      • getBuilder

        protected static EncryptionInfoBuilder getBuilder​(EncryptionMode encryptionMode)
                                                   throws java.lang.ClassNotFoundException,
                                                          java.lang.IllegalAccessException,
                                                          java.lang.InstantiationException
        This method loads the builder class with reflection, which may generate a ClassNotFoundException if the class is not on the classpath. For example, AgileEncryptionInfoBuilder is contained in the poi-ooxml package since the class makes use of some OOXML classes rather than using the poi package and plain XML DOM calls. As such, you may need to include poi-ooxml and poi-ooxml-schemas to load some encryption mode builders. See bug #60021 for more information. https://bz.apache.org/bugzilla/show_bug.cgi?id=60021
        Parameters:
        encryptionMode - the encryption mode
        Returns:
        an encryption info builder
        Throws:
        java.lang.ClassNotFoundException - if the builder class is not on the classpath
        java.lang.IllegalAccessException - if the builder class can't be loaded
        java.lang.InstantiationException - if the builder class can't be loaded
      • getVersionMajor

        public int getVersionMajor()
      • getVersionMinor

        public int getVersionMinor()
      • getEncryptionFlags

        public int getEncryptionFlags()
      • getDecryptor

        public Decryptor getDecryptor()
      • getEncryptor

        public Encryptor getEncryptor()
      • setDecryptor

        public void setDecryptor​(Decryptor decryptor)
      • setEncryptor

        public void setEncryptor​(Encryptor encryptor)
      • isDocPropsEncrypted

        public boolean isDocPropsEncrypted()
        Returns:
        true, if Document Summary / Summary are encrypted and stored in the EncryptedStream stream, otherwise the Summaries aren't encrypted and located in their usual streams
      • clone

        public EncryptionInfo clone()
                             throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException