Equity
Bitcoin Protocol Library
|
ECC library. More...
Typedefs | |
typedef std::vector< uint8_t > | PublicKey |
An ECC public key. | |
typedef std::array< uint8_t, PRIVATE_KEY_SIZE > | PrivateKey |
An ECC private key. | |
typedef std::vector< uint8_t > | Signature |
An ECC signature. | |
Functions | |
bool | publicKeyIsValid (uint8_t const *k, size_t size) |
Returns true if the public key is valid. More... | |
bool | publicKeyIsValid (PublicKey const &k) |
Returns true if the public key is valid. More... | |
bool | privateKeyIsValid (uint8_t const *k, size_t size) |
Returns true if the private key is valid. More... | |
bool | privateKeyIsValid (PrivateKey const &k) |
Returns true if the private key is valid. More... | |
bool | derivePublicKey (PrivateKey const &prvKey, PublicKey &pubKey, bool uncompressed=false) |
Derives a public key from a private key. More... | |
bool | sign (uint8_t const *message, size_t size, PrivateKey const &prvKey, PublicKey const &pubKey, Signature &signature) |
Signs a message. More... | |
bool | verify (uint8_t const *message, size_t size, PublicKey const &pubKey, Signature const &signature) |
Verifies a signed message. More... | |
Variables | |
size_t const | COMPRESSED_PUBLIC_KEY_SIZE = 33 |
Size of a compressed public key. | |
size_t const | UNCOMPRESSED_PUBLIC_KEY_SIZE = 65 |
Size of an uncompressed public key. | |
size_t const | PRIVATE_KEY_SIZE = 256 / 8 |
Size of a private key. | |
ECC library.
bool Crypto::Ecc::derivePublicKey | ( | PrivateKey const & | prvKey, |
PublicKey & | pubKey, | ||
bool | uncompressed = false |
||
) |
Derives a public key from a private key.
prvKey | private key | |
[out] | pubKey | derived public key |
uncompressed | if true, then the resulting public key is uncompressed (default: false) |
bool Crypto::Ecc::privateKeyIsValid | ( | uint8_t const * | k, |
size_t | size | ||
) |
Returns true if the private key is valid.
k | key |
size | size of key |
|
inline |
Returns true if the private key is valid.
k | key |
|
inline |
Returns true if the public key is valid.
k | key |
size | size of key |
|
inline |
Returns true if the public key is valid.
k | key |
bool Crypto::Ecc::sign | ( | uint8_t const * | message, |
size_t | size, | ||
PrivateKey const & | prvKey, | ||
PublicKey const & | pubKey, | ||
Signature & | signature | ||
) |
Signs a message.
message | message to sign | |
size | size of the message | |
prvKey | private key | |
pubKey | public key | |
[out] | signature | signature |
bool Crypto::Ecc::verify | ( | uint8_t const * | message, |
size_t | size, | ||
PublicKey const & | pubKey, | ||
Signature const & | signature | ||
) |
Verifies a signed message.
message | message to sign |
size | size of the message |
pubKey | public key |
signature | signature |
message | signed message |
size | size of the message |
pubKey | public key |
signature | signature to verify |