Kagome
Polkadot Runtime Engine in C++17
kagome::crypto::CryptoSuite< PublicKeyT, PrivateKeyT, KeypairT, KeypairAndSeedT, SeedT > Struct Template Referenceabstract

#include <crypto_suites.hpp>

Inheritance diagram for kagome::crypto::CryptoSuite< PublicKeyT, PrivateKeyT, KeypairT, KeypairAndSeedT, SeedT >:
Collaboration diagram for kagome::crypto::CryptoSuite< PublicKeyT, PrivateKeyT, KeypairT, KeypairAndSeedT, SeedT >:

Public Types

using PublicKey = PublicKeyT
 
using PrivateKey = PrivateKeyT
 
using Keypair = KeypairT
 
using KeypairAndSeed = KeypairAndSeedT
 
using Seed = SeedT
 

Public Member Functions

virtual ~CryptoSuite ()=default
 
virtual outcome::result< KeypairgenerateKeypair (const Seed &seed) const noexcept=0
 
virtual outcome::result< KeypairAndSeedgenerateRandomKeypair () const noexcept=0
 
virtual Keypair composeKeypair (PublicKey pub, PrivateKey priv) const noexcept=0
 
virtual std::pair< PublicKey, PrivateKeydecomposeKeypair (const Keypair &kp) const noexcept=0
 
virtual outcome::result< PublicKeytoPublicKey (gsl::span< const uint8_t > bytes) const noexcept=0
 
virtual outcome::result< SeedtoSeed (gsl::span< const uint8_t > bytes) const noexcept=0
 

Detailed Description

template<typename PublicKeyT, typename PrivateKeyT, typename KeypairT, typename KeypairAndSeedT, typename SeedT>
struct kagome::crypto::CryptoSuite< PublicKeyT, PrivateKeyT, KeypairT, KeypairAndSeedT, SeedT >

Combination of several crypto primitives belonging to one algorithm

Definition at line 24 of file crypto_suites.hpp.

Member Typedef Documentation

template<typename PublicKeyT, typename PrivateKeyT, typename KeypairT, typename KeypairAndSeedT, typename SeedT>
using kagome::crypto::CryptoSuite< PublicKeyT, PrivateKeyT, KeypairT, KeypairAndSeedT, SeedT >::Keypair = KeypairT

Definition at line 27 of file crypto_suites.hpp.

template<typename PublicKeyT, typename PrivateKeyT, typename KeypairT, typename KeypairAndSeedT, typename SeedT>
using kagome::crypto::CryptoSuite< PublicKeyT, PrivateKeyT, KeypairT, KeypairAndSeedT, SeedT >::KeypairAndSeed = KeypairAndSeedT

Definition at line 28 of file crypto_suites.hpp.

template<typename PublicKeyT, typename PrivateKeyT, typename KeypairT, typename KeypairAndSeedT, typename SeedT>
using kagome::crypto::CryptoSuite< PublicKeyT, PrivateKeyT, KeypairT, KeypairAndSeedT, SeedT >::PrivateKey = PrivateKeyT

Definition at line 26 of file crypto_suites.hpp.

template<typename PublicKeyT, typename PrivateKeyT, typename KeypairT, typename KeypairAndSeedT, typename SeedT>
using kagome::crypto::CryptoSuite< PublicKeyT, PrivateKeyT, KeypairT, KeypairAndSeedT, SeedT >::PublicKey = PublicKeyT

Definition at line 25 of file crypto_suites.hpp.

template<typename PublicKeyT, typename PrivateKeyT, typename KeypairT, typename KeypairAndSeedT, typename SeedT>
using kagome::crypto::CryptoSuite< PublicKeyT, PrivateKeyT, KeypairT, KeypairAndSeedT, SeedT >::Seed = SeedT

Definition at line 29 of file crypto_suites.hpp.

Constructor & Destructor Documentation

template<typename PublicKeyT, typename PrivateKeyT, typename KeypairT, typename KeypairAndSeedT, typename SeedT>
virtual kagome::crypto::CryptoSuite< PublicKeyT, PrivateKeyT, KeypairT, KeypairAndSeedT, SeedT >::~CryptoSuite ( )
virtualdefault

Member Function Documentation

template<typename PublicKeyT, typename PrivateKeyT, typename KeypairT, typename KeypairAndSeedT, typename SeedT>
virtual Keypair kagome::crypto::CryptoSuite< PublicKeyT, PrivateKeyT, KeypairT, KeypairAndSeedT, SeedT >::composeKeypair ( PublicKey  pub,
PrivateKey  priv 
) const
pure virtualnoexcept

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

Implemented in kagome::crypto::Sr25519Suite, kagome::crypto::Ed25519Suite, and kagome::crypto::EcdsaSuite.

template<typename PublicKeyT, typename PrivateKeyT, typename KeypairT, typename KeypairAndSeedT, typename SeedT>
virtual std::pair<PublicKey, PrivateKey> kagome::crypto::CryptoSuite< PublicKeyT, PrivateKeyT, KeypairT, KeypairAndSeedT, SeedT >::decomposeKeypair ( const Keypair kp) const
pure virtualnoexcept

Extrace the private key and the public key from a keypair

See also
composeKeypair()

Implemented in kagome::crypto::Sr25519Suite, kagome::crypto::Ed25519Suite, and kagome::crypto::EcdsaSuite.

template<typename PublicKeyT, typename PrivateKeyT, typename KeypairT, typename KeypairAndSeedT, typename SeedT>
virtual outcome::result<Keypair> kagome::crypto::CryptoSuite< PublicKeyT, PrivateKeyT, KeypairT, KeypairAndSeedT, SeedT >::generateKeypair ( const Seed seed) const
pure virtualnoexcept

Genereate a keypair from

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

Implemented in kagome::crypto::Sr25519Suite, kagome::crypto::Ed25519Suite, and kagome::crypto::EcdsaSuite.

template<typename PublicKeyT, typename PrivateKeyT, typename KeypairT, typename KeypairAndSeedT, typename SeedT>
virtual outcome::result<KeypairAndSeed> kagome::crypto::CryptoSuite< PublicKeyT, PrivateKeyT, KeypairT, KeypairAndSeedT, SeedT >::generateRandomKeypair ( ) const
pure virtualnoexcept

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

Implemented in kagome::crypto::Sr25519Suite, kagome::crypto::Ed25519Suite, and kagome::crypto::EcdsaSuite.

template<typename PublicKeyT, typename PrivateKeyT, typename KeypairT, typename KeypairAndSeedT, typename SeedT>
virtual outcome::result<PublicKey> kagome::crypto::CryptoSuite< PublicKeyT, PrivateKeyT, KeypairT, KeypairAndSeedT, SeedT >::toPublicKey ( gsl::span< const uint8_t >  bytes) const
pure virtualnoexcept

Create a public key from its bytes

Implemented in kagome::crypto::Sr25519Suite, kagome::crypto::Ed25519Suite, and kagome::crypto::EcdsaSuite.

template<typename PublicKeyT, typename PrivateKeyT, typename KeypairT, typename KeypairAndSeedT, typename SeedT>
virtual outcome::result<Seed> kagome::crypto::CryptoSuite< PublicKeyT, PrivateKeyT, KeypairT, KeypairAndSeedT, SeedT >::toSeed ( gsl::span< const uint8_t >  bytes) const
pure virtualnoexcept

Create a seed from its bytes

Implemented in kagome::crypto::Sr25519Suite, kagome::crypto::Ed25519Suite, and kagome::crypto::EcdsaSuite.


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