JceSm4CtrCryptoCodec (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.crypto, class: JceSm4CtrCryptoCodec

Package org.apache.hadoop.crypto

# Class JceSm4CtrCryptoCodec

java.lang.Object
org.apache.hadoop.crypto.CryptoCodec
org.apache.hadoop.crypto.JceCtrCryptoCodec
org.apache.hadoop.crypto.JceSm4CtrCryptoCodec

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `Configurable`

@Private public class JceSm4CtrCryptoCodec extends JceCtrCryptoCodec
Implement the SM4-CTR crypto codec using JCE provider.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.hadoop.crypto.JceCtrCryptoCodec

  `JceCtrCryptoCodec.JceCtrCipher`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JceSm4CtrCryptoCodec()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `calculateIV(byte[] initIV, long counter, byte[] iv)`
  This interface is only for Counter (CTR) mode.
  `Decryptor`
  `createDecryptor()`
  Create a `Decryptor`.
  `Encryptor`
  `createEncryptor()`
  Create a `Encryptor`.
  `CipherSuite`
  `getCipherSuite()`
  `org.slf4j.Logger`
  `getLogger()`

  ### Methods inherited from class org.apache.hadoop.crypto.JceCtrCryptoCodec

  `calculateIV, close, generateSecureRandom, getConf, getProvider, setConf`

  ### Methods inherited from class org.apache.hadoop.crypto.CryptoCodec

  `getInstance, getInstance`

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

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

- ## Constructor Details

  - ### JceSm4CtrCryptoCodec

    public JceSm4CtrCryptoCodec()

- ## Method Details

  - ### getLogger

    public org.slf4j.Logger getLogger()
    Specified by:
      `getLogger` in class `JceCtrCryptoCodec`

  - ### getCipherSuite

    public CipherSuite getCipherSuite()
    Specified by:
      `getCipherSuite` in class `CryptoCodec`
    Returns:
      the CipherSuite for this codec.

  - ### calculateIV

    public void calculateIV(byte[] initIV, long counter, byte[] iv)
    Description copied from class: `CryptoCodec`
    This interface is only for Counter (CTR) mode. Generally the Encryptor or Decryptor calculates the IV and maintain encryption context internally. For example a `Cipher` will maintain its encryption context internally when we do encryption/decryption using the Cipher#update interface.

    Encryption/Decryption is not always on the entire file. For example, in Hadoop, a node may only decrypt a portion of a file (i.e. a split). In these situations, the counter is derived from the file position.

    The IV can be calculated by combining the initial IV and the counter with a lossless operation (concatenation, addition, or XOR). See http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Counter_ .28CTR.29

    Specified by:
      `calculateIV` in class `CryptoCodec`
    Parameters:
      `initIV` - initial IV
      `counter` - counter for input stream position
      `iv` - the IV for input stream position

  - ### createEncryptor

    public Encryptor createEncryptor() throws GeneralSecurityException
    Description copied from class: `CryptoCodec`
    Create a `Encryptor`.
    Specified by:
      `createEncryptor` in class `CryptoCodec`
    Returns:
      Encryptor the encryptor.
    Throws:
      `GeneralSecurityException` - thrown if create encryptor error.

  - ### createDecryptor

    public Decryptor createDecryptor() throws GeneralSecurityException
    Description copied from class: `CryptoCodec`
    Create a `Decryptor`.
    Specified by:
      `createDecryptor` in class `CryptoCodec`
    Returns:
      Decryptor the decryptor
    Throws:
      `GeneralSecurityException` - thrown if create decryptor error.