1 | <?php |
||
7 | abstract class EncryptedValue implements JsonSerializable, Serializable |
||
8 | { |
||
9 | /** @var string */ |
||
10 | private $cipherText; |
||
11 | /** @var string */ |
||
12 | private $method; |
||
13 | /** @var string */ |
||
14 | private $initializationVector; |
||
15 | |||
16 | 264 | public function __construct($cipherText, $method, $iv) |
|
22 | |||
23 | 6 | public function jsonSerialize() |
|
24 | { |
||
25 | return [ |
||
26 | 6 | 'cipherText' => $this->cipherText, |
|
27 | 6 | 'method' => $this->method, |
|
28 | 6 | 'iv' => base64_encode($this->initializationVector), |
|
29 | ]; |
||
30 | } |
||
31 | |||
32 | 6 | public function serialize() |
|
36 | |||
37 | 6 | public function unserialize($serialized) |
|
45 | |||
46 | /** |
||
47 | * @return string |
||
48 | */ |
||
49 | 186 | public function getCipherText() |
|
53 | |||
54 | /** |
||
55 | * @return string |
||
56 | */ |
||
57 | 132 | public function getMethod() |
|
61 | |||
62 | /** |
||
63 | * @return string |
||
64 | */ |
||
65 | 132 | public function getInitializationVector() |
|
69 | } |
||
70 |