| Total Complexity | 5 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 93.75% |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class MethodRSASHA1 extends AbstractSignatureMethod |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var string Path to the private key used for signing |
||
| 18 | */ |
||
| 19 | private $privateKey; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * MethodRSASHA1 constructor. |
||
| 23 | * |
||
| 24 | * @param string $privateKey The path to the private key used for signing |
||
| 25 | */ |
||
| 26 | 12 | public function __construct($privateKey) |
|
| 27 | { |
||
| 28 | 12 | if (!is_readable($privateKey)) { |
|
| 29 | 1 | throw new \InvalidArgumentException('The private key is not readable'); |
|
| 30 | } |
||
| 31 | |||
| 32 | 11 | if (!function_exists('openssl_pkey_get_private')) { |
|
| 33 | throw new \InvalidArgumentException('The OpenSSL-Extension seems not to be available. That is necessary to handle RSA-SHA1'); |
||
| 34 | } |
||
| 35 | |||
| 36 | 11 | $this->privateKey = $privateKey; |
|
| 37 | 11 | } |
|
| 38 | |||
| 39 | /** |
||
| 40 | * @return string |
||
| 41 | */ |
||
| 42 | 2 | public function getName() |
|
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param string $signatureBase |
||
| 49 | * @param Consumer $consumer |
||
| 50 | * @param Token $token |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | 2 | public function buildSignature(string $signatureBase, Consumer $consumer, Token $token) |
|
| 66 |