hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
crypto_provider.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_URSA_CRYPTOPROVIDER_HPP
7 #define IROHA_URSA_CRYPTOPROVIDER_HPP
8 
9 #if !defined(USE_LIBURSA)
10 #error USE_LIBURSA must be defined
11 #endif
12 
13 #include "cryptography/keypair.hpp"
15 #include "cryptography/seed.hpp"
17 
18 namespace shared_model {
19  namespace crypto {
24  public:
31  static std::string sign(const Blob &blob, const Keypair &keypair);
32 
40  static bool verify(shared_model::interface::types::ByteRange signed_data,
43 
48  static Keypair generateKeypair();
49 
55  static Keypair generateKeypair(const Seed &seed);
56 
57  // Ursa provides functions for retrieving key lengths, but we use
58  // hardcoded values
59  static constexpr size_t kHashLength = 256 / 8;
60  static constexpr size_t kPublicKeyLength = 256 / 8;
61  static constexpr size_t kPrivateKeyLength = 512 / 8;
62  static constexpr size_t kSignatureLength = 512 / 8;
63  };
64  } // namespace crypto
65 } // namespace shared_model
66 
67 #endif // IROHA_URSA_CRYPTOPROVIDER_HPP
static bool verify(shared_model::interface::types::ByteRange signed_data, shared_model::interface::types::ByteRange source, shared_model::interface::types::ByteRange public_key)
Definition: crypto_provider.cpp:57
Definition: blob.hpp:27
static Keypair generateKeypair()
Definition: crypto_provider.cpp:75
Definition: keypair.hpp:19
static constexpr size_t kPrivateKeyLength
Definition: crypto_provider.hpp:61
Definition: seed.hpp:16
static constexpr size_t kPublicKeyLength
Definition: crypto_provider.hpp:60
Definition: crypto_provider.hpp:23
static std::string sign(const Blob &blob, const Keypair &keypair)
Definition: crypto_provider.cpp:31
Definition: command_executor.hpp:12
static constexpr size_t kHashLength
Definition: crypto_provider.hpp:59
static constexpr size_t kSignatureLength
Definition: crypto_provider.hpp:62
std::basic_string_view< std::byte > ByteRange
Definition: byte_range.hpp:16