hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
iroha::KeysManagerImpl Class Reference

#include "keys_manager_impl.hpp"

Inheritance diagram for iroha::KeysManagerImpl:
Inheritance graph
Collaboration diagram for iroha::KeysManagerImpl:
Collaboration graph

Public Member Functions

 KeysManagerImpl (const std::string &account_id, const boost::filesystem::path &path_to_keypair, logger::LoggerPtr log)
 
 KeysManagerImpl (const std::string account_id, logger::LoggerPtr log)
 
bool createKeys (const boost::optional< std::string > &pass_phrase) override
 
iroha::expected::Result< shared_model::crypto::Keypair, std::string > loadKeys (const boost::optional< std::string > &pass_phrase) override
 
- Public Member Functions inherited from iroha::KeysManager
virtual ~KeysManager ()=default
 

Static Public Attributes

static const std::string kPublicKeyExtension = ".pub"
 
static const std::string kPrivateKeyExtension = ".priv"
 

Constructor & Destructor Documentation

◆ KeysManagerImpl() [1/2]

iroha::KeysManagerImpl::KeysManagerImpl ( const std::string &  account_id,
const boost::filesystem::path &  path_to_keypair,
logger::LoggerPtr  log 
)

Initialize key manager for a specific account

Parameters
account_id- fully qualified account id, e.g. admin
Test:
Parameters
path_to_keypair- path to directory that contains priv and pub key of an account
logto print progress

◆ KeysManagerImpl() [2/2]

iroha::KeysManagerImpl::KeysManagerImpl ( const std::string  account_id,
logger::LoggerPtr  log 
)

Initialize key manager for a specific account

Parameters
account_id- fully qualified account id, e.g. admin
Test:
Parameters
logto print progress

Here we use an empty string as a default value of path to file, since there are usages of KeysManagerImpl with path passed as a part of account_id.

Member Function Documentation

◆ createKeys()

bool iroha::KeysManagerImpl::createKeys ( const boost::optional< std::string > &  pass_phrase)
overridevirtual

Create keys of a new keypair and store them on disk. If pass phrase is provided, the private key is encrypted.

Parameters
pass_phrase(optional) used for private key encryption
Returns
false if keys creation failed

Implements iroha::KeysManager.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadKeys()

iroha::expected::Result< Keypair, std::string > iroha::KeysManagerImpl::loadKeys ( const boost::optional< std::string > &  pass_phrase)
overridevirtual

Load keys associated with the manager, then validate loaded keypair by signing and verifying the signature of a test message.

Parameters
pass_phrase(optional) is used to decrypt the private key
Returns
error if no keypair found locally, or in case of verification failure. Otherwise - the keypair will be returned

Implements iroha::KeysManager.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ kPrivateKeyExtension

const std::string iroha::KeysManagerImpl::kPrivateKeyExtension = ".priv"
static

◆ kPublicKeyExtension

const std::string iroha::KeysManagerImpl::kPublicKeyExtension = ".pub"
static

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