Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
48 | 7 | public function sign($string, $privateKey) |
|
49 | { |
||
50 | 7 | $binarySignature = ''; |
|
51 | try { |
||
52 | 7 | openssl_sign( |
|
53 | 7 | $string, |
|
54 | 7 | $binarySignature, |
|
55 | 7 | $privateKey, |
|
56 | \OPENSSL_ALGO_SHA256 |
||
57 | 7 | ); |
|
58 | 7 | } catch (Exception $exception) { |
|
59 | 2 | throw new ClientException( |
|
60 | 2 | $exception->getMessage(), |
|
61 | SDK::INVALID_CREDENTIAL |
||
62 | 2 | ); |
|
63 | } |
||
64 | |||
65 | 5 | return base64_encode($binarySignature); |
|
66 | } |
||
68 |