Skip to content
Snippets Groups Projects

Add signature providers

Merged Mateusz Tyszczak requested to merge tm-sign-ext into develop
Compare and Show latest version
1 file
+ 27
19
Compare changes
  • Side-by-side
  • Inline
+ 27
19
@@ -271,34 +271,42 @@ private_key_data foundation::cpp_generate_private_key(const std::string& account
std::string foundation::cpp_convert_raw_private_key_to_wif(const std::string& hexData)
{
FC_ASSERT(hexData.size() == 64 && "Expected hex string pointing 32 byte buffer");
return cpp::safe_exception_wrapper(
[&]() -> std::string {
FC_ASSERT(hexData.size() == 64 && "Expected hex string pointing 32 byte buffer");
fc::sha256 sharedSecret(hexData);
fc::sha256 sharedSecret(hexData);
return fc::ecc::private_key::regenerate(sharedSecret).key_to_wif();
return fc::ecc::private_key::regenerate(sharedSecret).key_to_wif();
}
);
}
std::string foundation::cpp_convert_raw_public_key_to_wif(const std::string& hexData)
{
if(hexData.size() == 2 * sizeof(fc::ecc::public_key_data))
{
/// compressed form
fc::ecc::public_key_data keyData;
detail::convert_from_hex(hexData, keyData);
return cpp::safe_exception_wrapper(
[&]() -> std::string {
if(hexData.size() == 2 * sizeof(fc::ecc::public_key_data))
{
/// compressed form
fc::ecc::public_key_data keyData;
detail::convert_from_hex(hexData, keyData);
return fc::ecc::public_key::to_base58_with_prefix(keyData, HIVE_ADDRESS_PREFIX);
return fc::ecc::public_key::to_base58_with_prefix(keyData, HIVE_ADDRESS_PREFIX);
}
else
{
FC_ASSERT(hexData.size() == 2 * sizeof(fc::ecc::public_key_point_data), "Invalid size of raw public key buffer: ${s}", ("s", (hexData.size())));
/// uncompressed form
fc::ecc::public_key_point_data keyData;
detail::convert_from_hex(hexData, keyData);
}
else
{
FC_ASSERT(hexData.size() == 2 * sizeof(fc::ecc::public_key_point_data), "Invalid size of raw public key buffer: ${s}", ("s", (hexData.size())));
/// uncompressed form
fc::ecc::public_key_point_data keyData;
detail::convert_from_hex(hexData, keyData);
fc::ecc::public_key key(keyData);
return key.to_base58_with_prefix(HIVE_ADDRESS_PREFIX);
}
fc::ecc::public_key key(keyData);
return key.to_base58_with_prefix(HIVE_ADDRESS_PREFIX);
}
}
);
}
brain_key_data foundation::cpp_suggest_brain_key()
Loading