1 | <?php |
||
18 | class PrivateKey extends Key implements PrivateKeyInterface, \Mdanter\Ecc\Crypto\Key\PrivateKeyInterface |
||
19 | { |
||
20 | /** |
||
21 | * @var \GMP |
||
22 | */ |
||
23 | private $secretMultiplier; |
||
24 | |||
25 | /** |
||
26 | * @var bool |
||
27 | */ |
||
28 | private $compressed; |
||
29 | |||
30 | /** |
||
31 | * @var PublicKey |
||
32 | */ |
||
33 | private $publicKey; |
||
34 | |||
35 | /** |
||
36 | * @var EcAdapter |
||
37 | */ |
||
38 | private $ecAdapter; |
||
39 | |||
40 | /** |
||
41 | * @param EcAdapter $ecAdapter |
||
42 | * @param \GMP $int |
||
43 | * @param bool $compressed |
||
44 | * @throws InvalidPrivateKey |
||
45 | 125 | */ |
|
46 | public function __construct(EcAdapter $ecAdapter, \GMP $int, $compressed = false) |
||
60 | |||
61 | /** |
||
62 | * @return \Mdanter\Ecc\Primitives\GeneratorPoint |
||
63 | 112 | */ |
|
64 | public function getPoint() |
||
68 | |||
69 | /** |
||
70 | * @return \GMP |
||
71 | */ |
||
72 | public function getSecret() |
||
76 | |||
77 | /** |
||
78 | * @param \Mdanter\Ecc\Crypto\Key\PublicKeyInterface $recipient |
||
79 | * @return EcDH |
||
80 | */ |
||
81 | public function createExchange(\Mdanter\Ecc\Crypto\Key\PublicKeyInterface $recipient) |
||
88 | 14 | ||
89 | /** |
||
90 | 14 | * @param BufferInterface $msg32 |
|
91 | 14 | * @param RbgInterface|null $rbg |
|
92 | 7 | * @return \BitWasp\Bitcoin\Crypto\EcAdapter\Signature\SignatureInterface |
|
93 | 14 | */ |
|
94 | 7 | public function sign(BufferInterface $msg32, RbgInterface $rbg = null) |
|
98 | 7 | ||
99 | /** |
||
100 | * @param \GMP $tweak |
||
101 | * @return PrivateKeyInterface |
||
102 | */ |
||
103 | public function tweakAdd(\GMP $tweak) |
||
121 | 1 | ||
122 | /** |
||
123 | * @param \GMP $tweak |
||
124 | * @return PrivateKeyInterface |
||
125 | */ |
||
126 | public function tweakMul(\GMP $tweak) |
||
144 | 105 | ||
145 | 105 | /** |
|
146 | 53 | * {@inheritDoc} |
|
147 | 53 | */ |
|
148 | public function isCompressed() |
||
152 | |||
153 | /** |
||
154 | * Return the public key |
||
155 | * |
||
156 | 6 | * @return PublicKey |
|
157 | */ |
||
158 | 6 | public function getPublicKey() |
|
172 | 66 | ||
173 | /** |
||
174 | * @param NetworkInterface $network |
||
175 | * @return string |
||
176 | */ |
||
177 | public function toWif(NetworkInterface $network = null) |
||
187 | |||
188 | /** |
||
189 | * @return \BitWasp\Buffertools\BufferInterface |
||
190 | */ |
||
191 | public function getBuffer() |
||
195 | } |
||
196 |