Commit | Line | Data |
---|---|---|
14d4f286 S |
1 | <?php |
2 | /** | |
3 | * The interface that all block ciphers 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 ciphers must implement | |
20 | * | |
21 | * @category PHPCryptLib | |
22 | * @package Cipher | |
23 | * @subpackage Block | |
24 | * @author Anthony Ferrara <ircmaxell@ircmaxell.com> | |
25 | * @codeCoverageIgnore | |
26 | */ | |
27 | interface Cipher { | |
28 | ||
29 | /** | |
30 | * Get a list of supported ciphers by this cipher. | |
31 | * | |
32 | * @return array An array of supported cipher names (strings) | |
33 | */ | |
34 | public static function getSupportedCiphers(); | |
35 | ||
36 | /** | |
37 | * Decrypt a block of data using the supplied string key. | |
38 | * | |
39 | * Note that the supplied data should be the same size as the block size of | |
40 | * the cipher being used. | |
41 | * | |
42 | * @param string $data The data to decrypt | |
43 | * | |
44 | * @return string The result decrypted data | |
45 | */ | |
46 | public function decryptBlock($data); | |
47 | ||
48 | /** | |
49 | * Encrypt a block of data using the supplied string key. | |
50 | * | |
51 | * Note that the supplied data should be the same size as the block size of | |
52 | * the cipher being used. | |
53 | * | |
54 | * @param string $data The data to encrypt | |
55 | * | |
56 | * @return string The result encrypted data | |
57 | */ | |
58 | public function encryptBlock($data); | |
59 | ||
60 | /** | |
61 | * Get the block size for the current initialized cipher. | |
62 | * | |
63 | * @return int The block size for the current cipher | |
64 | */ | |
65 | public function getBlockSize(); | |
66 | ||
67 | /** | |
68 | * Get the key size for the current initialized cipher | |
69 | * | |
70 | * @return int The key size for the current cipher | |
71 | */ | |
72 | public function getKeySize(); | |
73 | ||
74 | /** | |
75 | * Get the string name of the current cipher instance. | |
76 | * | |
77 | * @return string The current instantiated cipher | |
78 | */ | |
79 | public function getCipher(); | |
80 | ||
81 | /** | |
82 | * Set the key to be used in this instance | |
83 | * | |
84 | * @param string $key The key the data will be encrypted with | |
85 | * | |
86 | * @return void | |
87 | */ | |
88 | public function setKey($key); | |
89 | ||
90 | } |