Conditions | 6 |
Paths | 6 |
Total Lines | 27 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
42 | public function decryptData($encryptedData, $iv, &$data) |
||
43 | { |
||
44 | if (strlen($this->sessionKey) != 24) { |
||
45 | return self::ILLEGAL_AES_KEY; |
||
46 | } |
||
47 | |||
48 | if (strlen($iv) != 24) { |
||
49 | return self::ILLEGAL_IV; |
||
50 | } |
||
51 | |||
52 | $encoder = new PKCS7Encoder(); |
||
53 | $result = $encoder->decrypt($encryptedData, $this->sessionKey, $iv); |
||
54 | |||
55 | if ($result[0] != 0) { |
||
56 | return $result[0]; |
||
57 | } |
||
58 | |||
59 | if ($result[1] == null) { |
||
60 | return self::ILLEGAL_BUFFER; |
||
61 | } |
||
62 | if ($result[1]->watermark->appid != $this->appid) { |
||
63 | return self::ILLEGAL_BUFFER; |
||
64 | } |
||
65 | $data = $result[1]; |
||
66 | |||
67 | return self::OK; |
||
68 | } |
||
69 | } |
||
70 |