1 | <?php |
||
27 | class Aes extends Cryptobase |
||
28 | { |
||
29 | |||
30 | /** |
||
31 | * AES-256 cipher identifier that will be passed to openssl |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | const CIPHER = 'aes-256-cbc'; |
||
36 | |||
37 | /** |
||
38 | * Size of initialization vector in bytes |
||
39 | * |
||
40 | * @var int |
||
41 | */ |
||
42 | const IVSIZE = 16; |
||
43 | |||
44 | /** |
||
45 | * Size of checksum in bytes |
||
46 | * |
||
47 | * @var int |
||
48 | */ |
||
49 | const CKSIZE = 32; |
||
50 | |||
51 | /** |
||
52 | * Decrypt cyphertext |
||
53 | * |
||
54 | * @param string $cyphertext Cyphertext to decrypt |
||
55 | * @param string $password Password that should be used to decrypt input data |
||
56 | * @param int $cost Number of HMAC iterations to perform on key |
||
57 | * |
||
58 | * @return string|boolean Returns false on checksum validation failure |
||
59 | */ |
||
60 | 7 | public static function decrypt($cyphertext, $password, $cost = 0) |
|
83 | |||
84 | /** |
||
85 | * Encrypt plaintext |
||
86 | * |
||
87 | * @param string $plaintext Plaintext string to encrypt. |
||
88 | * @param string $password Password used to encrypt data. |
||
89 | * @param int $cost Number of HMAC iterations to perform on key |
||
90 | * |
||
91 | * @return string |
||
92 | */ |
||
93 | 6 | public static function encrypt($plaintext, $password, $cost = 0) |
|
110 | |||
111 | protected static function mode() |
||
115 | |||
116 | } |
||
117 |