| Total Complexity | 5 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 5 | class OpenSSL |
||
| 6 | { |
||
| 7 | public function __construct() {} |
||
| 8 | |||
| 9 | /** |
||
| 10 | * verify signature of xml |
||
| 11 | * |
||
| 12 | * @param string $xml |
||
| 13 | * @param string $bin_sign |
||
| 14 | * @param resource $pub_key |
||
| 15 | * |
||
| 16 | * @return integer result of checking |
||
| 17 | */ |
||
| 18 | public function verify($xml, $bin_sign, $pub_key) |
||
| 19 | { |
||
| 20 | return @openssl_verify($xml, $bin_sign, $pub_key); |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * get public key |
||
| 25 | * |
||
| 26 | * @param mixed $certificate |
||
| 27 | * @return resource |
||
| 28 | */ |
||
| 29 | public function get_pub_key($certificate) |
||
| 30 | { |
||
| 31 | $pub_key = @openssl_pkey_get_public($certificate); |
||
| 32 | $this->is_key($pub_key); |
||
| 33 | |||
| 34 | return $pub_key; |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * check key |
||
| 39 | * |
||
| 40 | * @param resource $key |
||
| 41 | * @throws Exception\Runtime |
||
| 42 | */ |
||
| 43 | public function is_key($key) |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | } |
||
| 52 |