Class TnepresEngine

java.lang.Object
org.bouncycastle.crypto.engines.SerpentEngineBase
org.bouncycastle.crypto.engines.TnepresEngine
All Implemented Interfaces:
BlockCipher

public final class TnepresEngine extends SerpentEngineBase
Tnepres is a 128-bit 32-round block cipher with variable key lengths, including 128, 192 and 256 bit keys conjectured to be at least as secure as three-key triple-DES.

Tnepres is based on Serpent which was designed by Ross Anderson, Eli Biham and Lars Knudsen as a candidate algorithm for the NIST AES Quest. Unfortunately there was an endianness issue with test vectors in the AES submission and the resulting confusion lead to the Tnepres cipher as well, which is a byte swapped version of Serpent.

For full details see The Serpent home page

  • Constructor Details

    • TnepresEngine

      public TnepresEngine()
  • Method Details

    • getAlgorithmName

      public String getAlgorithmName()
      Description copied from interface: BlockCipher
      Return the name of the algorithm the cipher implements.
      Specified by:
      getAlgorithmName in interface BlockCipher
      Overrides:
      getAlgorithmName in class SerpentEngineBase
      Returns:
      the name of the algorithm the cipher implements.
    • makeWorkingKey

      protected int[] makeWorkingKey(byte[] key) throws IllegalArgumentException
      Expand a user-supplied key material into a session key.
      Specified by:
      makeWorkingKey in class SerpentEngineBase
      Parameters:
      key - The user-key bytes (multiples of 4) to use.
      Throws:
      IllegalArgumentException
    • encryptBlock

      protected void encryptBlock(byte[] input, int inOff, byte[] output, int outOff)
      Encrypt one block of plaintext.
      Specified by:
      encryptBlock in class SerpentEngineBase
      Parameters:
      input - the array containing the input data.
      inOff - offset into the in array the data starts at.
      output - the array the output data will be copied into.
      outOff - the offset into the out array the output will start at.
    • decryptBlock

      protected void decryptBlock(byte[] input, int inOff, byte[] output, int outOff)
      Decrypt one block of ciphertext.
      Specified by:
      decryptBlock in class SerpentEngineBase
      Parameters:
      input - the array containing the input data.
      inOff - offset into the in array the data starts at.
      output - the array the output data will be copied into.
      outOff - the offset into the out array the output will start at.