Interface BlockCipher

All Known Implementing Classes:
RC6Cipher

public interface BlockCipher
Defines a cryptographic block cipher. A BlockCipher operates on a fixed-length block of data. BlockCipher is deterministic, that is given the same key and block, it will produce the same output.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    decipher(byte[] ciphertext, byte[] key)
    Deciphers a fixed-length block of ciphertext.
    byte[]
    encipher(byte[] plaintext, byte[] key)
    Enciphers a fixed-length block of plaintext.
    int
    Returns the fixed block size this cipher operates on.
  • Method Details

    • encipher

      byte[] encipher(byte[] plaintext, byte[] key)
      Enciphers a fixed-length block of plaintext.
      Parameters:
      plaintext - A block of data with length equivalent to getBlockSize().
      key - The secret key for enciphering.
      Returns:
      The resulting enciphered block.
      Throws:
      IllegalArgumentException - If the input length does not match the block size.
    • decipher

      byte[] decipher(byte[] ciphertext, byte[] key)
      Deciphers a fixed-length block of ciphertext.
      Parameters:
      ciphertext - A block of encrypted data with length equivalent to getBlockSize().
      key - The secret key for deciphering.
      Returns:
      The resulting deciphered block.
      Throws:
      IllegalArgumentException - If the input length does not match the block size.
    • getBlockSize

      Returns the fixed block size this cipher operates on.
      Returns:
      The block size in bytes.