org.apache.poi.poifs.crypt

## Class EncryptionHeader

- java.lang.Object
- - org.apache.poi.poifs.crypt.EncryptionHeader

- All Implemented Interfaces:
    Duplicatable, GenericRecord
  Direct Known Subclasses:
    AgileEncryptionHeader, BinaryRC4EncryptionHeader, StandardEncryptionHeader, XOREncryptionHeader

      public abstract class EncryptionHeader
      extends java.lang.Object
      implements GenericRecord, Duplicatable

  Reads and processes OOXML Encryption Headers The constants are largely based on ZIP constants.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `ALGORITHM_AES_128`
    `static int` | `ALGORITHM_AES_192`
    `static int` | `ALGORITHM_AES_256`
    `static int` | `ALGORITHM_RC4`
    `static int` | `HASH_NONE`
    `static int` | `HASH_SHA1`
    `static int` | `HASH_SHA256`
    `static int` | `HASH_SHA384`
    `static int` | `HASH_SHA512`
    `static int` | `MODE_CBC`
    `static int` | `MODE_CFB`
    `static int` | `MODE_ECB`
    `static int` | `PROVIDER_AES`
    `static int` | `PROVIDER_RC4`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `EncryptionHeader()`
    `protected` | `EncryptionHeader(EncryptionHeader other)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract EncryptionHeader` | `copy()`
    `int` | `getBlockSize()`
    `ChainingMode` | `getChainingMode()`
    `CipherAlgorithm` | `getCipherAlgorithm()`
    `CipherProvider` | `getCipherProvider()`
    `java.lang.String` | `getCspName()`
    `int` | `getFlags()`
    `java.util.Map<java.lang.String,java.util.function.Supplier<?>>` | `getGenericProperties()`
    `HashAlgorithm` | `getHashAlgorithm()`
    `byte[]` | `getKeySalt()`
    `int` | `getKeySize()`
    `int` | `getSizeExtra()`
    `protected void` | `setBlockSize(int blockSize)`
    `protected void` | `setChainingMode(ChainingMode chainingMode)`
    `protected void` | `setCipherAlgorithm(CipherAlgorithm cipherAlgorithm)`
    `protected void` | `setCipherProvider(CipherProvider providerType)`
    `protected void` | `setCspName(java.lang.String cspName)`
    `protected void` | `setFlags(int flags)`
    `protected void` | `setHashAlgorithm(HashAlgorithm hashAlgorithm)`
    `protected void` | `setKeySalt(byte[] salt)`
    `protected void` | `setKeySize(int keyBits)` Sets the keySize (in bits).
    `protected void` | `setSizeExtra(int sizeExtra)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.poi.common.usermodel.GenericRecord

      `getGenericChildren, getGenericRecordType`

- - ### Field Detail

    - #### ALGORITHM_RC4

          public static final int ALGORITHM_RC4

    - #### ALGORITHM_AES_128

          public static final int ALGORITHM_AES_128

    - #### ALGORITHM_AES_192

          public static final int ALGORITHM_AES_192

    - #### ALGORITHM_AES_256

          public static final int ALGORITHM_AES_256

    - #### HASH_NONE

          public static final int HASH_NONE

    - #### HASH_SHA1

          public static final int HASH_SHA1

    - #### HASH_SHA256

          public static final int HASH_SHA256

    - #### HASH_SHA384

          public static final int HASH_SHA384

    - #### HASH_SHA512

          public static final int HASH_SHA512

    - #### PROVIDER_RC4

          public static final int PROVIDER_RC4

    - #### PROVIDER_AES

          public static final int PROVIDER_AES

    - #### MODE_ECB

          public static final int MODE_ECB

    - #### MODE_CBC

          public static final int MODE_CBC

    - #### MODE_CFB

          public static final int MODE_CFB

  - ### Constructor Detail

    - #### EncryptionHeader

          protected EncryptionHeader()

    - #### EncryptionHeader

          protected EncryptionHeader(EncryptionHeader other)

  - ### Method Detail

    - #### getChainingMode

          public ChainingMode getChainingMode()

    - #### setChainingMode

          protected void setChainingMode(ChainingMode chainingMode)

    - #### getFlags

          public int getFlags()

    - #### setFlags

          protected void setFlags(int flags)

    - #### getSizeExtra

          public int getSizeExtra()

    - #### setSizeExtra

          protected void setSizeExtra(int sizeExtra)

    - #### getCipherAlgorithm

          public CipherAlgorithm getCipherAlgorithm()

    - #### setCipherAlgorithm

          protected void setCipherAlgorithm(CipherAlgorithm cipherAlgorithm)

    - #### getHashAlgorithm

          public HashAlgorithm getHashAlgorithm()

    - #### setHashAlgorithm

          protected void setHashAlgorithm(HashAlgorithm hashAlgorithm)

    - #### getKeySize

          public int getKeySize()

    - #### setKeySize

          protected void setKeySize(int keyBits)

      Sets the keySize (in bits). Before calling this method, make sure to set the cipherAlgorithm, as the amount of keyBits gets validated against the list of allowed keyBits of the corresponding cipherAlgorithm
      Parameters:
        `keyBits` -

    - #### getBlockSize

          public int getBlockSize()

    - #### setBlockSize

          protected void setBlockSize(int blockSize)

    - #### getKeySalt

          public byte[] getKeySalt()

    - #### setKeySalt

          protected void setKeySalt(byte[] salt)

    - #### getCipherProvider

          public CipherProvider getCipherProvider()

    - #### setCipherProvider

          protected void setCipherProvider(CipherProvider providerType)

    - #### getCspName

          public java.lang.String getCspName()

    - #### setCspName

          protected void setCspName(java.lang.String cspName)

    - #### copy

          public abstract EncryptionHeader copy()

      Specified by:
        `copy` in interface `Duplicatable`
      Returns:
        a deep copy of the implementing class / instance

    - #### getGenericProperties

          public java.util.Map<java.lang.String,java.util.function.Supplier<?>> getGenericProperties()

      Specified by:
        `getGenericProperties` in interface `GenericRecord`

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.