Unverified Commit 127f624c authored by kladko's avatar kladko

Fix CMAKE file

parent 053fef20
......@@ -100,11 +100,12 @@ void initEnclave(uint32_t _logLevel) {
}
void initAll(uint32_t _logLevel, bool _checkCert, bool _autoSign) {
static int sgxServerInited;
static atomic<int> sgxServerInited(0);
cout << "Running sgxwallet version:" << SGXWalletServer::getVersion() << endl;
CHECK_STATE(sgxServerInited == 0)
CHECK_STATE(sgxServerInited != 1)
sgxServerInited = 1;
initEnclave(_logLevel);
initUserSpace();
......
......@@ -34,13 +34,10 @@ public:
static string stringFromFr(libff::alt_bn128_Fr &el);
static string convertDecToHex(string dec, int numBytes = 32);
static void genTestKeys();
static int updated;
static void resetDB();
static shared_ptr<string> encryptTestKey();
......
......@@ -267,22 +267,27 @@ TEST_CASE_METHOD("BLS key encrypt/decrypt", "[bls-key-encrypt-decrypt]") {
*/
string genECDSAKeyAPI(StubClient& _c) {
Json::Value genKey = _c.generateECDSAKey();
CHECK_STATE(genKey["status"].asInt() == 0);
auto keyName = genKey["keyName"].asString();
CHECK_STATE(keyName.size() == ECDSA_KEY_NAME_SIZE);
return keyName;
}
TEST_CASE_METHOD(TestFixture, "ECDSA key gen API", "[ecdsa-key-gen-api]") {
HttpClient client(RPC_ENDPOINT);
StubClient c(client, JSONRPC_CLIENT_V2);
for (int i = 0; i <= 20; i++) {
try {
Json::Value genKey = c.generateECDSAKey();
REQUIRE(genKey["status"].asInt() == 0);
auto keyName = genKey["keyName"].asString();
REQUIRE(keyName.size() == 68);
auto keyName = genECDSAKeyAPI(c);
Json::Value sig = c.ecdsaSignMessageHash(16, genKey["keyName"].asString(), SAMPLE_HASH);
Json::Value sig = c.ecdsaSignMessageHash(16, keyName, SAMPLE_HASH);
REQUIRE(sig["status"].asInt() == 0);
Json::Value getPubKey = c.getPublicECDSAKey(genKey["keyName"].asString());
Json::Value getPubKey = c.getPublicECDSAKey(keyName);
REQUIRE(getPubKey["status"].asInt() == 0);
} catch (JsonRpcException &e) {
cerr << e.what() << endl;
......
......@@ -24,5 +24,7 @@
//openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr^
#define SAMPLE_CSR_FILE_NAME "samples/yourdomain.csr"
#define ECDSA_KEY_NAME_SIZE 68
#endif //SGXWALLET_TESTW_H
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