Commit | Line | Data |
---|---|---|
14d4f286 S |
1 | <?php |
2 | /** | |
3 | * An implementation of the AES cipher, using the phpseclib implementation | |
4 | * | |
5 | * This was forked from phpseclib and modified to use CryptLib conventions | |
6 | * | |
7 | * PHP version 5.3 | |
8 | * | |
9 | * @category PHPCryptLib | |
10 | * @package Cipher | |
11 | * @subpackage Block | |
12 | * @author Anthony Ferrara <ircmaxell@ircmaxell.com> | |
13 | * @author Jim Wigginton <terrafrost@php.net> | |
14 | * @copyright 2011 The Authors | |
15 | * @license http://www.opensource.org/licenses/mit-license.html MIT License | |
16 | * @version Build @@version@@ | |
17 | */ | |
18 | ||
19 | namespace CryptLib\Cipher\Block\Cipher; | |
20 | ||
21 | /** | |
22 | * An implementation of the AES cipher, using the phpseclib implementation | |
23 | * | |
24 | * @category PHPCryptLib | |
25 | * @package Cipher | |
26 | * @subpackage Block | |
27 | * @author Anthony Ferrara <ircmaxell@ircmaxell.com> | |
28 | */ | |
29 | class AES extends Rijndael { | |
30 | ||
31 | /** | |
32 | * Get a list of supported ciphers for this class implementation | |
33 | * | |
34 | * @return array A list of supported ciphers | |
35 | */ | |
36 | public static function getSupportedCiphers() { | |
37 | return array( | |
38 | 'aes-128', | |
39 | 'aes-192', | |
40 | 'aes-256', | |
41 | ); | |
42 | } | |
43 | ||
44 | /** | |
45 | * Construct the instance for the supplied cipher name | |
46 | * | |
47 | * @param string $cipher The cipher to implement | |
48 | * | |
49 | * @return void | |
50 | * @throws InvalidArgumentException if the cipher is not supported | |
51 | */ | |
52 | public function __construct($cipher) { | |
53 | parent::__construct($cipher); | |
54 | list (, $bits) = explode('-', $cipher, 2); | |
55 | $this->setBlockSize(128); | |
56 | $this->setKeySize($bits); | |
57 | } | |
58 | ||
59 | } |