| Conditions | 1 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 35 | public function encryptData(string $data): string |
||
| 36 | { |
||
| 37 | $encryptionKey = $this->config |
||
| 38 | ->getEncryptionKey(); |
||
| 39 | $initVector = $this->getRandomPseudoBytes(); |
||
| 40 | |||
| 41 | $encryptedData = openssl_encrypt( |
||
| 42 | $data, |
||
| 43 | static::CYPHER_METHOD, |
||
| 44 | $encryptionKey, |
||
| 45 | OPENSSL_RAW_DATA, |
||
| 46 | $initVector |
||
| 47 | ); |
||
| 48 | |||
| 49 | return implode(static::INIT_VECTOR_SEPARATOR, [$encryptedData, base64_encode($initVector)]); |
||
| 50 | } |
||
| 88 |