| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function sign($payload, KeyManagerInterface $key) |
||
| 17 | { |
||
| 18 | $priv = \openssl_get_privatekey( |
||
| 19 | $key->getContent(), |
||
| 20 | $key->getPassphrase() |
||
| 21 | ); |
||
| 22 | |||
| 23 | if (false === $priv) { |
||
| 24 | throw new \RuntimeException( |
||
| 25 | sprintf("Error: %s\n", \openssl_error_string()) |
||
| 26 | ); |
||
| 27 | } |
||
| 28 | |||
| 29 | \openssl_sign($payload, $signature, $priv, $this->getAlgorithm()); |
||
| 30 | |||
| 31 | return $signature; |
||
| 32 | } |
||
| 33 | |||
| 67 |