Rev 1130 | Rev 1162 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1130 | Rev 1143 | ||
---|---|---|---|
Line 63... | Line 63... | ||
63 | 63 | ||
64 | /** |
64 | /** |
65 | * @param string $json_content |
65 | * @param string $json_content |
66 | * @param string $privkey |
66 | * @param string $privkey |
67 | * @param string $pubkey |
67 | * @param string $pubkey |
68 | * @return false|string |
68 | * @return string |
69 | * @throws Exception |
69 | * @throws Exception |
70 | */ |
70 | */ |
71 | function oidplus_json_sign(string $json_content, string $privkey, string $pubkey) { |
71 | function oidplus_json_sign(string $json_content, string $privkey, string $pubkey) { |
72 | require_once __DIR__.'/vendor/autoload.php'; |
72 | require_once __DIR__.'/vendor/autoload.php'; |
73 | 73 | ||
Line 99... | Line 99... | ||
99 | $output = $input; |
99 | $output = $input; |
100 | $output->signature = $signature; |
100 | $output->signature = $signature; |
101 | 101 | ||
102 | // Self-test and output |
102 | // Self-test and output |
103 | $json_signed = json_encode($output); |
103 | $json_signed = json_encode($output); |
- | 104 | if (!$json_signed) throw new Exception("JSON Encoding failed"); |
|
104 | oidplus_json_verify($json_signed, $pubkey); |
105 | oidplus_json_verify($json_signed, $pubkey); |
105 | return $json_signed; |
106 | return $json_signed; |
106 | } |
107 | } |