Fixed BLS signature

y
parent 8f26d497
...@@ -102,6 +102,10 @@ bool sign(const char* _encryptedKeyHex, const char* _hashHex, size_t _t, size_t ...@@ -102,6 +102,10 @@ bool sign(const char* _encryptedKeyHex, const char* _hashHex, size_t _t, size_t
auto sigShare = keyShare->signWithHelperSGX(hash, _signerIndex); auto sigShare = keyShare->signWithHelperSGX(hash, _signerIndex);
auto sigShareStr = sigShare->toString();
strncpy(_sig, sigShareStr->c_str(), BUF_LEN);
return true; return true;
} }
......
...@@ -184,8 +184,6 @@ std::shared_ptr<BLSSigShare> BLSPrivateKeyShareSGX::signWithHelperSGX( ...@@ -184,8 +184,6 @@ std::shared_ptr<BLSSigShare> BLSPrivateKeyShareSGX::signWithHelperSGX(
} }
cerr << "Signature is:" << signature << endl;
std::string hint = BLSutils::ConvertToString(hash_with_hint.first.Y) + ":" + std::string hint = BLSutils::ConvertToString(hash_with_hint.first.Y) + ":" +
...@@ -193,6 +191,9 @@ std::shared_ptr<BLSSigShare> BLSPrivateKeyShareSGX::signWithHelperSGX( ...@@ -193,6 +191,9 @@ std::shared_ptr<BLSSigShare> BLSPrivateKeyShareSGX::signWithHelperSGX(
auto sig = make_shared<string>(signature); auto sig = make_shared<string>(signature);
sig->append(":");
sig->append(hint);
auto s = make_shared<BLSSigShare>(sig, _signerIndex, requiredSigners, auto s = make_shared<BLSSigShare>(sig, _signerIndex, requiredSigners,
totalSigners); totalSigners);
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#define SGXWALLET_BLSPRIVATEKEYSHARESGX_H #define SGXWALLET_BLSPRIVATEKEYSHARESGX_H
#define SGXWALLET_BLSPRIVATEKEYSHARESGX_H #define SGXWALLET_BLSPRIVATEKEYSHARESGX_H
#include "BLSSigShare.h"
#include "BLSPrivateKeyShare.h" #include "BLSPrivateKeyShare.h"
class BLSPrivateKeyShareSGX { class BLSPrivateKeyShareSGX {
......
...@@ -197,10 +197,16 @@ TEST_CASE("BLS sign test", "[bls-sign]") { ...@@ -197,10 +197,16 @@ TEST_CASE("BLS sign test", "[bls-sign]") {
strncpy(hexHashBuf, hexHash, BUF_LEN); strncpy(hexHashBuf, hexHash, BUF_LEN);
char sig[BUF_LEN]; char sig[BUF_LEN];
REQUIRE(sign(encryptedKeyHex, hexHashBuf, 2, 2, 1, sig)); REQUIRE(sign(encryptedKeyHex, hexHashBuf, 2, 2, 1, sig));
printf("Signature is: %s \n", sig );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment