1 | <?php |
||
21 | class ECDSAAdapter implements ECDSAAdapterInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var GmpMathInterface |
||
25 | */ |
||
26 | private $adapter; |
||
27 | |||
28 | /** |
||
29 | * @var Signer |
||
30 | */ |
||
31 | private $signer; |
||
32 | |||
33 | /** |
||
34 | * @var NistCurves |
||
35 | */ |
||
36 | private $curve; |
||
37 | |||
38 | /** |
||
39 | * @var RandomGeneratorInterface |
||
40 | */ |
||
41 | private $random; |
||
42 | |||
43 | /** |
||
44 | * Signature hash length hashmap. |
||
45 | */ |
||
46 | private const SIGNATURE_LENGTH = [ |
||
47 | 'sha256' => 64, |
||
48 | 'sha384' => 96, |
||
49 | 'sha512' => 132 |
||
50 | ]; |
||
51 | |||
52 | /** |
||
53 | * Generator point hashmap. |
||
54 | */ |
||
55 | private const GENERATOR_POINTS = [ |
||
56 | 'sha256' => 'generator256', |
||
57 | 'sha384' => 'generator384', |
||
58 | 'sha512' => 'generator521' |
||
59 | ]; |
||
60 | |||
61 | public function __construct( |
||
69 | |||
70 | /** |
||
71 | * For chainability purpose. |
||
72 | */ |
||
73 | public static function create() |
||
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | */ |
||
83 | public function sign( |
||
109 | |||
110 | /** |
||
111 | * {@inheritdoc} |
||
112 | */ |
||
113 | public function verify( |
||
125 | |||
126 | /** |
||
127 | * {@inheritdoc} |
||
128 | */ |
||
129 | public function createSigningHash($payload, $algorithm) |
||
138 | |||
139 | /** |
||
140 | * {@inheritdoc} |
||
141 | */ |
||
142 | public function getMathAdapter() |
||
146 | |||
147 | /** |
||
148 | * Parse previous generated signature. |
||
149 | * |
||
150 | * @param string $expected |
||
151 | * @param string $algorithm |
||
152 | * @return SignatureInterface |
||
153 | */ |
||
154 | private function parseExpectedSignature($expected, $algorithm) |
||
166 | |||
167 | /** |
||
168 | * Append zero char into given ECDSA signature. |
||
169 | * |
||
170 | * @param \GMP $point |
||
171 | * @param integer $length |
||
172 | * @return string |
||
173 | */ |
||
174 | private function addSignaturePadding(\GMP $point, $length) |
||
178 | |||
179 | /** |
||
180 | * Determine ECDSA generator point based on given algorithm. |
||
181 | * |
||
182 | * @param string $algorithm |
||
183 | * @return GeneratorPoint |
||
184 | */ |
||
185 | private function determineGeneratorPoint($algorithm) |
||
198 | } |
||
199 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..