hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
crypto_model_signer.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_CRYPTO_MODEL_SIGNER_HPP_
7 #define IROHA_CRYPTO_MODEL_SIGNER_HPP_
8 
11 
13 
14 namespace shared_model {
15 
16  namespace crypto {
17  template <typename Algorithm = CryptoSigner<>>
19  : public AbstractCryptoModelSigner<interface::Block> {
20  public:
21  explicit CryptoModelSigner(const shared_model::crypto::Keypair &keypair);
22 
23  virtual ~CryptoModelSigner() = default;
24 
25  template <typename T>
26  inline void sign(T &signable) const noexcept {
27  auto signedBlob = Algorithm::sign(signable.payload(), keypair_);
28  signable.addSignature(signedBlob, keypair_.publicKey());
29  }
30 
31  void sign(interface::Block &m) const override {
32  sign<interface::Block>(m);
33  }
34 
35  private:
37  };
38 
39  template <typename Algorithm>
41  const shared_model::crypto::Keypair &keypair)
42  : keypair_(keypair) {}
43 
44  } // namespace crypto
45 } // namespace shared_model
46 
47 #endif // IROHA_CRYPTO_MODEL_SIGNER_HPP_
Definition: keypair.hpp:19
void sign(T &signable) const noexcept
Definition: crypto_model_signer.hpp:26
sig_t sign(const uint8_t *msg, size_t msgsize, const pubkey_t &pub, const privkey_t &priv)
Definition: ed25519_impl.cpp:16
Definition: block.hpp:15
void sign(interface::Block &m) const override
Definition: crypto_model_signer.hpp:31
Definition: crypto_model_signer.hpp:18
Definition: command_executor.hpp:12
CryptoModelSigner(const shared_model::crypto::Keypair &keypair)
Definition: crypto_model_signer.hpp:40
const PublicKeyType & publicKey() const
Definition: keypair.cpp:13
Definition: abstract_crypto_model_signer.hpp:16