Skip to content

Commit

Permalink
check if public key string and signature string are invlid in conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
linh2931 committed Sep 7, 2023
1 parent e0a9901 commit 2132734
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libraries/libfc/src/crypto/bls_public_key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace fc::crypto::blslib {

std::array<uint8_t, 96> bytes = fc::crypto::blslib::deserialize_base64<std::array<uint8_t, 96>>(data_str);

constexpr bool check = false; // default
constexpr bool check = true; // check if base64str is invalid
constexpr bool raw = true;
std::optional<bls12_381::g1> g1 = bls12_381::g1::fromAffineBytesLE(bytes, check, raw);
FC_ASSERT(g1);
Expand Down
2 changes: 1 addition & 1 deletion libraries/libfc/src/crypto/bls_signature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace fc::crypto::blslib {

std::array<uint8_t, 192> bytes = fc::crypto::blslib::deserialize_base64<std::array<uint8_t, 192>>(data_str);

constexpr bool check = false; // default
constexpr bool check = true; // check if base64str is invalid
constexpr bool raw = true;
std::optional<bls12_381::g2> g2 = bls12_381::g2::fromAffineBytesLE(bytes, check, raw);
FC_ASSERT(g2);
Expand Down

0 comments on commit 2132734

Please sign in to comment.