| @@ 61-78 (lines=18) @@ | ||
| 58 | /** |
|
| 59 | * @inheritdoc |
|
| 60 | */ |
|
| 61 | public function decrypt($data) |
|
| 62 | { |
|
| 63 | assert(is_string($data) === true); |
|
| 64 | ||
| 65 | $this->clearErrors(); |
|
| 66 | ||
| 67 | $decrypted = $this->openSslDecrypt( |
|
| 68 | $data, |
|
| 69 | $this->getMethod(), |
|
| 70 | $this->getPassword(), |
|
| 71 | $this->getOptions(), |
|
| 72 | $this->getInitializationVector() |
|
| 73 | ); |
|
| 74 | ||
| 75 | $decrypted !== false ?: $this->throwException(new CryptException($this->getErrorMessage())); |
|
| 76 | ||
| 77 | return $decrypted; |
|
| 78 | } |
|
| 79 | ||
| 80 | /** |
|
| 81 | * @inheritdoc |
|
| @@ 83-100 (lines=18) @@ | ||
| 80 | /** |
|
| 81 | * @inheritdoc |
|
| 82 | */ |
|
| 83 | public function encrypt($data) |
|
| 84 | { |
|
| 85 | assert(is_string($data) === true); |
|
| 86 | ||
| 87 | $this->clearErrors(); |
|
| 88 | ||
| 89 | $encrypted = $this->openSslEncrypt( |
|
| 90 | $data, |
|
| 91 | $this->getMethod(), |
|
| 92 | $this->getPassword(), |
|
| 93 | $this->getOptions(), |
|
| 94 | $this->getInitializationVector() |
|
| 95 | ); |
|
| 96 | ||
| 97 | $encrypted !== false ?: $this->throwException(new CryptException($this->getErrorMessage())); |
|
| 98 | ||
| 99 | return $encrypted; |
|
| 100 | } |
|
| 101 | ||
| 102 | /** |
|
| 103 | * @return string |
|