qFixed

parent c485fc72
......@@ -41,11 +41,11 @@ public:
virtual Json::Value buildObject(const std::string &name, int age);
virtual std::string methodWithoutParameters();
virtual std::string importBLSKeyShare(int index, const std::string& keyShare, const std::string& keyShareName, int n, int t);
virtual std::string blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash);
virtual std::string importECDSAKey(const std::string& key, const std::string& keyName);
virtual std::string generateECDSAKey(const std::string& keyName);
virtual std::string ecdsaSignMessageHash(const std::string& keyShareName, const std::string& messageHash);
virtual Json::Value importBLSKeyShare(int index, const std::string& keyShare, const std::string& keyShareName, int n, int t);
virtual Json::Value blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash);
virtual Json::Value importECDSAKey(const std::string& key, const std::string& keyName);
virtual Json::Value generateECDSAKey(const std::string& keyName);
virtual Json::Value ecdsaSignMessageHash(const std::string& keyShareName, const std::string& messageHash);
......@@ -100,18 +100,35 @@ int init_server() {
std::string SGXWalletServer::importBLSKeyShare(int index, const std::string& keyShare, const std::string& keyShareName, int n, int t) {
return "";
Json::Value SGXWalletServer::importBLSKeyShare(int index, const std::string& keyShare, const std::string& keyShareName, int n, int t) {
Json::Value result;
result["name"] = 1;
result["year"] = 1;
return result;
}
std::string SGXWalletServer::blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash) {
return "";
Json::Value SGXWalletServer::blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash) {
Json::Value result;
result["name"] = 1;
result["year"] = 1;
return result;
}
std::string SGXWalletServer::importECDSAKey(const std::string& key, const std::string& keyName) {
return "";
Json::Value SGXWalletServer::importECDSAKey(const std::string& key, const std::string& keyName) {
Json::Value result;
result["name"] = 1;
result["year"] = 1;
return result;
}
std::string SGXWalletServer::generateECDSAKey(const std::string& keyName) {
return "";
Json::Value SGXWalletServer::generateECDSAKey(const std::string& keyName) {
Json::Value result;
result["name"] = 1;
result["year"] = 1;
return result;
}
std::string SGXWalletServer::ecdsaSignMessageHash(const std::string& keyShareName, const std::string& messageHash) {
return "";
Json::Value SGXWalletServer::ecdsaSignMessageHash(const std::string& keyShareName, const std::string& messageHash) {
Json::Value result;
result["name"] = 1;
result["year"] = 1;
return result;
}
......@@ -12,11 +12,11 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
public:
AbstractStubServer(jsonrpc::AbstractServerConnector &conn, jsonrpc::serverVersion_t type = jsonrpc::JSONRPC_SERVER_V2) : jsonrpc::AbstractServer<AbstractStubServer>(conn, type)
{
this->bindAndAddMethod(jsonrpc::Procedure("importBLSKeyShare", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_STRING, "index",jsonrpc::JSON_INTEGER,"keyShare",jsonrpc::JSON_STRING,"keyShareName",jsonrpc::JSON_STRING,"n",jsonrpc::JSON_INTEGER,"t",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::importBLSKeyShareI);
this->bindAndAddMethod(jsonrpc::Procedure("blsSignMessageHash", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_STRING, "keyShareName",jsonrpc::JSON_STRING,"messageHash",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::blsSignMessageHashI);
this->bindAndAddMethod(jsonrpc::Procedure("importECDSAKey", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_STRING, "key",jsonrpc::JSON_STRING,"keyName",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::importECDSAKeyI);
this->bindAndAddMethod(jsonrpc::Procedure("generateECDSAKey", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_STRING, "keyName",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::generateECDSAKeyI);
this->bindAndAddMethod(jsonrpc::Procedure("ecdsaSignMessageHash", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_STRING, "keyShareName",jsonrpc::JSON_STRING,"messageHash",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::ecdsaSignMessageHashI);
this->bindAndAddMethod(jsonrpc::Procedure("importBLSKeyShare", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "index",jsonrpc::JSON_INTEGER,"keyShare",jsonrpc::JSON_STRING,"keyShareName",jsonrpc::JSON_STRING,"n",jsonrpc::JSON_INTEGER,"t",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::importBLSKeyShareI);
this->bindAndAddMethod(jsonrpc::Procedure("blsSignMessageHash", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "keyShareName",jsonrpc::JSON_STRING,"messageHash",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::blsSignMessageHashI);
this->bindAndAddMethod(jsonrpc::Procedure("importECDSAKey", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "key",jsonrpc::JSON_STRING,"keyName",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::importECDSAKeyI);
this->bindAndAddMethod(jsonrpc::Procedure("generateECDSAKey", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "keyName",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::generateECDSAKeyI);
this->bindAndAddMethod(jsonrpc::Procedure("ecdsaSignMessageHash", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "keyShareName",jsonrpc::JSON_STRING,"messageHash",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::ecdsaSignMessageHashI);
this->bindAndAddMethod(jsonrpc::Procedure("sayHello", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_STRING, "name",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::sayHelloI);
this->bindAndAddNotification(jsonrpc::Procedure("notifyServer", jsonrpc::PARAMS_BY_NAME, NULL), &AbstractStubServer::notifyServerI);
this->bindAndAddMethod(jsonrpc::Procedure("addNumbers", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_INTEGER,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::addNumbersI);
......@@ -76,11 +76,11 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
(void)request;
response = this->methodWithoutParameters();
}
virtual std::string importBLSKeyShare(int index, const std::string& keyShare, const std::string& keyShareName, int n, int t) = 0;
virtual std::string blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash) = 0;
virtual std::string importECDSAKey(const std::string& key, const std::string& keyName) = 0;
virtual std::string generateECDSAKey(const std::string& keyName) = 0;
virtual std::string ecdsaSignMessageHash(const std::string& keyShareName, const std::string& messageHash) = 0;
virtual Json::Value importBLSKeyShare(int index, const std::string& keyShare, const std::string& keyShareName, int n, int t) = 0;
virtual Json::Value blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash) = 0;
virtual Json::Value importECDSAKey(const std::string& key, const std::string& keyName) = 0;
virtual Json::Value generateECDSAKey(const std::string& keyName) = 0;
virtual Json::Value ecdsaSignMessageHash(const std::string& keyShareName, const std::string& messageHash) = 0;
virtual std::string sayHello(const std::string& name) = 0;
virtual void notifyServer() = 0;
virtual int addNumbers(int param1, int param2) = 0;
......
......@@ -8,7 +8,11 @@
"index" : 2,
"keyShare": "1122334455"
},
"returns": "encryptedKeyShare"
"returns": {
"status": 0,
"errorMessage": "12345",
"encryptedKeyShare": "12345"
}
},
{
......@@ -17,7 +21,12 @@
"keyShareName": "key1",
"messageHash": "1122334455"
},
"returns": "blsSignatureShare"
"returns": {
"status": 0,
"errorMessage": "12345",
"blsSignatureShare": "12345"
}
},
{
......@@ -26,7 +35,11 @@
"keyName": "key1",
"key": "1122334455"
},
"returns": "encryptedKey"
"returns": {
"status": 0,
"errorMessage": "12345",
"encryptedKey": "12345"
}
},
......@@ -35,7 +48,11 @@
"params": {
"keyName": "key1"
},
"returns": "encryptedKey"
"returns": {
"status": 0,
"errorMessage": "12345",
"encryptedKey": "12345"
}
},
......@@ -46,7 +63,11 @@
"keyShareName": "key1",
"messageHash": "1122334455"
},
"returns": "ecdsaSignature"
"returns": {
"status": 0,
"errorMessage": "12345",
"ecdsaSignature": "12345"
}
},
......
......@@ -12,7 +12,7 @@ class StubClient : public jsonrpc::Client
public:
StubClient(jsonrpc::IClientConnector &conn, jsonrpc::clientVersion_t type = jsonrpc::JSONRPC_CLIENT_V2) : jsonrpc::Client(conn, type) {}
std::string importBLSKeyShare(int index, const std::string& keyShare, const std::string& keyShareName, int n, int t) throw (jsonrpc::JsonRpcException)
Json::Value importBLSKeyShare(int index, const std::string& keyShare, const std::string& keyShareName, int n, int t) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["index"] = index;
......@@ -21,51 +21,51 @@ class StubClient : public jsonrpc::Client
p["n"] = n;
p["t"] = t;
Json::Value result = this->CallMethod("importBLSKeyShare",p);
if (result.isString())
return result.asString();
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash) throw (jsonrpc::JsonRpcException)
Json::Value blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["keyShareName"] = keyShareName;
p["messageHash"] = messageHash;
Json::Value result = this->CallMethod("blsSignMessageHash",p);
if (result.isString())
return result.asString();
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string importECDSAKey(const std::string& key, const std::string& keyName) throw (jsonrpc::JsonRpcException)
Json::Value importECDSAKey(const std::string& key, const std::string& keyName) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["key"] = key;
p["keyName"] = keyName;
Json::Value result = this->CallMethod("importECDSAKey",p);
if (result.isString())
return result.asString();
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string generateECDSAKey(const std::string& keyName) throw (jsonrpc::JsonRpcException)
Json::Value generateECDSAKey(const std::string& keyName) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["keyName"] = keyName;
Json::Value result = this->CallMethod("generateECDSAKey",p);
if (result.isString())
return result.asString();
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string ecdsaSignMessageHash(const std::string& keyShareName, const std::string& messageHash) throw (jsonrpc::JsonRpcException)
Json::Value ecdsaSignMessageHash(const std::string& keyShareName, const std::string& messageHash) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p["keyShareName"] = keyShareName;
p["messageHash"] = messageHash;
Json::Value result = this->CallMethod("ecdsaSignMessageHash",p);
if (result.isString())
return result.asString();
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
......
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