1 | <?php |
||
10 | class Symmetric extends AbstractEncryption implements EncryptionInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | private $secret; |
||
16 | |||
17 | /** |
||
18 | * @param Algorithm\SymmetricInterface $algorithm |
||
19 | */ |
||
20 | public function __construct(Algorithm\SymmetricInterface $algorithm) |
||
24 | |||
25 | /** |
||
26 | * @return string |
||
27 | */ |
||
28 | public function getSecret() |
||
32 | |||
33 | /** |
||
34 | * @param string $secret |
||
35 | * @return $this |
||
36 | */ |
||
37 | public function setSecret($secret) |
||
42 | |||
43 | /** |
||
44 | * @param string $value |
||
45 | * @return string |
||
46 | */ |
||
47 | public function encrypt($value) |
||
51 | |||
52 | /** |
||
53 | * @param string $value |
||
54 | * @param string $signature |
||
55 | * @return boolean |
||
56 | */ |
||
57 | public function verify($value, $signature) |
||
63 | |||
64 | /** |
||
65 | * A timing safe equals comparison. |
||
66 | * |
||
67 | * @see http://blog.ircmaxell.com/2014/11/its-all-about-time.html |
||
68 | * |
||
69 | * @param string $safe The internal (safe) value to be checked |
||
70 | * @param string $user The user submitted (unsafe) value |
||
71 | * |
||
72 | * @return boolean True if the two strings are identical. |
||
73 | */ |
||
74 | public function timingSafeEquals($safe, $user) |
||
99 | } |
||
100 |