#include <boost/test/included/unit_test.hpp>
#include <fc/crypto/public_key.hpp>
#include <fc/crypto/private_key.hpp>
#include <fc/crypto/signature.hpp>
#include <fc/utility.hpp>
Go to the source code of this file.
◆ BOOST_TEST_MODULE
#define BOOST_TEST_MODULE cypher_suites |
◆ BOOST_AUTO_TEST_CASE() [1/6]
BOOST_AUTO_TEST_CASE |
( |
test_k1 | | ) |
|
Definition at line 13 of file test_cypher_suites.cpp.
13 {
14 auto private_key_string = std::string("5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3");
15 auto expected_public_key = std::string(
"SYS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV");
16 auto test_private_key =
private_key(private_key_string);
17 auto test_public_key = test_private_key.get_public_key();
18
19 BOOST_CHECK_EQUAL(private_key_string, test_private_key.to_string());
const uint8_t expected_public_key[]
◆ BOOST_AUTO_TEST_CASE() [2/6]
BOOST_AUTO_TEST_CASE |
( |
test_k1_recovery | | ) |
|
Definition at line 33 of file test_cypher_suites.cpp.
33 {
34 auto payload = "Test Cases";
37 auto pub = key.get_public_key();
38 auto sig = key.sign(
digest);
39
41 std::cout << recovered_pub << std::endl;
42
43 BOOST_CHECK_EQUAL(recovered_pub.to_string(),
pub.to_string());
static private_key generate()
static sha256 hash(const char *d, uint32_t dlen)
fc::sha256 digest(const T &value)
constexpr size_t const_strlen(const char *str)
◆ BOOST_AUTO_TEST_CASE() [3/6]
BOOST_AUTO_TEST_CASE |
( |
test_k1_recyle | | ) |
|
Definition at line 59 of file test_cypher_suites.cpp.
59 {
61 auto pub = key.get_public_key();
62 auto pub_str =
pub.to_string();
64
65 std::cout <<
pub <<
" -> " << recycled_pub << std::endl;
66
67 BOOST_CHECK_EQUAL(
pub.to_string(), recycled_pub.to_string());
◆ BOOST_AUTO_TEST_CASE() [4/6]
BOOST_AUTO_TEST_CASE |
( |
test_r1 | | ) |
|
Definition at line 23 of file test_cypher_suites.cpp.
23 {
24 auto private_key_string = std::string("PVT_R1_iyQmnyPEGvFd8uffnk152WC2WryBjgTrg22fXQryuGL9mU6qW");
25 auto expected_public_key = std::string(
"PUB_R1_6EPHFSKVYHBjQgxVGQPrwCxTg7BbZ69H9i4gztN9deKTEXYne4");
26 auto test_private_key =
private_key(private_key_string);
27 auto test_public_key = test_private_key.get_public_key();
28
29 BOOST_CHECK_EQUAL(private_key_string, test_private_key.to_string());
◆ BOOST_AUTO_TEST_CASE() [5/6]
BOOST_AUTO_TEST_CASE |
( |
test_r1_recovery | | ) |
|
Definition at line 46 of file test_cypher_suites.cpp.
46 {
47 auto payload = "Test Cases";
50 auto pub = key.get_public_key();
51 auto sig = key.sign(
digest);
52
54 std::cout << recovered_pub << std::endl;
55
56 BOOST_CHECK_EQUAL(recovered_pub.to_string(),
pub.to_string());
◆ BOOST_AUTO_TEST_CASE() [6/6]
BOOST_AUTO_TEST_CASE |
( |
test_r1_recyle | | ) |
|
Definition at line 70 of file test_cypher_suites.cpp.
70 {
72 auto pub = key.get_public_key();
73 auto pub_str =
pub.to_string();
75
76 std::cout <<
pub <<
" -> " << recycled_pub << std::endl;
77
78 BOOST_CHECK_EQUAL(
pub.to_string(), recycled_pub.to_string());
◆ FC_LOG_AND_RETHROW()