| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | 2 | public function decryptData(string $sessionKey, string $iv, string $encrypted): array |
|
| 35 | { |
||
| 36 | 2 | $decrypted = AES::decrypt( |
|
| 37 | 2 | base64_decode($encrypted, false), base64_decode($sessionKey, false), base64_decode($iv, false) |
|
| 38 | ); |
||
| 39 | |||
| 40 | 2 | $decrypted = json_decode($this->pkcs7Unpad($decrypted), true); |
|
| 41 | |||
| 42 | 2 | if (!$decrypted) { |
|
| 43 | 1 | throw new DecryptException('The given payload is invalid.'); |
|
| 44 | } |
||
| 45 | |||
| 46 | 1 | return $decrypted; |
|
| 47 | } |
||
| 49 |