hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
keys_manager_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_KEYS_MANAGER_IMPL_HPP
7 #define IROHA_KEYS_MANAGER_IMPL_HPP
8 
10 
11 #include <boost/filesystem.hpp>
12 #include <boost/optional.hpp>
13 #include "cryptography/keypair.hpp"
14 #include "logger/logger.hpp"
15 
16 namespace iroha {
17 
18  class KeysManagerImpl : public KeysManager {
19  public:
27  KeysManagerImpl(const std::string &account_id,
28  const boost::filesystem::path &path_to_keypair,
29  logger::Logger log = logger::log("KeysManagerImpl"));
30 
36  KeysManagerImpl(const std::string account_id,
37  logger::Logger log = logger::log("KeysManagerImpl"));
38 
39  bool createKeys() override;
40 
41  bool createKeys(const std::string &pass_phrase) override;
42 
43  boost::optional<shared_model::crypto::Keypair> loadKeys() override;
44 
45  boost::optional<shared_model::crypto::Keypair> loadKeys(
46  const std::string &pass_phrase) override;
47 
50 
51  private:
57  bool validate(const shared_model::crypto::Keypair &keypair) const;
58 
64  boost::optional<std::string> loadFile(
65  const boost::filesystem::path &path) const;
66 
73  bool store(const std::string &pub, const std::string &priv);
74 
75  boost::filesystem::path path_to_keypair_;
76  std::string account_id_;
77  logger::Logger log_;
78  };
79 } // namespace iroha
80 #endif // IROHA_KEYS_MANAGER_IMPL_HPP
Definition: keys_manager.hpp:18
Definition: keypair.hpp:19
bool createKeys() override
Definition: keys_manager_impl.cpp:115
string(REPLACE".""/"CMAKE_SWIG_OUTDIR ${SWIG_JAVA_PKG}) else() set(CMAKE_SWIG_FLAGS"") endif() myswig_add_library(irohajava LANGUAGE java SOURCES bindings.i) unset(CMAKE_SWIG_FLAGS) swig_link_libraries(irohajava $
Definition: CMakeLists.txt:54
boost::optional< shared_model::crypto::Keypair > loadKeys() override
Definition: keys_manager_impl.cpp:92
Definition: keys_manager_impl.hpp:18
std::shared_ptr< spdlog::logger > Logger
Definition: logger.hpp:26
static const std::string kPublicKeyExtension
Definition: keys_manager_impl.hpp:48
Definition: block_query.hpp:16
Logger log(const std::string &tag)
Definition: logger.cpp:48
static const std::string kPrivateKeyExtension
Definition: keys_manager_impl.hpp:49
KeysManagerImpl(const std::string &account_id, const boost::filesystem::path &path_to_keypair, logger::Logger log=logger::log("KeysManagerImpl"))
Definition: keys_manager_impl.cpp:45