| Conditions | 3 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 17 | protected function decryption(string $encryption): ?string |
||
| 18 | { |
||
| 19 | if (!ctype_xdigit($encryption)) { |
||
| 20 | return null; |
||
| 21 | } |
||
| 22 | if (strlen($encryption) % 2 !== 0) { |
||
| 23 | return null; |
||
| 24 | } |
||
| 25 | |||
| 26 | $encryption = hex2bin($encryption); |
||
| 27 | |||
| 28 | $encryption = base64_decode($encryption); |
||
| 29 | [$encrypted_data, $decryption_key, $encryption_iv] = explode(".", $encryption); |
||
| 30 | |||
| 31 | $encryption_iv = hex2bin($encryption_iv); |
||
| 32 | |||
| 33 | $combined_key = CRYPTION_KEY . hex2bin($decryption_key); |
||
| 34 | |||
| 35 | return openssl_decrypt($encrypted_data, CRYPTION_CIPHERING, |
||
| 36 | $combined_key, 0, $encryption_iv); |
||
| 37 | } |
||
| 41 |