1 | <?php |
||
4 | class Iron |
||
5 | { |
||
6 | const DEFAULT_ENCRYPTION_METHOD = 'aes-256-cbc'; |
||
7 | |||
8 | /** @var string */ |
||
9 | private $method; |
||
10 | |||
11 | /** |
||
12 | * @param string $encryptionMethod |
||
13 | */ |
||
14 | public function __construct( |
||
19 | |||
20 | /** |
||
21 | * @param string|PasswordInterface $password |
||
22 | * @param string $data |
||
23 | * @param int $ttl |
||
24 | * |
||
25 | * @return Token |
||
26 | */ |
||
27 | public function encrypt($password, $data, $ttl = 0) |
||
41 | |||
42 | /** |
||
43 | * @param string|PasswordInterface $password |
||
44 | * @param string|Token $data |
||
45 | * |
||
46 | * @return string |
||
47 | */ |
||
48 | public function decrypt($password, $data) |
||
55 | |||
56 | public function decryptToken(Token $token, PasswordInterface $password) |
||
66 | |||
67 | private function normalizeToken(PasswordInterface $password, $token) |
||
75 | |||
76 | private function generateCipherText( |
||
90 | } |
||
91 |