3 * The interface that all block cipher modes must implement
7 * @category PHPCryptLib
10 * @author Anthony Ferrara <ircmaxell@ircmaxell.com>
11 * @copyright 2011 The Authors
12 * @license http://www.opensource.org/licenses/mit-license.html MIT License
13 * @version Build @@version@@
16 namespace CryptLib\Cipher\Block
;
19 * The interface that all block cipher modes must implement
21 * @category PHPCryptLib
24 * @author Anthony Ferrara <ircmaxell@ircmaxell.com>
30 * Build the instance of the cipher mode
32 * @param Cipher $cipher The cipher to use for encryption/decryption
33 * @param string $initv The initialization vector (empty if not needed)
34 * @param array $options An array of mode-specific options
36 public function __construct(
37 \CryptLib\Cipher\Block\Cipher
$cipher,
39 array $options = array()
43 * Decrypt the data using the supplied key, cipher and initialization vector
45 * @param string $data The data to decrypt
47 * @return string The decrypted data
49 public function decrypt($data);
52 * Encrypt the data using the supplied key, cipher and initialization vector
54 * @param string $data The data to encrypt
56 * @return string The encrypted data
58 public function encrypt($data);
61 * Finish the mode and append any additional data necessary
63 * @return string Any additional data
65 public function finish();
68 * Get the name of the current mode implementation
70 * @return string The current mode name
72 public function getMode();
75 * Reset the mode to start over (destroying any intermediate state)
79 public function reset();