ledger-core
Public Member Functions | List of all members
ledger::core::Secp256k1Api Class Reference
+ Inheritance diagram for ledger::core::Secp256k1Api:
+ Collaboration diagram for ledger::core::Secp256k1Api:

Public Member Functions

std::vector< uint8_t > computePubKey (const std::vector< uint8_t > &privKey, bool compress) override
 
std::vector< uint8_t > computeUncompressedPubKey (const std::vector< uint8_t > &pubKey) override
 
std::vector< uint8_t > sign (const std::vector< uint8_t > &privKey, const std::vector< uint8_t > &data) override
 
bool verify (const std::vector< uint8_t > &data, const std::vector< uint8_t > &signature, const std::vector< uint8_t > &pubKey) override
 

Additional Inherited Members

- Static Public Member Functions inherited from ledger::core::api::Secp256k1
static std::shared_ptr< Secp256k1createInstance ()
 
static std::shared_ptr< Secp256k1newInstance ()
 

Member Function Documentation

◆ computePubKey()

std::vector< uint8_t > ledger::core::Secp256k1Api::computePubKey ( const std::vector< uint8_t > &  privKey,
bool  compress 
)
overridevirtual

Generates public key from private key.

Parameters
privKey32 byte private key
compressget compressed (35 bytes) or uncompressed (65 bytes)
Returns
public key can be compressed (35 bytes starting with 02 or 03) or un compressed (65 bytes starting with 04)

Implements ledger::core::api::Secp256k1.

◆ computeUncompressedPubKey()

std::vector< uint8_t > ledger::core::Secp256k1Api::computeUncompressedPubKey ( const std::vector< uint8_t > &  pubKey)
overridevirtual

Generates uncompressed public key from compressed public key.

Parameters
pubKey33 byte private key (starting with 02 or 03)
Returns
uncompressed public key (65 bytes starting with 04)

Implements ledger::core::api::Secp256k1.

◆ sign()

std::vector< uint8_t > ledger::core::Secp256k1Api::sign ( const std::vector< uint8_t > &  privKey,
const std::vector< uint8_t > &  data 
)
overridevirtual

Signs message using a given private key.

Parameters
privKey32 bytes private key
data32 bytes message to sign
Returns
32 bytes signed message

Implements ledger::core::api::Secp256k1.

◆ verify()

bool ledger::core::Secp256k1Api::verify ( const std::vector< uint8_t > &  data,
const std::vector< uint8_t > &  signature,
const std::vector< uint8_t > &  pubKey 
)
overridevirtual

Check if message was signed with given signature and public key.

Parameters
data32 bytes signed message
signature32 bytes signature (generated from private key)
oubkey32 bytes public key
Returns
true if message was signed with signature and public key (both issued from same private key)

Implements ledger::core::api::Secp256k1.


The documentation for this class was generated from the following files: