| Conditions | 3 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | public function verify($signature) |
||
| 32 | { |
||
| 33 | OpenSslException::reset(); |
||
| 34 | |||
| 35 | ob_start(); |
||
| 36 | |||
| 37 | $result = openssl_verify( |
||
| 38 | $this->getData(), |
||
| 39 | @pack('H*', $signature), |
||
| 40 | $this->getKey() |
||
| 41 | ); |
||
| 42 | |||
| 43 | $error = trim(ob_get_clean()); |
||
| 44 | |||
| 45 | if (-1 === $result) { |
||
| 46 | throw OpenSslException::lastError(); |
||
| 47 | } |
||
| 48 | if (!empty($error)) { |
||
| 49 | throw new OpenSslException($error); |
||
| 50 | } |
||
| 51 | |||
| 52 | return 1 === $result; |
||
| 53 | } |
||
| 55 |