Rev 897 | Rev 1143 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 897 | Rev 1130 | ||
---|---|---|---|
Line 18... | Line 18... | ||
18 | */ |
18 | */ |
19 | 19 | ||
20 | // Works with composer.json |
20 | // Works with composer.json |
21 | // "sergeybrook/php-jws": "^1.0" |
21 | // "sergeybrook/php-jws": "^1.0" |
22 | 22 | ||
- | 23 | /** |
|
- | 24 | * @param string $json_content |
|
- | 25 | * @param string $pubkey |
|
- | 26 | * @return void |
|
- | 27 | * @throws Exception |
|
- | 28 | */ |
|
23 | function oidplus_json_verify($json_content, $pubkey) { |
29 | function oidplus_json_verify(string $json_content, string $pubkey) { |
24 | require_once __DIR__.'/vendor/autoload.php'; |
30 | require_once __DIR__.'/vendor/autoload.php'; |
25 | 31 | ||
26 | $jws = new \SBrook\JWS\JwsRsa(); |
32 | $jws = new \SBrook\JWS\JwsRsa(); |
27 | 33 | ||
28 | // Load JSON |
34 | // Load JSON |
Line 53... | Line 59... | ||
53 | if (!$v) { |
59 | if (!$v) { |
54 | throw new Exception("Signature verification failed!"); |
60 | throw new Exception("Signature verification failed!"); |
55 | } |
61 | } |
56 | } |
62 | } |
57 | 63 | ||
- | 64 | /** |
|
- | 65 | * @param string $json_content |
|
- | 66 | * @param string $privkey |
|
- | 67 | * @param string $pubkey |
|
- | 68 | * @return false|string |
|
- | 69 | * @throws Exception |
|
- | 70 | */ |
|
58 | function oidplus_json_sign($json_content, $privkey, $pubkey) { |
71 | function oidplus_json_sign(string $json_content, string $privkey, string $pubkey) { |
59 | require_once __DIR__.'/vendor/autoload.php'; |
72 | require_once __DIR__.'/vendor/autoload.php'; |
60 | 73 | ||
61 | $jws = new \SBrook\JWS\JwsRsa(); |
74 | $jws = new \SBrook\JWS\JwsRsa(); |
62 | 75 | ||
63 | // Load JSON |
76 | // Load JSON |