Total Complexity | 7 |
Total Lines | 71 |
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) |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * generate signature of xml |
||
25 | * |
||
26 | * @param string $xml |
||
27 | * @param string $sign |
||
28 | * @param resource $priv_key |
||
29 | * |
||
30 | * @return bool result of signing |
||
31 | */ |
||
32 | public function sign($xml, &$sign, $priv_key) |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * get public key |
||
39 | * |
||
40 | * @param mixed $certificate |
||
41 | * @return resource |
||
42 | */ |
||
43 | public function get_pub_key($certificate) |
||
44 | { |
||
45 | $pub_key = @openssl_pkey_get_public($certificate); |
||
46 | $this->is_key($pub_key); |
||
47 | |||
48 | return $pub_key; |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * get private key |
||
53 | * |
||
54 | * @param mixed $certificate |
||
55 | * @return resource |
||
56 | */ |
||
57 | public function get_priv_key($certificate) |
||
58 | { |
||
59 | $priv_key = @openssl_pkey_get_private($certificate); |
||
60 | $this->is_key($priv_key); |
||
|
|||
61 | |||
62 | return $priv_key; |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * check key |
||
67 | * |
||
68 | * @param resource $key |
||
69 | * @throws Exception\Runtime |
||
70 | */ |
||
71 | public function is_key($key) |
||
76 | } |
||
77 | } |
||
78 | |||
80 |