Interface SymmetricCipher

All Known Implementing Classes:
CTRMode

public interface SymmetricCipher
Defines a symmetric-key encryption/decryption scheme. A SymmetricCipher is a high-level implementation of a mode of operation that uses an underlying BlockCipher. Implementations of this interface are expected to handle arbitrary-length inputs.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    decrypt(byte[] ciphertext, byte[] key)
    Decrypts the provided ciphertext using a symmetric key.
    byte[]
    encrypt(byte[] plaintext, byte[] key)
    Encrypts the provided plaintext using a symmetric key.
  • Method Details

    • encrypt

      byte[] encrypt(byte[] plaintext, byte[] key)
      Encrypts the provided plaintext using a symmetric key.
      Parameters:
      plaintext - The data to be encrypted.
      key - The secret key for encryption.
      Returns:
      The resulting ciphertext.
      Throws:
      IllegalArgumentException - If the key length is invalid for the underlying cipher.
    • decrypt

      byte[] decrypt(byte[] ciphertext, byte[] key)
      Decrypts the provided ciphertext using a symmetric key.
      Parameters:
      ciphertext - The encrypted data to be decrypted.
      key - The secret key for decryption.
      Returns:
      The resulting plaintext.
      Throws:
      IllegalArgumentException - If the key length is invalid for the underlying cipher.