A Bitcoin private key.
More...
#include <PrivateKey.h>
|
| PrivateKey (uint8_t const *data, size_t size) |
| The object is constructed from the bytes in the range [begin, end). If the size of the range is not SIZE bytes or the value is not valid, the constructed object is marked as invalid. More...
|
|
| PrivateKey (std::vector< uint8_t > const &k) |
| The object is constructed from the bytes in the given vector. If the size of the vector is not SIZE or the value is not valid, the constructed object is marked as invalid. More...
|
|
| PrivateKey (std::string const &s) |
| The input can be in either the WIF format or the mini-key format. If the format is invalid or the value of the key is invalid, the constructed object is marked as invalid. More...
|
|
void | setCompressed (bool yes=true) |
| Sets the compressed flag.
|
|
std::array< uint8_t, SIZE > | value () const |
| Returns the value as an array of bytes.
|
|
bool | compressed () const |
| Returns the value of the compressed flag.
|
|
bool | valid () const |
| Returns true if this private key is valid.
|
|
std::string | toWif (unsigned version) const |
| Returns a WIF format string. More...
|
|
std::string | toHex () const |
| Returns a hex format string. More...
|
|
|
static size_t const | SIZE = 256 / 8 |
| Number of bytes in a private key.
|
|
A Bitcoin private key.
A Bitcoin PrivateKey is basically an ECC private key, though it can take many forms and encodings.
PrivateKey::PrivateKey |
( |
uint8_t const * |
data, |
|
|
size_t |
size |
|
) |
| |
The object is constructed from the bytes in the range [begin, end). If the size of the range is not SIZE bytes or the value is not valid, the constructed object is marked as invalid.
- Parameters
-
data | pointer to start of the data |
size | length of the data |
PrivateKey::PrivateKey |
( |
std::vector< uint8_t > const & |
k | ) |
|
|
explicit |
The object is constructed from the bytes in the given vector. If the size of the vector is not SIZE or the value is not valid, the constructed object is marked as invalid.
- Parameters
-
PrivateKey::PrivateKey |
( |
std::string const & |
s | ) |
|
|
explicit |
The input can be in either the WIF format or the mini-key format. If the format is invalid or the value of the key is invalid, the constructed object is marked as invalid.
- Parameters
-
s | string form of the private key |
std::string PrivateKey::toHex |
( |
| ) |
const |
Returns a hex format string.
- Returns
- a string containing the private key in hex format, or empty if the object is invalid
std::string PrivateKey::toWif |
( |
unsigned |
version | ) |
const |
Returns a WIF format string.
- Parameters
-
version | version byte to be prepended (typically 0x80) |
- Returns
- a string containing the private key in WIF format, or empty if the object is invalid
The documentation for this class was generated from the following files: