001package edu.boisestate.lowry.crypto; 002 003/** 004 * Defines a symmetric-key encryption/decryption scheme. A SymmetricCipher is 005 * a high-level implementation of a mode of operation that uses an underlying 006 * BlockCipher. Implementations of this interface are expected to handle 007 * arbitrary-length inputs. 008 * 009 * @author Jayce Lowry 010 */ 011public interface SymmetricCipher { 012 /** 013 * Encrypts the provided plaintext using a symmetric key. 014 * 015 * @param plaintext The data to be encrypted. 016 * @param key The secret key for encryption. 017 * @return The resulting ciphertext. 018 * @throws IllegalArgumentException If the key length is invalid for the underlying cipher. 019 */ 020 byte[] encrypt(byte[] plaintext, byte[] key); 021 022 /** 023 * Decrypts the provided ciphertext using a symmetric key. 024 * 025 * @param ciphertext The encrypted data to be decrypted. 026 * @param key The secret key for decryption. 027 * @return The resulting plaintext. 028 * @throws IllegalArgumentException If the key length is invalid for the underlying cipher. 029 */ 030 byte[] decrypt(byte[] ciphertext, byte[] key); 031}