add methods to decrypt return data from router
[GitHub/Stricted/speedport-hybrid-php-api.git] / CryptLib / Cipher / Block / Mode.php
1 <?php
2 /**
3 * The interface that all block cipher modes must implement
4 *
5 * PHP version 5.3
6 *
7 * @category PHPCryptLib
8 * @package Cipher
9 * @subpackage Block
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@@
14 */
15
16 namespace CryptLib\Cipher\Block;
17
18 /**
19 * The interface that all block cipher modes must implement
20 *
21 * @category PHPCryptLib
22 * @package Cipher
23 * @subpackage Block
24 * @author Anthony Ferrara <ircmaxell@ircmaxell.com>
25 * @codeCoverageIgnore
26 */
27 interface Mode {
28
29 /**
30 * Build the instance of the cipher mode
31 *
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
35 */
36 public function __construct(
37 \CryptLib\Cipher\Block\Cipher $cipher,
38 $initv,
39 array $options = array()
40 );
41
42 /**
43 * Decrypt the data using the supplied key, cipher and initialization vector
44 *
45 * @param string $data The data to decrypt
46 *
47 * @return string The decrypted data
48 */
49 public function decrypt($data);
50
51 /**
52 * Encrypt the data using the supplied key, cipher and initialization vector
53 *
54 * @param string $data The data to encrypt
55 *
56 * @return string The encrypted data
57 */
58 public function encrypt($data);
59
60 /**
61 * Finish the mode and append any additional data necessary
62 *
63 * @return string Any additional data
64 */
65 public function finish();
66
67 /**
68 * Get the name of the current mode implementation
69 *
70 * @return string The current mode name
71 */
72 public function getMode();
73
74 /**
75 * Reset the mode to start over (destroying any intermediate state)
76 *
77 * @return void
78 */
79 public function reset();
80
81 }