Kagome
Polkadot Runtime Engine in C++17
kagome::crypto::EcdsaSuite Class Reference

#include <crypto_suites.hpp>

Inheritance diagram for kagome::crypto::EcdsaSuite:
Collaboration diagram for kagome::crypto::EcdsaSuite:

Public Member Functions

 EcdsaSuite (std::shared_ptr< EcdsaProvider > ecdsa_provider)
 
 ~EcdsaSuite () override=default
 
outcome::result< EcdsaKeypairAndSeedgenerateRandomKeypair () const noexceptoverride
 
outcome::result< EcdsaKeypairgenerateKeypair (const EcdsaSeed &seed) const noexceptoverride
 
EcdsaKeypair composeKeypair (PublicKey pub, PrivateKey priv) const noexceptoverride
 
std::pair< PublicKey, PrivateKeydecomposeKeypair (const EcdsaKeypair &kp) const noexceptoverride
 
outcome::result< PublicKeytoPublicKey (gsl::span< const uint8_t > bytes) const noexceptoverride
 
outcome::result< SeedtoSeed (gsl::span< const uint8_t > bytes) const noexceptoverride
 
- Public Member Functions inherited from kagome::crypto::CryptoSuite< EcdsaPublicKey, EcdsaPrivateKey, EcdsaKeypair, EcdsaKeypairAndSeed, EcdsaSeed >
virtual ~CryptoSuite ()=default
 

Private Attributes

std::shared_ptr< EcdsaProviderecdsa_provider_
 

Additional Inherited Members

- Public Types inherited from kagome::crypto::CryptoSuite< EcdsaPublicKey, EcdsaPrivateKey, EcdsaKeypair, EcdsaKeypairAndSeed, EcdsaSeed >
using PublicKey = EcdsaPublicKey
 
using PrivateKey = EcdsaPrivateKey
 
using Keypair = EcdsaKeypair
 
using KeypairAndSeed = EcdsaKeypairAndSeed
 
using Seed = EcdsaSeed
 

Detailed Description

Definition at line 75 of file crypto_suites.hpp.

Constructor & Destructor Documentation

kagome::crypto::EcdsaSuite::EcdsaSuite ( std::shared_ptr< EcdsaProvider ecdsa_provider)
inlineexplicit

Definition at line 81 of file crypto_suites.hpp.

kagome::crypto::EcdsaSuite::~EcdsaSuite ( )
overridedefault

Member Function Documentation

EcdsaKeypair kagome::crypto::EcdsaSuite::composeKeypair ( PublicKey  pub,
PrivateKey  priv 
) const
inlineoverridevirtualnoexcept

Create a keypair from a public key and a private key

Note
Although it is typically just a structure with two fields, from the compiler point of view they all are different types, thus this convenience method emerges

Implements kagome::crypto::CryptoSuite< EcdsaPublicKey, EcdsaPrivateKey, EcdsaKeypair, EcdsaKeypairAndSeed, EcdsaSeed >.

Definition at line 99 of file crypto_suites.hpp.

std::pair<PublicKey, PrivateKey> kagome::crypto::EcdsaSuite::decomposeKeypair ( const EcdsaKeypair kp) const
inlineoverridevirtualnoexcept

Extrace the private key and the public key from a keypair

See also
composeKeypair()

Implements kagome::crypto::CryptoSuite< EcdsaPublicKey, EcdsaPrivateKey, EcdsaKeypair, EcdsaKeypairAndSeed, EcdsaSeed >.

Definition at line 105 of file crypto_suites.hpp.

outcome::result<EcdsaKeypair> kagome::crypto::EcdsaSuite::generateKeypair ( const EcdsaSeed seed) const
inlineoverridevirtualnoexcept

Genereate a keypair from

Parameters
seed(mind that in some algorithms a seed is a private key)

Implements kagome::crypto::CryptoSuite< EcdsaPublicKey, EcdsaPrivateKey, EcdsaKeypair, EcdsaKeypairAndSeed, EcdsaSeed >.

Definition at line 93 of file crypto_suites.hpp.

outcome::result<EcdsaKeypairAndSeed> kagome::crypto::EcdsaSuite::generateRandomKeypair ( ) const
inlineoverridevirtualnoexcept

Generate a random keypair (randomness source is determined by an underlying crypto provider)

Implements kagome::crypto::CryptoSuite< EcdsaPublicKey, EcdsaPrivateKey, EcdsaKeypair, EcdsaKeypairAndSeed, EcdsaSeed >.

Definition at line 88 of file crypto_suites.hpp.

outcome::result<PublicKey> kagome::crypto::EcdsaSuite::toPublicKey ( gsl::span< const uint8_t >  bytes) const
inlineoverridevirtualnoexcept
outcome::result<Seed> kagome::crypto::EcdsaSuite::toSeed ( gsl::span< const uint8_t >  bytes) const
inlineoverridevirtualnoexcept

Member Data Documentation

std::shared_ptr<EcdsaProvider> kagome::crypto::EcdsaSuite::ecdsa_provider_
private

Definition at line 122 of file crypto_suites.hpp.


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