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 
62  static Keypair generateKeypair(const PrivateKey &key);
63 
64  // Ursa provides functions for retrieving key lengths, but we use
65  // hardcoded values
66  static constexpr size_t kHashLength = 256 / 8;
67  static constexpr size_t kPublicKeyLength = 256 / 8;
68  static constexpr size_t kPrivateKeyLength = 512 / 8;
69  static constexpr size_t kSignatureLength = 512 / 8;
70  };
71  } // namespace crypto
72 } // namespace shared_model
73 
74 #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
Definition: private_key.hpp:16
static constexpr size_t kPrivateKeyLength
Definition: crypto_provider.hpp:68
Definition: seed.hpp:16
static constexpr size_t kPublicKeyLength
Definition: crypto_provider.hpp:67
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:66
static constexpr size_t kSignatureLength
Definition: crypto_provider.hpp:69
std::basic_string_view< std::byte > ByteRange
Definition: byte_range.hpp:16