1 | <?php |
||
27 | class PrivateKey extends Key implements PrivateKeyInterface |
||
28 | { |
||
29 | /** |
||
30 | * @var \GMP |
||
31 | */ |
||
32 | private $secretMultiplier; |
||
33 | |||
34 | /** |
||
35 | * @var bool |
||
36 | */ |
||
37 | private $compressed; |
||
38 | |||
39 | /** |
||
40 | * @var PublicKey |
||
41 | */ |
||
42 | private $publicKey; |
||
43 | |||
44 | /** |
||
45 | * @var EcAdapter |
||
46 | */ |
||
47 | private $ecAdapter; |
||
48 | |||
49 | /** |
||
50 | * @param EcAdapter $ecAdapter |
||
51 | * @param \GMP $int |
||
52 | * @param bool $compressed |
||
53 | * @throws InvalidPrivateKey |
||
54 | */ |
||
55 | 40 | public function __construct(EcAdapter $ecAdapter, \GMP $int, bool $compressed = false) |
|
65 | |||
66 | /** |
||
67 | * @return \GMP |
||
68 | */ |
||
69 | 62 | public function getSecret(): \GMP |
|
73 | |||
74 | /** |
||
75 | * @param BufferInterface $msg32 |
||
76 | * @param RbgInterface|null $rbg |
||
77 | * @return Signature |
||
78 | */ |
||
79 | 33 | public function sign(BufferInterface $msg32, RbgInterface $rbg = null): SignatureInterface |
|
97 | |||
98 | /** |
||
99 | * @param BufferInterface $msg32 |
||
100 | * @param RbgInterface|null $rbg |
||
101 | * @return CompactSignatureInterface |
||
102 | * @throws \Exception |
||
103 | */ |
||
104 | 5 | public function signCompact(BufferInterface $msg32, RbgInterface $rbg = null): CompactSignatureInterface |
|
118 | |||
119 | /** |
||
120 | * @param \GMP $tweak |
||
121 | * @return KeyInterface |
||
122 | */ |
||
123 | 7 | public function tweakAdd(\GMP $tweak): KeyInterface |
|
129 | |||
130 | /** |
||
131 | * @param \GMP $tweak |
||
132 | * @return KeyInterface |
||
133 | */ |
||
134 | 1 | public function tweakMul(\GMP $tweak): KeyInterface |
|
140 | |||
141 | /** |
||
142 | * {@inheritDoc} |
||
143 | */ |
||
144 | 36 | public function isCompressed(): bool |
|
148 | |||
149 | /** |
||
150 | * Return the public key |
||
151 | * |
||
152 | * @return PublicKey |
||
153 | */ |
||
154 | 55 | public function getPublicKey(): PublicKeyInterface |
|
163 | |||
164 | /** |
||
165 | * @param NetworkInterface $network |
||
166 | * @return string |
||
167 | */ |
||
168 | 3 | public function toWif(NetworkInterface $network = null): string |
|
178 | |||
179 | /** |
||
180 | * @return BufferInterface |
||
181 | */ |
||
182 | 50 | public function getBuffer(): BufferInterface |
|
186 | } |
||
187 |