1 | <?php |
||
21 | class PrivateKey extends Key implements PrivateKeyInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var \GMP |
||
25 | */ |
||
26 | private $secret; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | private $secretBin; |
||
32 | |||
33 | /** |
||
34 | * @var bool |
||
35 | */ |
||
36 | private $compressed; |
||
37 | |||
38 | /** |
||
39 | * @var PublicKey |
||
40 | */ |
||
41 | private $publicKey; |
||
42 | |||
43 | /** |
||
44 | * @var EcAdapter |
||
45 | */ |
||
46 | private $ecAdapter; |
||
47 | |||
48 | /** |
||
49 | * @param EcAdapter $adapter |
||
50 | * @param \GMP $secret |
||
51 | * @param bool|false $compressed |
||
52 | * @throws \Exception |
||
53 | */ |
||
54 | 76 | public function __construct(EcAdapter $adapter, \GMP $secret, bool $compressed = false) |
|
70 | |||
71 | /** |
||
72 | * @param BufferInterface $msg32 |
||
73 | * @param RbgInterface|null $rbgInterface |
||
74 | * @return Signature |
||
75 | */ |
||
76 | public function sign(BufferInterface $msg32, RbgInterface $rbgInterface = null): Signature |
||
80 | |||
81 | /** |
||
82 | * @return bool |
||
83 | */ |
||
84 | 61 | public function isCompressed(): bool |
|
88 | |||
89 | /** |
||
90 | * @return \GMP |
||
91 | */ |
||
92 | 52 | public function getSecret() |
|
96 | |||
97 | /** |
||
98 | * @return string |
||
99 | */ |
||
100 | 120 | public function getSecretBinary(): string |
|
104 | |||
105 | /** |
||
106 | * @return PublicKey |
||
107 | */ |
||
108 | 114 | public function getPublicKey() |
|
123 | |||
124 | /** |
||
125 | * @param \GMP $tweak |
||
126 | * @return KeyInterface |
||
127 | */ |
||
128 | 8 | public function tweakAdd(\GMP $tweak): KeyInterface |
|
148 | |||
149 | /** |
||
150 | * @param \GMP $tweak |
||
151 | * @return KeyInterface |
||
152 | */ |
||
153 | 1 | public function tweakMul(\GMP $tweak): KeyInterface |
|
172 | |||
173 | /** |
||
174 | * @param NetworkInterface $network |
||
175 | * @return string |
||
176 | */ |
||
177 | 3 | public function toWif(NetworkInterface $network = null): string |
|
183 | |||
184 | /** |
||
185 | * @return BufferInterface |
||
186 | */ |
||
187 | 118 | public function getBuffer(): BufferInterface |
|
191 | } |
||
192 |