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 | */ |
||
46 | 125 | public function __construct(EcAdapter $ecAdapter, \GMP $int, $compressed = false) |
|
60 | |||
61 | /** |
||
62 | * @return \Mdanter\Ecc\Primitives\GeneratorPoint |
||
63 | */ |
||
64 | 46 | public function getPoint() |
|
68 | |||
69 | /** |
||
70 | * @return \GMP |
||
71 | */ |
||
72 | 112 | 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 | |||
89 | /** |
||
90 | * @param BufferInterface $msg32 |
||
91 | * @param RbgInterface|null $rbg |
||
92 | * @return \BitWasp\Bitcoin\Crypto\EcAdapter\Signature\SignatureInterface |
||
93 | */ |
||
94 | public function sign(BufferInterface $msg32, RbgInterface $rbg = null) |
||
98 | |||
99 | /** |
||
100 | * @param \GMP $tweak |
||
101 | * @return PrivateKeyInterface |
||
102 | */ |
||
103 | 14 | public function tweakAdd(\GMP $tweak) |
|
121 | |||
122 | /** |
||
123 | * @param \GMP $tweak |
||
124 | * @return PrivateKeyInterface |
||
125 | */ |
||
126 | 2 | public function tweakMul(\GMP $tweak) |
|
144 | |||
145 | /** |
||
146 | * {@inheritDoc} |
||
147 | */ |
||
148 | 66 | public function isCompressed() |
|
152 | |||
153 | /** |
||
154 | * Return the public key |
||
155 | * |
||
156 | * @return PublicKey |
||
157 | */ |
||
158 | 129 | public function getPublicKey() |
|
172 | |||
173 | /** |
||
174 | * @param NetworkInterface $network |
||
175 | * @return string |
||
176 | */ |
||
177 | 6 | public function toWif(NetworkInterface $network = null) |
|
187 | |||
188 | /** |
||
189 | * @return \BitWasp\Buffertools\BufferInterface |
||
190 | */ |
||
191 | 66 | public function getBuffer() |
|
195 | } |
||
196 |