Unverified Commit 5c046c72 authored by Sveta Rogova's avatar Sveta Rogova Committed by GitHub

Merge pull request #13 from skalenetwork/enhancement/SKALE-1775-Dependenices-Build-Improvment

Enhancement/skale 1775 dependenices build improvment
parents 135b9154 edc8247f
...@@ -39,6 +39,23 @@ std::vector<std::string> SplitString(const char* koefs, const char symbol){ ...@@ -39,6 +39,23 @@ std::vector<std::string> SplitString(const char* koefs, const char symbol){
return G2_strings; return G2_strings;
} }
template<class T>
std::string ConvertToString(T field_elem, int base = 10) {
mpz_t t;
mpz_init(t);
field_elem.as_bigint().to_mpz(t);
char arr[mpz_sizeinbase (t, base) + 2];
char * tmp = mpz_get_str(arr, base, t);
mpz_clear(t);
std::string output = tmp;
return output;
}
std::string gen_dkg_poly( int _t){ std::string gen_dkg_poly( int _t){
char *errMsg = (char *)calloc(1024, 1); char *errMsg = (char *)calloc(1024, 1);
int err_status = 0; int err_status = 0;
...@@ -207,7 +224,7 @@ bool VerifyShares(const char* publicShares, const char* encr_sshare, const char ...@@ -207,7 +224,7 @@ bool VerifyShares(const char* publicShares, const char* encr_sshare, const char
} }
bool CreateBLSShare( const std::string& BLSKeyName, const char * s_shares, const char * encryptedKeyHex){ bool CreateBLSShare( const std::string& BLSKeyName, const char * s_shares, const char * encryptedKeyHex){
std::cerr << "ENTER CreateBLSShare" << std::endl;
char* errMsg1 = (char*) calloc(1024,1); char* errMsg1 = (char*) calloc(1024,1);
int err_status = 0; int err_status = 0;
...@@ -215,22 +232,24 @@ bool CreateBLSShare( const std::string& BLSKeyName, const char * s_shares, const ...@@ -215,22 +232,24 @@ bool CreateBLSShare( const std::string& BLSKeyName, const char * s_shares, const
uint8_t encr_bls_key[BUF_LEN]; uint8_t encr_bls_key[BUF_LEN];
uint8_t encr_key[BUF_LEN]; uint8_t encr_key[BUF_LEN];
if (!hex2carray(encryptedKeyHex, &dec_key_len, encr_key)){ if (!hex2carray(encryptedKeyHex, &dec_key_len, encr_key)){
throw RPCException(INVALID_HEX, "Invalid encryptedPolyHex"); throw RPCException(INVALID_HEX, "Invalid encryptedKeyHex");
} }
uint32_t enc_bls_len = 0; uint32_t enc_bls_len = 0;
create_bls_key(eid, &err_status, errMsg1, s_shares, encr_key, dec_key_len, encr_bls_key, &enc_bls_len); create_bls_key(eid, &err_status, errMsg1, s_shares, encr_key, dec_key_len, encr_bls_key, &enc_bls_len);
std::cerr << "er msg is " << errMsg1 << std::endl; std::cerr << "AFTER create_bls_key IN ENCLAVE er msg is " << errMsg1 << std::endl;
if ( err_status != 0){ if ( err_status != 0){
std::cerr << "ERROR IN ENCLAVE" << std::endl;
return false; return false;
} }
else { else {
char *hexBLSKey = (char *) calloc(2 * BUF_LEN, 1); char *hexBLSKey = (char *) calloc(2 * BUF_LEN, 1);
std::cerr << "BEFORE carray2Hex" << std::endl;
std::cerr << "enc_bls_len " << enc_bls_len << std::endl; //std::cerr << "enc_bls_len " << enc_bls_len << std::endl;
carray2Hex(encr_bls_key, enc_bls_len, hexBLSKey); carray2Hex(encr_bls_key, enc_bls_len, hexBLSKey);
std::cerr << "BEFORE WRITE BLS KEY TO DB" << std::endl;
writeDataToDB(BLSKeyName, hexBLSKey); writeDataToDB(BLSKeyName, hexBLSKey);
std::cerr << "hexBLSKey length is " << strlen(hexBLSKey) << std::endl; std::cerr << "hexBLSKey length is " << strlen(hexBLSKey) << std::endl;
std::cerr << "bls key " << BLSKeyName << " is " << hexBLSKey << std::endl; std::cerr << "bls key " << BLSKeyName << " is " << hexBLSKey << std::endl;
...@@ -292,3 +311,40 @@ std::string decrypt_DHKey(const std::string& polyName, int ind){ ...@@ -292,3 +311,40 @@ std::string decrypt_DHKey(const std::string& polyName, int ind){
return DHKey; return DHKey;
} }
std::vector<std::string> mult_G2(const std::string& x){
std::vector<std::string> result(4);
libff::init_alt_bn128_params();
libff::alt_bn128_Fr el(x.c_str());
libff::alt_bn128_G2 elG2 = el * libff::alt_bn128_G2::one();
elG2.to_affine_coordinates();
result[0] = ConvertToString(elG2.X.c0);
result[1] = ConvertToString(elG2.X.c1);
result[2] = ConvertToString(elG2.Y.c0);
result[3] = ConvertToString(elG2.Y.c1);
return result;
}
bool TestCreateBLSShare( const char * s_shares) {
char *errMsg1 = (char *)calloc(1024, 1);
int err_status = 0;
uint32_t enc_bls_len = 0;
uint8_t encr_key[BUF_LEN];
memset(encr_key, 1, BUF_LEN);
uint64_t dec_key_len ;
uint8_t encr_bls_key[BUF_LEN];
std::cerr << "Enter TestCreateBLSShare" << std::endl;
create_bls_key(eid, &err_status, errMsg1, s_shares, encr_key, dec_key_len,
encr_bls_key, &enc_bls_len);
std::cerr << "err msg is " << errMsg1 << std::endl;
if ( err_status != 0 ){
std::cerr << "something went wrong in enclave " << "status is" << err_status << std::endl;
}
}
...@@ -24,5 +24,11 @@ bool CreateBLSShare( const std::string& BLSKeyName, const char * s_shares, const ...@@ -24,5 +24,11 @@ bool CreateBLSShare( const std::string& BLSKeyName, const char * s_shares, const
std::vector<std::string> GetBLSPubKey(const char * encryptedKeyHex); std::vector<std::string> GetBLSPubKey(const char * encryptedKeyHex);
std::vector<std::string> mult_G2(const std::string& x);
bool TestCreateBLSShare( const char * s_shares);
#endif //SGXD_DKGCRYPTO_H #endif //SGXD_DKGCRYPTO_H
...@@ -94,7 +94,16 @@ secure_enclave.signed.so: secure_enclave/secure_enclave.signed.so ...@@ -94,7 +94,16 @@ secure_enclave.signed.so: secure_enclave/secure_enclave.signed.so
sgxwallet_LDADD=-l$(SGX_URTS_LIB) -Lleveldb/build -LlibBLS/build -LlibBLS/build/libff/libff -l:libbls.a -l:libleveldb.a \ sgxwallet_LDADD=-l$(SGX_URTS_LIB) -Lleveldb/build -LlibBLS/build -LlibBLS/build/libff/libff -l:libbls.a -l:libleveldb.a \
-l:libff.a -lgmp -ldl -l:libsgx_capable.a -l:libsgx_tprotected_fs.a -ljsonrpccpp-stub -lpthread -ljsonrpccpp-common \ -l:libff.a -lgmp -ldl -l:libsgx_capable.a -l:libsgx_tprotected_fs.a -ljsonrpccpp-stub -lpthread -ljsonrpccpp-common \
-ljsonrpccpp-server -ljsonrpccpp-client -ljsoncpp -lcurl -lprocps intel-sgx-ssl/Linux/package/lib64/libsgx_usgxssl.a \ -ljsonrpccpp-server -ljsonrpccpp-client -ljsoncpp -lcurl -lprocps intel-sgx-ssl/Linux/package/lib64/libsgx_usgxssl.a \
intel-sgx-ssl/Linux/package/lib64/libsgx_tsgxssl_crypto.a -lboost_system -lboost_filesystem intel-sgx-ssl/Linux/package/lib64/libsgx_tsgxssl_crypto.a
#-lboost_system -lboost_filesystem
# -lboost_filesystem
# -llibboost_filesystem.a
# find /usr -name *libboost_filesystem*so*
# -llibboost_filesystem.so
### libboost_filesystem.so.67.1
......
...@@ -34,12 +34,14 @@ ...@@ -34,12 +34,14 @@
#include <algorithm> #include <algorithm>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
//#if __cplusplus < 201412L //#if __cplusplus < 201412L
//#error expecting C++17 standard //#error expecting C++17 standard
//#endif //#endif
#include <boost/filesystem.hpp> //#include <boost/filesystem.hpp>
bool isStringDec( std::string & str){ bool isStringDec( std::string & str){
...@@ -49,33 +51,48 @@ bool isStringDec( std::string & str){ ...@@ -49,33 +51,48 @@ bool isStringDec( std::string & str){
return !str.empty() && res == str.end(); return !str.empty() && res == str.end();
} }
SGXWalletServer *s = nullptr;
HttpServer *hs = nullptr;
SGXWalletServer::SGXWalletServer(AbstractServerConnector &connector, SGXWalletServer::SGXWalletServer(AbstractServerConnector &connector,
serverVersion_t type) serverVersion_t type)
: AbstractStubServer(connector, type) {} : AbstractStubServer(connector, type) {}
SGXWalletServer *s = nullptr; void debug_print(){
HttpServer *hs = nullptr; std::cout << "HERE ARE YOUR KEYS: " << std::endl;
class MyVisitor: public LevelDB::KeyVisitor {
public:
virtual void visitDBKey(const char* _data){
std::cout << _data << std::endl;
}
};
MyVisitor v;
levelDb->visitKeys(&v, 100000000);
}
int init_server() { int init_server() {
std::string certPath ="";//"cert/SGXServerCertificate.crt"; std::string certPath = "cert/SGXServerCertificate.crt";
std::string keyPath ="";//"cert/SGXServerCertificate.key"; std::string keyPath = "cert/SGXServerCertificate.key";
// if (!boost::filesystem::exists(certPath) ){ if (access(certPath.c_str(), F_OK) != 0){ //(!boost::filesystem::exists(certPath) ){
// std::cerr << "NO!!! " << std::endl; std::cerr << "NO!!! " << std::endl;
// std::cerr << "CERTIFICATE IS GOING TO BE CREATED" << std::endl; std::cerr << "CERTIFICATE IS GOING TO BE CREATED" << std::endl;
//
// std::string genCert = "cd cert && ./self-signed-tls -c=US -s=California -l=San-Francisco -o=\"Skale Labs\" -u=\"Department of Software Engineering\" -n=\"SGXServerCertificate\" -e=info@skalelabs.com";
//
// if (system(genCert.c_str()) == 0){
// std::cerr << "CERTIFICATE IS SUCCESSFULLY GENERATED" << std::endl;
// }
// else{
// std::cerr << "CERTIFICATE GENERATION FAILED" << std::endl;
// exit(-1);
// }
// }
hs = new HttpServer(1027, certPath, keyPath); std::string genCert = "cd cert && ./self-signed-tls -c=US -s=California -l=San-Francisco -o=\"Skale Labs\" -u=\"Department of Software Engineering\" -n=\"SGXServerCertificate\" -e=info@skalelabs.com";
if (system(genCert.c_str()) == 0){
std::cerr << "CERTIFICATE IS SUCCESSFULLY GENERATED" << std::endl;
}
else{
std::cerr << "CERTIFICATE GENERATION FAILED" << std::endl;
exit(-1);
}
}
hs = new HttpServer(1026, certPath, keyPath, 10);
s = new SGXWalletServer(*hs, s = new SGXWalletServer(*hs,
JSONRPC_SERVER_V2); // hybrid server (json-rpc 1.0 & 2.0) JSONRPC_SERVER_V2); // hybrid server (json-rpc 1.0 & 2.0)
...@@ -86,6 +103,18 @@ int init_server() { ...@@ -86,6 +103,18 @@ int init_server() {
return 0; return 0;
} }
//int init_server() { //without ssl
//
// hs = new HttpServer(1027, "", "", 1);
// s = new SGXWalletServer(*hs,
// JSONRPC_SERVER_V2); // hybrid server (json-rpc 1.0 & 2.0)
// if (!s->StartListening()) {
// cerr << "Server could not start listening" << endl;
// exit(-1);
// }
// return 0;
//}
Json::Value Json::Value
importBLSKeyShareImpl(const std::string &_keyShare, const std::string &_keyShareName, int t, int n, int index) { importBLSKeyShareImpl(const std::string &_keyShare, const std::string &_keyShareName, int t, int n, int index) {
Json::Value result; Json::Value result;
...@@ -93,7 +122,6 @@ importBLSKeyShareImpl(const std::string &_keyShare, const std::string &_keyShare ...@@ -93,7 +122,6 @@ importBLSKeyShareImpl(const std::string &_keyShare, const std::string &_keyShare
int errStatus = UNKNOWN_ERROR; int errStatus = UNKNOWN_ERROR;
char *errMsg = (char *) calloc(BUF_LEN, 1); char *errMsg = (char *) calloc(BUF_LEN, 1);
result["status"] = 0; result["status"] = 0;
result["errorMessage"] = ""; result["errorMessage"] = "";
result["encryptedKeyShare"] = ""; result["encryptedKeyShare"] = "";
...@@ -492,6 +520,7 @@ Json::Value DKGVerificationImpl(const std::string& publicShares, const std::stri ...@@ -492,6 +520,7 @@ Json::Value DKGVerificationImpl(const std::string& publicShares, const std::stri
} }
Json::Value CreateBLSPrivateKeyImpl(const std::string & BLSKeyName, const std::string& EthKeyName, const std::string& polyName, const std::string & SecretShare, int t, int n){ Json::Value CreateBLSPrivateKeyImpl(const std::string & BLSKeyName, const std::string& EthKeyName, const std::string& polyName, const std::string & SecretShare, int t, int n){
std::cerr << "CreateBLSPrivateKeyImpl entered" << std::endl; std::cerr << "CreateBLSPrivateKeyImpl entered" << std::endl;
...@@ -503,8 +532,10 @@ Json::Value CreateBLSPrivateKeyImpl(const std::string & BLSKeyName, const std::s ...@@ -503,8 +532,10 @@ Json::Value CreateBLSPrivateKeyImpl(const std::string & BLSKeyName, const std::s
if (SecretShare.length() != n * 192){ if (SecretShare.length() != n * 192){
std::cerr << "wrong length of secret shares - " << SecretShare.length() << std::endl; std::cerr << "wrong length of secret shares - " << SecretShare.length() << std::endl;
result["errorMessage"] = "wrong length of secret shares"; std::cerr << "secret shares - " << SecretShare << std::endl;
return result; //result["errorMessage"] = "wrong length of secret shares";
//return result;
throw RPCException(INVALID_SECRET_SHARES_LENGTH, "Invalid secret share length");
} }
if ( !checkECDSAKeyName(EthKeyName)){ if ( !checkECDSAKeyName(EthKeyName)){
throw RPCException(INVALID_ECDSA_KEY_NAME, "Invalid ECDSA key name"); throw RPCException(INVALID_ECDSA_KEY_NAME, "Invalid ECDSA key name");
...@@ -516,27 +547,14 @@ Json::Value CreateBLSPrivateKeyImpl(const std::string & BLSKeyName, const std::s ...@@ -516,27 +547,14 @@ Json::Value CreateBLSPrivateKeyImpl(const std::string & BLSKeyName, const std::s
throw RPCException(INVALID_POLY_NAME, "Invalid BLS key name"); throw RPCException(INVALID_POLY_NAME, "Invalid BLS key name");
} }
std::vector<std::string> sshares_vect; std::vector<std::string> sshares_vect;
std::cerr << "sshares are " << SecretShare << std::endl; std::cerr << "sshares from json are " << SecretShare << std::endl;
char sshares[192 * n + 1];
for ( int i = 0; i < n ; i++){
std::string cur_share = SecretShare.substr(192*i, 192*i + 192);
// if ( !checkHex(SecretShare, SECRET_SHARE_NUM_BYTES)){
// throw RPCException(INVALID_HEX, "Invalid Secret share");
// }
// std::cerr << " share " << i << " is " << cur_share << std::endl;
sshares_vect.push_back(cur_share);
// std::cerr << sshares_vect[i] << " ";
strncpy(sshares + i * 192, cur_share.c_str(), 192);
}
sshares[192 * n ] = 0;
//std::cerr << sshares << std::endl;
//std::cerr << "length is " << strlen(sshares);
std::shared_ptr<std::string> encryptedKeyHex_ptr = readFromDb(EthKeyName); std::shared_ptr<std::string> encryptedKeyHex_ptr = readFromDb(EthKeyName);
bool res = CreateBLSShare(BLSKeyName, sshares, encryptedKeyHex_ptr->c_str()); bool res = CreateBLSShare(BLSKeyName, SecretShare.c_str(), encryptedKeyHex_ptr->c_str());
if ( res){ if ( res){
std::cerr << "key created " << std::endl; std::cerr << "BLS KEY SHARE CREATED " << std::endl;
} }
else { else {
...@@ -582,6 +600,8 @@ Json::Value GetBLSPublicKeyShareImpl(const std::string & BLSKeyName){ ...@@ -582,6 +600,8 @@ Json::Value GetBLSPublicKeyShareImpl(const std::string & BLSKeyName){
result["errorMessage"] = _e.errString; result["errorMessage"] = _e.errString;
} }
debug_print();
return result; return result;
} }
...@@ -611,6 +631,26 @@ Json::Value ComplaintResponseImpl(const std::string& polyName, int ind){ ...@@ -611,6 +631,26 @@ Json::Value ComplaintResponseImpl(const std::string& polyName, int ind){
} }
Json::Value MultG2Impl(const std::string& x){
Json::Value result;
result["status"] = 0;
result["errorMessage"] = "";
try {
std::cerr << "MultG2Impl try " << std::endl;
std::vector<std::string> xG2_vect = mult_G2(x);
for ( uint8_t i = 0; i < 4; i++) {
result["x*G2"][i] = xG2_vect.at(i);
}
} catch (RPCException &_e) {
std::cerr << " err str " << _e.errString << std::endl;
result["status"] = _e.status;
result["errorMessage"] = _e.errString;
}
return result;
}
Json::Value SGXWalletServer::generateDKGPoly(const std::string& polyName, int t){ Json::Value SGXWalletServer::generateDKGPoly(const std::string& polyName, int t){
std::cerr << "entered generateDKGPoly" << std::endl; std::cerr << "entered generateDKGPoly" << std::endl;
...@@ -692,13 +732,18 @@ Json::Value SGXWalletServer::ComplaintResponse(const std::string& polyName, int ...@@ -692,13 +732,18 @@ Json::Value SGXWalletServer::ComplaintResponse(const std::string& polyName, int
return ComplaintResponseImpl(polyName, ind); return ComplaintResponseImpl(polyName, ind);
} }
Json::Value SGXWalletServer::MultG2(const std::string& x){
lock_guard<recursive_mutex> lock(m);
return MultG2Impl(x);
}
shared_ptr<string> readFromDb(const string & name, const string & prefix) { shared_ptr<string> readFromDb(const string & name, const string & prefix) {
auto dataStr = levelDb->readString(prefix + name); auto dataStr = levelDb->readString(prefix + name);
if (dataStr == nullptr) { if (dataStr == nullptr) {
throw RPCException(KEY_SHARE_DOES_NOT_EXIST, "Data with this name does not exists"); throw RPCException(KEY_SHARE_DOES_NOT_EXIST, "Data with this name does not exist");
} }
return dataStr; return dataStr;
...@@ -709,7 +754,7 @@ shared_ptr<string> readKeyShare(const string &_keyShareName) { ...@@ -709,7 +754,7 @@ shared_ptr<string> readKeyShare(const string &_keyShareName) {
auto keyShareStr = levelDb->readString("BLSKEYSHARE:" + _keyShareName); auto keyShareStr = levelDb->readString("BLSKEYSHARE:" + _keyShareName);
if (keyShareStr == nullptr) { if (keyShareStr == nullptr) {
throw RPCException(KEY_SHARE_DOES_NOT_EXIST, "Key share with this name does not exists"); throw RPCException(KEY_SHARE_DOES_NOT_EXIST, "Key share with this name does not exist");
} }
return keyShareStr; return keyShareStr;
...@@ -752,5 +797,6 @@ void writeDataToDB(const string & Name, const string &value) { ...@@ -752,5 +797,6 @@ void writeDataToDB(const string & Name, const string &value) {
} }
levelDb->writeString(key, value); levelDb->writeString(key, value);
std::cerr << Name << " is written to db " << std::endl;
} }
...@@ -36,6 +36,7 @@ public: ...@@ -36,6 +36,7 @@ public:
virtual Json::Value CreateBLSPrivateKey(const std::string & BLSKeyName, const std::string& EthKeyName, const std::string& polyName, const std::string & SecretShare, int t, int n); virtual Json::Value CreateBLSPrivateKey(const std::string & BLSKeyName, const std::string& EthKeyName, const std::string& polyName, const std::string & SecretShare, int t, int n);
virtual Json::Value GetBLSPublicKeyShare(const std::string & BLSKeyName); virtual Json::Value GetBLSPublicKeyShare(const std::string & BLSKeyName);
virtual Json::Value ComplaintResponse(const std::string& polyName, int ind); virtual Json::Value ComplaintResponse(const std::string& polyName, int ind);
virtual Json::Value MultG2(const std::string & x);
}; };
...@@ -61,5 +62,6 @@ Json::Value DKGVerificationImpl(const std::string& publicShares, const std::stri ...@@ -61,5 +62,6 @@ Json::Value DKGVerificationImpl(const std::string& publicShares, const std::stri
Json::Value CreateBLSPrivateKeyImpl(const std::string & BLSKeyName, const std::string& EthKeyName, const std::string& polyName, const std::string & SecretShare, int t, int n); Json::Value CreateBLSPrivateKeyImpl(const std::string & BLSKeyName, const std::string& EthKeyName, const std::string& polyName, const std::string & SecretShare, int t, int n);
Json::Value GetBLSPublicKeyShareImpl(const std::string & BLSKeyName); Json::Value GetBLSPublicKeyShareImpl(const std::string & BLSKeyName);
Json::Value ComplaintResponseImpl(const std::string& polyName, int ind); Json::Value ComplaintResponseImpl(const std::string& polyName, int ind);
Json::Value MultG2Impl(const std::string & x);
#endif //SGXWALLET_SGXWALLETSERVER_HPP #endif //SGXWALLET_SGXWALLETSERVER_HPP
\ No newline at end of file
...@@ -28,6 +28,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer> ...@@ -28,6 +28,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
this->bindAndAddMethod(jsonrpc::Procedure("CreateBLSPrivateKey", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "BLSKeyName",jsonrpc::JSON_STRING, "EthKeyName",jsonrpc::JSON_STRING, "polyName", jsonrpc::JSON_STRING, "SecretShare",jsonrpc::JSON_STRING,"t", jsonrpc::JSON_INTEGER,"n",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::CreateBLSPrivateKeyI); this->bindAndAddMethod(jsonrpc::Procedure("CreateBLSPrivateKey", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "BLSKeyName",jsonrpc::JSON_STRING, "EthKeyName",jsonrpc::JSON_STRING, "polyName", jsonrpc::JSON_STRING, "SecretShare",jsonrpc::JSON_STRING,"t", jsonrpc::JSON_INTEGER,"n",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::CreateBLSPrivateKeyI);
this->bindAndAddMethod(jsonrpc::Procedure("GetBLSPublicKeyShare", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "BLSKeyName",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::GetBLSPublicKeyShareI); this->bindAndAddMethod(jsonrpc::Procedure("GetBLSPublicKeyShare", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "BLSKeyName",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::GetBLSPublicKeyShareI);
this->bindAndAddMethod(jsonrpc::Procedure("ComplaintResponse", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "polyName",jsonrpc::JSON_STRING,"ind",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::ComplaintResponseI); this->bindAndAddMethod(jsonrpc::Procedure("ComplaintResponse", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "polyName",jsonrpc::JSON_STRING,"ind",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::ComplaintResponseI);
this->bindAndAddMethod(jsonrpc::Procedure("MultG2", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "x",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::MultG2I);
} }
...@@ -88,6 +89,10 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer> ...@@ -88,6 +89,10 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
{ {
response = this->ComplaintResponse( request["polyName"].asString(), request["ind"].asInt()); response = this->ComplaintResponse( request["polyName"].asString(), request["ind"].asInt());
} }
inline virtual void MultG2I(const Json::Value &request, Json::Value &response)
{
response = this->MultG2(request["x"].asString());
}
virtual Json::Value importBLSKeyShare(const std::string& keyShare, const std::string& keyShareName, int t, int n, int index) = 0; virtual Json::Value importBLSKeyShare(const std::string& keyShare, const std::string& keyShareName, int t, int n, int index) = 0;
virtual Json::Value blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash, int t, int n, int signerIndex ) = 0; virtual Json::Value blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash, int t, int n, int signerIndex ) = 0;
...@@ -104,6 +109,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer> ...@@ -104,6 +109,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
virtual Json::Value CreateBLSPrivateKey(const std::string & BLSKeyName, const std::string& EthKeyName, const std::string& polyName, const std::string & SecretShare, int t, int n) = 0; virtual Json::Value CreateBLSPrivateKey(const std::string & BLSKeyName, const std::string& EthKeyName, const std::string& polyName, const std::string & SecretShare, int t, int n) = 0;
virtual Json::Value GetBLSPublicKeyShare(const std::string & BLSKeyName) = 0; virtual Json::Value GetBLSPublicKeyShare(const std::string & BLSKeyName) = 0;
virtual Json::Value ComplaintResponse(const std::string& polyName, int ind) = 0; virtual Json::Value ComplaintResponse(const std::string& polyName, int ind) = 0;
virtual Json::Value MultG2(const std::string & x) = 0;
}; };
#endif //JSONRPC_CPP_STUB_ABSTRACTSTUBSERVER_H_ #endif //JSONRPC_CPP_STUB_ABSTRACTSTUBSERVER_H_
...@@ -69,7 +69,10 @@ void session_key_recover(const char *skey_str, const char* sshare, char* common_ ...@@ -69,7 +69,10 @@ void session_key_recover(const char *skey_str, const char* sshare, char* common_
mpz_t skey; mpz_t skey;
mpz_init(skey); mpz_init(skey);
mpz_set_str(skey, skey_str, 16); if (mpz_set_str(skey, skey_str, 16) == -1){
common_key = NULL;
return;
}
point pub_keyB = point_init(); point pub_keyB = point_init();
point_set_hex(pub_keyB, pb_keyB_x, pb_keyB_y); point_set_hex(pub_keyB, pb_keyB_x, pb_keyB_y);
......
...@@ -189,6 +189,8 @@ void calc_secret_shareG2(const char* s_share, char * s_shareG2){ ...@@ -189,6 +189,8 @@ void calc_secret_shareG2(const char* s_share, char * s_shareG2){
libff::alt_bn128_G2 secret_shareG2 = secret_share * libff::alt_bn128_G2::one(); libff::alt_bn128_G2 secret_shareG2 = secret_share * libff::alt_bn128_G2::one();
secret_shareG2.to_affine_coordinates();
std::string secret_shareG2_str = ConvertG2ToString(secret_shareG2); std::string secret_shareG2_str = ConvertG2ToString(secret_shareG2);
strncpy(s_shareG2, secret_shareG2_str.c_str(), secret_shareG2_str.length() + 1); strncpy(s_shareG2, secret_shareG2_str.c_str(), secret_shareG2_str.length() + 1);
......
...@@ -694,8 +694,12 @@ void dkg_verification(int *err_status, char* err_string, const char * public_sha ...@@ -694,8 +694,12 @@ void dkg_verification(int *err_status, char* err_string, const char * public_sha
char common_key[65]; char common_key[65];
char decr_sshare[65]; char decr_sshare[65];
session_key_recover(skey, s_share, common_key); session_key_recover(skey, s_share, common_key);
common_key[64] = 0; common_key[64] = 0;
if (common_key == NULL){
*err_status = 1;
snprintf(err_string, BUF_LEN ,"invalid common_key");
return;
}
xor_decrypt(common_key, encr_sshare, decr_sshare); xor_decrypt(common_key, encr_sshare, decr_sshare);
if (decr_sshare == NULL){ if (decr_sshare == NULL){
...@@ -724,14 +728,13 @@ void dkg_verification(int *err_status, char* err_string, const char * public_sha ...@@ -724,14 +728,13 @@ void dkg_verification(int *err_status, char* err_string, const char * public_sha
*result = Verification(public_shares, s, _t, _ind); *result = Verification(public_shares, s, _t, _ind);
snprintf(err_string, BUF_LEN,"data is %s", public_shares); snprintf(err_string, BUF_LEN,"common_key in verification is %s", common_key);
} }
void create_bls_key(int *err_status, char* err_string, const char* s_shares, void create_bls_key(int *err_status, char* err_string, const char* s_shares,
uint8_t* encrypted_key, uint64_t key_len, uint8_t * encr_bls_key, uint32_t *enc_bls_key_len){ uint8_t* encrypted_key, uint64_t key_len, uint8_t * encr_bls_key, uint32_t *enc_bls_key_len){
//uint32_t dec_len = 625;
char skey[ECDSA_SKEY_LEN]; char skey[ECDSA_SKEY_LEN];
sgx_status_t status = sgx_unseal_data( sgx_status_t status = sgx_unseal_data(
(const sgx_sealed_data_t *)encrypted_key, NULL, 0, (uint8_t*)skey, &key_len); (const sgx_sealed_data_t *)encrypted_key, NULL, 0, (uint8_t*)skey, &key_len);
...@@ -740,6 +743,8 @@ void create_bls_key(int *err_status, char* err_string, const char* s_shares, ...@@ -740,6 +743,8 @@ void create_bls_key(int *err_status, char* err_string, const char* s_shares,
return; return;
} }
//char * skey = "a15c19da241e5b1db20d8dd8ca4b5eeaee01c709b49ec57aa78c2133d3c1b3c9";
int num_shares = strlen(s_shares)/192; int num_shares = strlen(s_shares)/192;
mpz_t sum; mpz_t sum;
...@@ -747,18 +752,6 @@ void create_bls_key(int *err_status, char* err_string, const char* s_shares, ...@@ -747,18 +752,6 @@ void create_bls_key(int *err_status, char* err_string, const char* s_shares,
mpz_set_ui(sum, 0); mpz_set_ui(sum, 0);
char encr_sshare[65];
strncpy(encr_sshare, s_shares, 64);
encr_sshare[64] = 0;
char s_share[193];
strncpy(s_share, s_shares, 192);
s_share[192] = 0;
char common_key[65];
session_key_recover(skey, s_share, common_key);
common_key[64] = 0;
//snprintf(err_string, BUF_LEN,"comon0 is %s len is %d\n", common_key, strlen(common_key)); //snprintf(err_string, BUF_LEN,"comon0 is %s len is %d\n", common_key, strlen(common_key));
...@@ -775,6 +768,11 @@ void create_bls_key(int *err_status, char* err_string, const char* s_shares, ...@@ -775,6 +768,11 @@ void create_bls_key(int *err_status, char* err_string, const char* s_shares,
session_key_recover(skey, s_share, common_key); session_key_recover(skey, s_share, common_key);
common_key[64] = 0; common_key[64] = 0;
if (common_key == NULL){
*err_status = 1;
snprintf(err_string, BUF_LEN ,"invalid common_key");
return;
}
//snprintf(err_string + 85*(i+1) , BUF_LEN,"common is %s len is %d\n", common_key, strlen(common_key)); //snprintf(err_string + 85*(i+1) , BUF_LEN,"common is %s len is %d\n", common_key, strlen(common_key));
...@@ -788,6 +786,8 @@ void create_bls_key(int *err_status, char* err_string, const char* s_shares, ...@@ -788,6 +786,8 @@ void create_bls_key(int *err_status, char* err_string, const char* s_shares,
return; return;
} }
//decr_sshare[64] = 0; //decr_sshare[64] = 0;
snprintf(err_string + 158 * i, BUF_LEN,"decr sshare is %s", decr_sshare);
snprintf(err_string + 158 * i + 79, BUF_LEN," common_key is %s", common_key);
//snprintf(err_string + 89*i, BUF_LEN,"share is %s length is %d ", decr_sshare, strlen(decr_sshare)); //snprintf(err_string + 89*i, BUF_LEN,"share is %s length is %d ", decr_sshare, strlen(decr_sshare));
//snprintf(err_string + 65*i, BUF_LEN,"%s ", decr_sshare); //snprintf(err_string + 65*i, BUF_LEN,"%s ", decr_sshare);
...@@ -816,20 +816,18 @@ void create_bls_key(int *err_status, char* err_string, const char* s_shares, ...@@ -816,20 +816,18 @@ void create_bls_key(int *err_status, char* err_string, const char* s_shares,
char key_share[mpz_sizeinbase(bls_key, 16) + 2]; char key_share[mpz_sizeinbase(bls_key, 16) + 2];
char *key = mpz_get_str(key_share, 16, bls_key); char *key = mpz_get_str(key_share, 16, bls_key);
snprintf(err_string, BUF_LEN,"bls private key is %s", key_share); snprintf(err_string + 158 * num_shares , BUF_LEN," bls private key is %s", key_share);
uint32_t sealedLen = sgx_calc_sealed_data_size(0, ECDSA_SKEY_LEN); uint32_t sealedLen = sgx_calc_sealed_data_size(0, ECDSA_SKEY_LEN);
status = sgx_seal_data(0, NULL, ECDSA_SKEY_LEN, (uint8_t *)key_share, sealedLen,(sgx_sealed_data_t*)encr_bls_key); status = sgx_seal_data(0, NULL, ECDSA_SKEY_LEN, (uint8_t *)key_share, sealedLen,(sgx_sealed_data_t*)encr_bls_key);
if( status != SGX_SUCCESS) { if( status != SGX_SUCCESS) {
*err_status= -1;
snprintf(err_string, BUF_LEN,"seal bls private key failed with status %d ", status); snprintf(err_string, BUF_LEN,"seal bls private key failed with status %d ", status);
return; return;
} }
*enc_bls_key_len = sealedLen; *enc_bls_key_len = sealedLen;
//snprintf(err_string, BUF_LEN,"sshare is %s", decr_sshare);
//snprintf(err_string, BUF_LEN,"encr_share is %s", encr_sshare);
//snprintf(err_string, BUF_LEN,"common_key is %s", common_key);
// mpz_t s; // mpz_t s;
// mpz_init(s); // mpz_init(s);
......
...@@ -1047,7 +1047,12 @@ __GMP_DECLSPEC void mpz_set_q (mpz_ptr, mpq_srcptr); ...@@ -1047,7 +1047,12 @@ __GMP_DECLSPEC void mpz_set_q (mpz_ptr, mpq_srcptr);
__GMP_DECLSPEC void mpz_set_si (mpz_ptr, signed long int); __GMP_DECLSPEC void mpz_set_si (mpz_ptr, signed long int);
#define mpz_set_str __gmpz_set_str #define mpz_set_str __gmpz_set_str
__GMP_DECLSPEC int mpz_set_str (mpz_ptr, const char *, int); #if defined (__cplusplus)
extern "C" {
__GMP_DECLSPEC int mpz_set_str(mpz_ptr, const char *, int);
}
#endif
#define mpz_set_ui __gmpz_set_ui #define mpz_set_ui __gmpz_set_ui
#if defined (__cplusplus) #if defined (__cplusplus)
......
...@@ -50,13 +50,14 @@ ...@@ -50,13 +50,14 @@
#define INVALID_POLY_NAME -11 #define INVALID_POLY_NAME -11
#define INVALID_DKG_PARAMS -12 #define INVALID_DKG_PARAMS -12
#define INVALID_SECRET_SHARES_LENGTH -13
#define INVALID_ECDSA_KEY_NAME -20 #define INVALID_ECDSA_KEY_NAME -20
#define INVALID_HEX -21 #define INVALID_HEX -21
#define SGX_ENCLAVE_ERROR -666; #define SGX_ENCLAVE_ERROR -666;
#define WALLETDB_NAME "test_sgxwallet1.db"//"sgxwallet.db" #define WALLETDB_NAME "sgxwallet.db"//"test_sgxwallet1.db"//
#define ENCLAVE_NAME "secure_enclave.signed.so" #define ENCLAVE_NAME "secure_enclave.signed.so"
......
...@@ -194,7 +194,9 @@ ...@@ -194,7 +194,9 @@
"share*G2": "123", "share*G2": "123",
"DHKey": "123" "DHKey": "123"
} }
} },
] ]
\ No newline at end of file
...@@ -185,6 +185,18 @@ class StubClient : public jsonrpc::Client ...@@ -185,6 +185,18 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value MultG2(const std::string & x) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["x"] = x;
Json::Value result = this->CallMethod("MultG2",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
}; };
#endif //JSONRPC_CPP_STUB_STUBCLIENT_H_ #endif //JSONRPC_CPP_STUB_STUBCLIENT_H_
...@@ -736,6 +736,7 @@ std::string ConvertDecToHex(std::string dec, int numBytes = 32){ ...@@ -736,6 +736,7 @@ std::string ConvertDecToHex(std::string dec, int numBytes = 32){
return result; return result;
} }
TEST_CASE("BLS_DKG test", "[bls_dkg]") { TEST_CASE("BLS_DKG test", "[bls_dkg]") {
std::cerr<< "test started" << std::endl; std::cerr<< "test started" << std::endl;
init_all(); init_all();
...@@ -746,7 +747,11 @@ TEST_CASE("BLS_DKG test", "[bls_dkg]") { ...@@ -746,7 +747,11 @@ TEST_CASE("BLS_DKG test", "[bls_dkg]") {
reset_db(); reset_db();
int n = 4, t = 2;
int n = 2, t = 2;
Json::Value EthKeys[n]; Json::Value EthKeys[n];
Json::Value VerifVects[n]; Json::Value VerifVects[n];
Json::Value pubEthKeys; Json::Value pubEthKeys;
...@@ -775,8 +780,8 @@ TEST_CASE("BLS_DKG test", "[bls_dkg]") { ...@@ -775,8 +780,8 @@ TEST_CASE("BLS_DKG test", "[bls_dkg]") {
pubShares[i] += ConvertDecToHex(pubShare); pubShares[i] += ConvertDecToHex(pubShare);
} }
} }
std::cerr << "i is " << i << " pubShares[i] = " << pubShares[i] << std::endl; // std::cerr << "i is " << i << " pubShares[i] = " << pubShares[i] << std::endl;
std::cerr << "length is" << pubShares[i].length() << std::endl; // std::cerr << "length is" << pubShares[i].length() << std::endl;
} }
Json::Value ComplaintResponse = c.ComplaintResponse(poly_names[1], 0); Json::Value ComplaintResponse = c.ComplaintResponse(poly_names[1], 0);
...@@ -785,11 +790,14 @@ TEST_CASE("BLS_DKG test", "[bls_dkg]") { ...@@ -785,11 +790,14 @@ TEST_CASE("BLS_DKG test", "[bls_dkg]") {
int k = 0; int k = 0;
std::vector < std::string> secShares_vect(n);
for ( int i = 0; i < n; i++) for ( int i = 0; i < n; i++)
for ( int j = 0; j < n; j++){ for ( int j = 0; j < n; j++){
// if ( i != j ){ // if ( i != j ){
std::cerr << "SecretShare length is " << secretShares[i]["SecretShare"].asString().length() << std::endl; std::cerr << "SecretShare length is " << secretShares[i]["SecretShare"].asString().length() << std::endl;
std::string secretShare = secretShares[i]["SecretShare"].asString().substr(192*j, 192 * (j+1)); std::string secretShare = secretShares[i]["SecretShare"].asString().substr(192*j, 192 * (j+1));
secShares_vect[i] += secretShares[j]["SecretShare"].asString().substr(192*i, 192 * (i+1));
bool res = c.DKGVerification(pubShares[i], EthKeys[j]["KeyName"].asString(), secretShare, t, n, j)["result"].asBool(); bool res = c.DKGVerification(pubShares[i], EthKeys[j]["KeyName"].asString(), secretShare, t, n, j)["result"].asBool();
k++; k++;
std::cerr << "NOW K IS " << k << " i is " << i << " j is " << j << std::endl; std::cerr << "NOW K IS " << k << " i is " << i << " j is " << j << std::endl;
...@@ -807,14 +815,17 @@ TEST_CASE("BLS_DKG test", "[bls_dkg]") { ...@@ -807,14 +815,17 @@ TEST_CASE("BLS_DKG test", "[bls_dkg]") {
throw RPCException(INVALID_HEX, "Invalid hash"); throw RPCException(INVALID_HEX, "Invalid hash");
} }
std::map<size_t, std::shared_ptr<BLSPublicKeyShare>> koefs_pkeys_map; std::map<size_t, std::shared_ptr<BLSPublicKeyShare>> koefs_pkeys_map;
for ( int i = 0; i < t; i++){ for ( int i = 0; i < t; i++){
std::string endName = poly_names[i].substr(4); std::string endName = poly_names[i].substr(4);
std::string blsName = "BLS_KEY" + poly_names[i].substr(4); std::string blsName = "BLS_KEY" + poly_names[i].substr(4);
std::string secretShare = secretShares[i]["SecretShare"].asString(); std::string secretShare = secretShares[i]["SecretShare"].asString();
cout << c.CreateBLSPrivateKey(blsName, EthKeys[i]["KeyName"].asString(), poly_names[i], secretShare, t, n); //cout << c.CreateBLSPrivateKey(blsName, EthKeys[i]["KeyName"].asString(), poly_names[i], secretShare, t, n);
cout << c.CreateBLSPrivateKey(blsName, EthKeys[i]["KeyName"].asString(), poly_names[i], secShares_vect[i], t, n);
pubBLSKeys[i] = c.GetBLSPublicKeyShare(blsName); pubBLSKeys[i] = c.GetBLSPublicKeyShare(blsName);
std::cerr << "BLS KEY SHARE NAME IS " << blsName << std::endl;
//std::string hash = "09c6137b97cdf159b9950f1492ee059d1e2b10eaf7d51f3a97d61f2eee2e81db"; //std::string hash = "09c6137b97cdf159b9950f1492ee059d1e2b10eaf7d51f3a97d61f2eee2e81db";
BLSSigShares[i] = c.blsSignMessageHash(blsName, hash, t, n, i + 1); BLSSigShares[i] = c.blsSignMessageHash(blsName, hash, t, n, i + 1);
std::cerr << i << " sig share is created " << std::endl; std::cerr << i << " sig share is created " << std::endl;
...@@ -837,17 +848,16 @@ TEST_CASE("BLS_DKG test", "[bls_dkg]") { ...@@ -837,17 +848,16 @@ TEST_CASE("BLS_DKG test", "[bls_dkg]") {
BLSPublicKey common_public(std::make_shared<std::map<size_t, std::shared_ptr<BLSPublicKeyShare>>>(koefs_pkeys_map), t, n); BLSPublicKey common_public(std::make_shared<std::map<size_t, std::shared_ptr<BLSPublicKeyShare>>>(koefs_pkeys_map), t, n);
REQUIRE( common_public.VerifySigWithHelper(hash_arr, commonSig, t, n) ); REQUIRE( common_public.VerifySigWithHelper(hash_arr, commonSig, t, n) );
std::cout << "try to get bls public key" << std::endl;
std::cout << c.GetBLSPublicKeyShare("BLS_KEY:SCHAIN_ID:1:NODE_ID:1:DKG_ID:0");
exit(0);
} }
TEST_CASE("API test", "[api_test]") { TEST_CASE("API test", "[api_test]") {
std::cerr << __GNUC__ << std::endl; //std::cerr << __GNUC__ << std::endl;
cerr << "API test started" << endl; cerr << "API test started" << endl;
init_all(); init_all();
//HttpServer httpserver(1025); //HttpServer httpserver(1025);
...@@ -883,7 +893,7 @@ TEST_CASE("API test", "[api_test]") { ...@@ -883,7 +893,7 @@ TEST_CASE("API test", "[api_test]") {
// cout << c.blsSignMessageHash(TEST_BLS_KEY_NAME, "0x09c6137b97cdf159b9950f1492ee059d1e2b10eaf7d51f3a97d61f2eee2e81db", 2,2,1 ); // cout << c.blsSignMessageHash(TEST_BLS_KEY_NAME, "0x09c6137b97cdf159b9950f1492ee059d1e2b10eaf7d51f3a97d61f2eee2e81db", 2,2,1 );
// cout << c.generateDKGPoly("pp2", 2); // cout << c.generateDKGPoly("pp2", 2);
// cout << c.generateDKGPoly("POLY:SCHAIN_ID:1:NODE_ID:1:DKG_ID:1", 2); // cout << c.generateDKGPoly("POLY:SCHAIN_ID:1:NODE_ID:1:DKG_ID:1", 2);
cout << c.generateDKGPoly("POLY:SCHAIN_ID:14225439306783892379384764908040542049263455631509697460847850632966314337557:NODE_ID:1:DKG_ID:71951190446274221430521459675625214118086594348715", 1); //cout << c.generateDKGPoly("POLY:SCHAIN_ID:14225439306783892379384764908040542049263455631509697460847850632966314337557:NODE_ID:1:DKG_ID:71951190446274221430521459675625214118086594348715", 1);
//cout << c.getVerificationVector("POLY:SCHAIN_ID:1:NODE_ID:1:DKG_ID:2", 2, 2); //cout << c.getVerificationVector("POLY:SCHAIN_ID:1:NODE_ID:1:DKG_ID:2", 2, 2);
// cout << c.getVerificationVector("polyy", 5, 5); // cout << c.getVerificationVector("polyy", 5, 5);
...@@ -936,9 +946,24 @@ TEST_CASE("API test", "[api_test]") { ...@@ -936,9 +946,24 @@ TEST_CASE("API test", "[api_test]") {
// cout << c.blsSignMessageHash("dOsRY","38433e5ce087dcc1be82fcc834eae83c256b3db87d34f84440d0b708daa0c6f7", 2, 2, 1); // cout << c.blsSignMessageHash("dOsRY","38433e5ce087dcc1be82fcc834eae83c256b3db87d34f84440d0b708daa0c6f7", 2, 2, 1);
// cout << c.ComplaintResponse("POLY:SCHAIN_ID:1:NODE_ID:1:DKG_ID:1", 0); // cout << c.ComplaintResponse("POLY:SCHAIN_ID:1:NODE_ID:1:DKG_ID:1", 0);
// cout << c.GetBLSPublicKeyShare("BLS_KEY:SCHAIN_ID:1:NODE_ID:1:DKG_ID:0");
// cout << c.getPublicECDSAKey("NEK:91573248d6b0ebd5b1bd313ab35163361b423c0f9f01bad085d166650b8b2c1f");
cout << c.MultG2("4160780231445160889237664391382223604184857153814275770598791864649971919844");
} catch (JsonRpcException &e) { } catch (JsonRpcException &e) {
cerr << e.what() << endl; cerr << e.what() << endl;
} }
sgx_destroy_enclave(eid); sgx_destroy_enclave(eid);
} }
//decr sshare is 0570d18552dc248c5f806cbfeb96cdc40234d51233b3ba80a9c7b790ae4eed13
//common_key is e6d91ec58664d25dd80071520793ab307bf408158543a9710445bd663041a760decr
//sshare is d56909d4b29a0f1d306be98c019bed02e9c6b9b56bfe9e933314815983401b40
//common_key is 0e4506de4faa7a241fccbcc9339cce03737415ba38349ccfa7aec916d37cee07
//
//
//decr sshare is 1f63caaf684e632338cd7c17569fb65d820004266acd36f0b6d2cbd05648b071
//common_key is e969840c044a3e7252e4677225f2513722d545ff1612f35d0cd66cda65185356decr
//sshare is 20d254d489bb31fc5b470c641ba280ea35e7da3a86c11ccdb74d3f9898daaa93
//common_key is 18dffe11f73f6d53e8f53ce1fe0ab8192f7a9180d50fb7e34a01776652e73471
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