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

#include <ed25519_provider_impl.hpp>

Inheritance diagram for kagome::crypto::Ed25519ProviderImpl:
Collaboration diagram for kagome::crypto::Ed25519ProviderImpl:

Public Types

enum  Error { Error::VERIFICATION_FAILED = 1, Error::SIGN_FAILED }
 

Public Member Functions

 Ed25519ProviderImpl (std::shared_ptr< CSPRNG > generator)
 
Ed25519KeypairAndSeed generateKeypair () const override
 
Ed25519Keypair generateKeypair (const Ed25519Seed &seed) const override
 generates key pair by seed More...
 
outcome::result< Ed25519Signature > sign (const Ed25519Keypair &keypair, gsl::span< const uint8_t > message) const override
 
outcome::result< bool > verify (const Ed25519Signature &signature, gsl::span< const uint8_t > message, const Ed25519PublicKey &public_key) const override
 
- Public Member Functions inherited from kagome::crypto::Ed25519Provider
virtual ~Ed25519Provider ()=default
 

Private Attributes

std::shared_ptr< CSPRNGgenerator_
 
log::Logger logger_
 

Detailed Description

Definition at line 16 of file ed25519_provider_impl.hpp.

Member Enumeration Documentation

Enumerator
VERIFICATION_FAILED 
SIGN_FAILED 

Definition at line 18 of file ed25519_provider_impl.hpp.

Constructor & Destructor Documentation

kagome::crypto::Ed25519ProviderImpl::Ed25519ProviderImpl ( std::shared_ptr< CSPRNG generator)
explicit

Definition at line 27 of file ed25519_provider_impl.cpp.

Member Function Documentation

Ed25519KeypairAndSeed kagome::crypto::Ed25519ProviderImpl::generateKeypair ( ) const
overridevirtual

Generates random keypair for signing the message

Returns
ed25519 key pair if succeeded of error if failed

Implements kagome::crypto::Ed25519Provider.

Definition at line 33 of file ed25519_provider_impl.cpp.

Ed25519Keypair kagome::crypto::Ed25519ProviderImpl::generateKeypair ( const Ed25519Seed &  seed) const
overridevirtual

generates key pair by seed

Parameters
seedseed value
Returns
ed25519 key pair

Implements kagome::crypto::Ed25519Provider.

Definition at line 39 of file ed25519_provider_impl.cpp.

outcome::result< Ed25519Signature > kagome::crypto::Ed25519ProviderImpl::sign ( const Ed25519Keypair keypair,
gsl::span< const uint8_t >  message 
) const
overridevirtual

Sign message

Parameters
msgusing
keypair.If computed value is less than
thresholdthen return optional containing this value and proof. Otherwise none returned
keypairpair of public and private ed25519 keys
messagebytes to be signed
Returns
signed message

Implements kagome::crypto::Ed25519Provider.

Definition at line 52 of file ed25519_provider_impl.cpp.

outcome::result< bool > kagome::crypto::Ed25519ProviderImpl::verify ( const Ed25519Signature &  signature,
gsl::span< const uint8_t >  message,
const Ed25519PublicKey &  public_key 
) const
overridevirtual

Verifies that

Parameters
messagewas derived using
public_keyon
signature

Implements kagome::crypto::Ed25519Provider.

Definition at line 70 of file ed25519_provider_impl.cpp.

Member Data Documentation

std::shared_ptr<CSPRNG> kagome::crypto::Ed25519ProviderImpl::generator_
private

Definition at line 36 of file ed25519_provider_impl.hpp.

log::Logger kagome::crypto::Ed25519ProviderImpl::logger_
private

Definition at line 37 of file ed25519_provider_impl.hpp.


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