Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sgxwallet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董子豪
sgxwallet
Commits
86e8b271
Unverified
Commit
86e8b271
authored
May 06, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed docs
parent
c10e1191
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
126 deletions
+82
-126
Log.cpp
Log.cpp
+6
-6
Log.h
Log.h
+17
-8
SGXWalletServer.cpp
SGXWalletServer.cpp
+59
-112
No files found.
Log.cpp
View file @
86e8b271
...
@@ -24,20 +24,15 @@
...
@@ -24,20 +24,15 @@
#include "spdlog/spdlog.h"
#include "spdlog/spdlog.h"
#include "sgxwallet_common.h"
#include "sgxwallet_common.h"
#include "common.h"
#include "common.h"
#include "SGXException.h"
#include "Log.h"
#include "Log.h"
using
namespace
std
;
using
namespace
std
;
void
Log
::
setGlobalLogLevel
(
string
&
_s
)
{
void
Log
::
setGlobalLogLevel
(
string
&
_s
)
{
globalLogLevel
=
logLevelFromString
(
_s
);
globalLogLevel
=
logLevelFromString
(
_s
);
}
}
level_enum
Log
::
logLevelFromString
(
string
&
_s
)
{
level_enum
Log
::
logLevelFromString
(
string
&
_s
)
{
level_enum
result
=
trace
;
level_enum
result
=
trace
;
...
@@ -58,6 +53,11 @@ level_enum Log::logLevelFromString(string &_s) {
...
@@ -58,6 +53,11 @@ level_enum Log::logLevelFromString(string &_s) {
}
}
void
Log
::
handleSGXException
(
Json
::
Value
&
_result
,
SGXException
&
_e
)
{
spdlog
::
error
(
"Responding with JSON error:"
+
_e
.
errString
);
_result
[
"status"
]
=
_e
.
status
;
_result
[
"errorMessage"
]
=
_e
.
errString
;
}
Log.h
View file @
86e8b271
...
@@ -30,7 +30,11 @@
...
@@ -30,7 +30,11 @@
#include <map>
#include <map>
#include <memory>
#include <memory>
#include "json/json.h"
#include "spdlog/spdlog.h"
#include "SGXException.h"
#include "InvalidArgumentException.h"
#include "InvalidArgumentException.h"
#include "InvalidStateException.h"
#include "InvalidStateException.h"
...
@@ -39,21 +43,18 @@
...
@@ -39,21 +43,18 @@
using
namespace
std
;
using
namespace
std
;
class
Exception
;
class
Exception
;
#define __CLASS_NAME__ className( __PRETTY_FUNCTION__ )
#define __CLASS_NAME__ className( __PRETTY_FUNCTION__ )
#define LOG(
__SEVERITY__, __MESSAGE__
) \
#define LOG(
__SEVERITY__, __MESSAGE__
) \
cerr << to_string(__SEVERITY__) << " " << __MESSAGE__ << " " << className( __PRETTY_FUNCTION__ ) << endl;
cerr << to_string(__SEVERITY__) << " " << __MESSAGE__ << " " << className( __PRETTY_FUNCTION__ ) << endl;
enum
level_enum
{
trace
,
debug
,
info
,
warn
,
err
enum
level_enum
{
trace
,
debug
,
info
,
warn
,
err
};
};
class
Log
{
class
Log
{
...
@@ -62,8 +63,16 @@ public:
...
@@ -62,8 +63,16 @@ public:
level_enum
globalLogLevel
;
level_enum
globalLogLevel
;
void
setGlobalLogLevel
(
string
&
_s
);
void
setGlobalLogLevel
(
string
&
_s
);
static
level_enum
logLevelFromString
(
string
&
_s
);
static
level_enum
logLevelFromString
(
string
&
_s
);
static
void
handleSGXException
(
Json
::
Value
&
_result
,
SGXException
&
_e
);
};
};
#define INIT_RESULT(__RESULT__) Json::Value __RESULT__; __RESULT__["status"] = 0; __RESULT__["errorMessage"] = "";
#define HANDLE_SGX_EXCEPTION(_RESULT_) catch (SGXException &__e) { Log::handleSGXException(_RESULT_, __e);}
#define LOCK(__M__) lock_guard<recursive_mutex> lock(__M__);
#endif
#endif
SGXWalletServer.cpp
View file @
86e8b271
...
@@ -41,9 +41,8 @@
...
@@ -41,9 +41,8 @@
#include "ServerInit.h"
#include "ServerInit.h"
#include "
spdlog/spdl
og.h"
#include "
L
og.h"
#include "common.h"
void
setFullOptions
(
int
_printDebugInfo
,
void
setFullOptions
(
int
_printDebugInfo
,
int
_printTraceInfo
,
int
_useHTTPS
,
int
_autoconfirm
,
int
_encryptKeys
)
{
int
_printTraceInfo
,
int
_useHTTPS
,
int
_autoconfirm
,
int
_encryptKeys
)
{
...
@@ -83,7 +82,7 @@ SGXWalletServer::SGXWalletServer(AbstractServerConnector &_connector,
...
@@ -83,7 +82,7 @@ SGXWalletServer::SGXWalletServer(AbstractServerConnector &_connector,
:
AbstractStubServer
(
_connector
,
_type
)
{}
:
AbstractStubServer
(
_connector
,
_type
)
{}
void
SGXWalletServer
::
printDB
()
{
void
SGXWalletServer
::
printDB
()
{
cout
<<
"
HERE ARE YOUR KEYS
: "
<<
endl
;
cout
<<
"
PRINTING LEVELDB
: "
<<
endl
;
class
MyVisitor
:
public
LevelDB
::
KeyVisitor
{
class
MyVisitor
:
public
LevelDB
::
KeyVisitor
{
public
:
public
:
virtual
void
visitDBKey
(
const
char
*
_data
)
{
virtual
void
visitDBKey
(
const
char
*
_data
)
{
...
@@ -296,19 +295,13 @@ Json::Value SGXWalletServer::generateECDSAKeyImpl() {
...
@@ -296,19 +295,13 @@ Json::Value SGXWalletServer::generateECDSAKeyImpl() {
result
[
"PublicKey"
]
=
keys
.
at
(
1
);
result
[
"PublicKey"
]
=
keys
.
at
(
1
);
result
[
"keyName"
]
=
keyName
;
result
[
"keyName"
]
=
keyName
;
}
catch
(
SGXException
&
_e
)
{
}
HANDLE_SGX_EXCEPTION
(
result
)
cerr
<<
" err str "
<<
_e
.
errString
<<
endl
;
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
}
return
result
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
renameECDSAKeyImpl
(
const
string
&
_keyName
,
const
string
&
_tempKeyName
)
{
Json
::
Value
SGXWalletServer
::
renameECDSAKeyImpl
(
const
string
&
_keyName
,
const
string
&
_tempKeyName
)
{
Json
::
Value
result
;
INIT_RESULT
(
result
)
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
result
[
"encryptedKey"
]
=
""
;
result
[
"encryptedKey"
]
=
""
;
try
{
try
{
...
@@ -327,24 +320,22 @@ Json::Value SGXWalletServer::renameECDSAKeyImpl(const string &_keyName, const st
...
@@ -327,24 +320,22 @@ Json::Value SGXWalletServer::renameECDSAKeyImpl(const string &_keyName, const st
}
}
shared_ptr
<
string
>
key_ptr
=
readFromDb
(
_tempKeyName
);
shared_ptr
<
string
>
key_ptr
=
readFromDb
(
_tempKeyName
);
cerr
<<
"new key name is "
<<
_keyName
<<
endl
;
writeDataToDB
(
_keyName
,
*
key_ptr
);
writeDataToDB
(
_keyName
,
*
key_ptr
);
LevelDB
::
getLevelDb
()
->
deleteTempNEK
(
_tempKeyName
);
LevelDB
::
getLevelDb
()
->
deleteTempNEK
(
_tempKeyName
);
}
catch
(
SGXException
&
_e
)
{
}
HANDLE_SGX_EXCEPTION
(
result
)
cerr
<<
" err str "
<<
_e
.
errString
<<
endl
;
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
}
return
result
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
ecdsaSignMessageHashImpl
(
int
_base
,
const
string
&
_keyName
,
const
string
&
_messageHash
)
{
Json
::
Value
SGXWalletServer
::
ecdsaSignMessageHashImpl
(
int
_base
,
const
string
&
_keyName
,
const
string
&
_messageHash
)
{
Json
::
Value
result
;
result
[
"status"
]
=
0
;
INIT_RESULT
(
result
)
result
[
"errorMessage"
]
=
""
;
result
[
"signature_v"
]
=
""
;
result
[
"signature_v"
]
=
""
;
result
[
"signature_r"
]
=
""
;
result
[
"signature_r"
]
=
""
;
result
[
"signature_s"
]
=
""
;
result
[
"signature_s"
]
=
""
;
...
@@ -384,19 +375,15 @@ Json::Value SGXWalletServer::ecdsaSignMessageHashImpl(int _base, const string &_
...
@@ -384,19 +375,15 @@ Json::Value SGXWalletServer::ecdsaSignMessageHashImpl(int _base, const string &_
result
[
"signature_r"
]
=
sign_vect
.
at
(
1
);
result
[
"signature_r"
]
=
sign_vect
.
at
(
1
);
result
[
"signature_s"
]
=
sign_vect
.
at
(
2
);
result
[
"signature_s"
]
=
sign_vect
.
at
(
2
);
}
catch
(
SGXException
&
_e
)
{
}
HANDLE_SGX_EXCEPTION
(
result
)
cerr
<<
"err str "
<<
_e
.
errString
<<
endl
;
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
}
return
result
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
getPublicECDSAKeyImpl
(
const
string
&
_keyName
)
{
Json
::
Value
SGXWalletServer
::
getPublicECDSAKeyImpl
(
const
string
&
_keyName
)
{
Json
::
Value
result
;
result
[
"status"
]
=
0
;
INIT_RESULT
(
result
)
result
[
"errorMessage"
]
=
""
;
result
[
"publicKey"
]
=
""
;
result
[
"publicKey"
]
=
""
;
result
[
"PublicKey"
]
=
""
;
result
[
"PublicKey"
]
=
""
;
...
@@ -414,20 +401,14 @@ Json::Value SGXWalletServer::getPublicECDSAKeyImpl(const string &_keyName) {
...
@@ -414,20 +401,14 @@ Json::Value SGXWalletServer::getPublicECDSAKeyImpl(const string &_keyName) {
result
[
"PublicKey"
]
=
publicKey
;
result
[
"PublicKey"
]
=
publicKey
;
result
[
"publicKey"
]
=
publicKey
;
result
[
"publicKey"
]
=
publicKey
;
}
catch
(
SGXException
&
_e
)
{
}
HANDLE_SGX_EXCEPTION
(
result
)
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
}
return
result
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
generateDKGPolyImpl
(
const
string
&
_polyName
,
int
_t
)
{
Json
::
Value
SGXWalletServer
::
generateDKGPolyImpl
(
const
string
&
_polyName
,
int
_t
)
{
Json
::
Value
result
;
INIT_RESULT
(
result
)
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
//result["encryptedPoly"] = "";
string
encrPolyHex
;
string
encrPolyHex
;
...
@@ -442,12 +423,8 @@ Json::Value SGXWalletServer::generateDKGPolyImpl(const string &_polyName, int _t
...
@@ -442,12 +423,8 @@ Json::Value SGXWalletServer::generateDKGPolyImpl(const string &_polyName, int _t
encrPolyHex
=
gen_dkg_poly
(
_t
);
encrPolyHex
=
gen_dkg_poly
(
_t
);
writeDataToDB
(
_polyName
,
encrPolyHex
);
writeDataToDB
(
_polyName
,
encrPolyHex
);
//result["encryptedPoly"] = encrPolyHex;
}
catch
(
SGXException
&
_e
)
{
}
HANDLE_SGX_EXCEPTION
(
result
)
cerr
<<
" err str "
<<
_e
.
errString
<<
endl
;
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
}
return
result
;
return
result
;
}
}
...
@@ -619,21 +596,14 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string
...
@@ -619,21 +596,14 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string
LevelDB
::
getLevelDb
()
->
deleteKey
(
shareG2_name
);
LevelDB
::
getLevelDb
()
->
deleteKey
(
shareG2_name
);
}
}
}
catch
(
SGXException
&
_e
)
{
}
HANDLE_SGX_EXCEPTION
(
result
)
//cerr << " err str " << _e.errString << endl;
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
}
return
result
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
getBLSPublicKeyShareImpl
(
const
string
&
_blsKeyName
)
{
Json
::
Value
SGXWalletServer
::
getBLSPublicKeyShareImpl
(
const
string
&
_blsKeyName
)
{
Json
::
Value
result
;
INIT_RESULT
(
result
)
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
try
{
try
{
if
(
!
checkName
(
_blsKeyName
,
"BLS_KEY"
))
{
if
(
!
checkName
(
_blsKeyName
,
"BLS_KEY"
))
{
...
@@ -649,21 +619,15 @@ Json::Value SGXWalletServer::getBLSPublicKeyShareImpl(const string &_blsKeyName)
...
@@ -649,21 +619,15 @@ Json::Value SGXWalletServer::getBLSPublicKeyShareImpl(const string &_blsKeyName)
result
[
"BlsPublicKeyShare"
][
i
]
=
public_key_vect
.
at
(
i
);
result
[
"BlsPublicKeyShare"
][
i
]
=
public_key_vect
.
at
(
i
);
}
}
}
catch
(
SGXException
&
_e
)
{
}
HANDLE_SGX_EXCEPTION
(
result
)
cerr
<<
" err str "
<<
_e
.
errString
<<
endl
;
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
}
//debug_print();
return
result
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
complaintResponseImpl
(
const
string
&
_polyName
,
int
_ind
)
{
Json
::
Value
SGXWalletServer
::
complaintResponseImpl
(
const
string
&
_polyName
,
int
_ind
)
{
Json
::
Value
result
;
result
[
"status"
]
=
0
;
INIT_RESULT
(
result
)
result
[
"errorMessage"
]
=
""
;
try
{
try
{
if
(
!
checkName
(
_polyName
,
"POLY"
))
{
if
(
!
checkName
(
_polyName
,
"POLY"
))
{
throw
SGXException
(
INVALID_POLY_NAME
,
"Invalid polynomial name"
);
throw
SGXException
(
INVALID_POLY_NAME
,
"Invalid polynomial name"
);
...
@@ -677,82 +641,65 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int
...
@@ -677,82 +641,65 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int
result
[
"dhKey"
]
=
DHKey
;
result
[
"dhKey"
]
=
DHKey
;
result
[
"DHKey"
]
=
DHKey
;
result
[
"DHKey"
]
=
DHKey
;
}
catch
(
SGXException
&
_e
)
{
}
HANDLE_SGX_EXCEPTION
(
result
)
cerr
<<
" err str "
<<
_e
.
errString
<<
endl
;
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
}
return
result
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
multG2Impl
(
const
string
&
_x
)
{
Json
::
Value
SGXWalletServer
::
multG2Impl
(
const
string
&
_x
)
{
Json
::
Value
result
;
result
[
"status"
]
=
0
;
INIT_RESULT
(
result
)
result
[
"errorMessage"
]
=
""
;
try
{
try
{
vector
<
string
>
xG2_vect
=
mult_G2
(
_x
);
auto
xG2_vect
=
mult_G2
(
_x
);
for
(
uint8_t
i
=
0
;
i
<
4
;
i
++
)
{
for
(
uint8_t
i
=
0
;
i
<
4
;
i
++
)
{
result
[
"x*G2"
][
i
]
=
xG2_vect
.
at
(
i
);
result
[
"x*G2"
][
i
]
=
xG2_vect
.
at
(
i
);
}
}
}
catch
(
SGXException
&
_e
)
{
}
HANDLE_SGX_EXCEPTION
(
result
)
cerr
<<
" err str "
<<
_e
.
errString
<<
endl
;
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
}
return
result
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
isPolyExistsImpl
(
const
string
&
_polyName
)
{
Json
::
Value
SGXWalletServer
::
isPolyExistsImpl
(
const
string
&
_polyName
)
{
Json
::
Value
result
;
INIT_RESULT
(
result
)
result
[
"IsExist"
]
=
false
;
result
[
"exists"
]
=
false
;
try
{
try
{
std
::
shared_ptr
<
std
::
string
>
poly_str_ptr
=
LevelDB
::
getLevelDb
()
->
readString
(
_polyName
);
std
::
shared_ptr
<
std
::
string
>
poly_str_ptr
=
LevelDB
::
getLevelDb
()
->
readString
(
_polyName
);
result
[
"IsExist"
]
=
true
;
result
[
"exists"
]
=
true
;
if
(
poly_str_ptr
!=
nullptr
)
{
result
[
"status"
]
=
0
;
result
[
"IsExist"
]
=
true
;
result
[
"errorMessage"
]
=
""
;
result
[
"exists"
]
=
true
;
if
(
poly_str_ptr
==
nullptr
)
{
result
[
"IsExist"
]
=
false
;
result
[
"exists"
]
=
false
;
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
}
}
}
catch
(
SGXException
&
_e
)
{
}
HANDLE_SGX_EXCEPTION
(
result
)
std
::
cerr
<<
" err str "
<<
_e
.
errString
<<
std
::
endl
;
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
result
[
"IsExist"
]
=
false
;
result
[
"exists"
]
=
false
;
}
return
result
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
getServerStatusImpl
()
{
Json
::
Value
SGXWalletServer
::
getServerStatusImpl
()
{
Json
::
Value
result
;
INIT_RESULT
(
result
)
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
return
result
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
generateDKGPoly
(
const
string
&
_polyName
,
int
_t
)
{
Json
::
Value
SGXWalletServer
::
generateDKGPoly
(
const
string
&
_polyName
,
int
_t
)
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
return
generateDKGPolyImpl
(
_polyName
,
_t
);
return
generateDKGPolyImpl
(
_polyName
,
_t
);
}
}
Json
::
Value
SGXWalletServer
::
getVerificationVector
(
const
string
&
_polynomeName
,
int
_t
,
int
_n
)
{
Json
::
Value
SGXWalletServer
::
getVerificationVector
(
const
string
&
_polynomeName
,
int
_t
,
int
_n
)
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
return
getVerificationVectorImpl
(
_polynomeName
,
_t
,
_n
);
return
getVerificationVectorImpl
(
_polynomeName
,
_t
,
_n
);
}
}
Json
::
Value
SGXWalletServer
::
getSecretShare
(
const
string
&
_polyName
,
const
Json
::
Value
&
_publicKeys
,
int
t
,
int
n
)
{
Json
::
Value
SGXWalletServer
::
getSecretShare
(
const
string
&
_polyName
,
const
Json
::
Value
&
_publicKeys
,
int
t
,
int
n
)
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
return
getSecretShareImpl
(
_polyName
,
_publicKeys
,
t
,
n
);
return
getSecretShareImpl
(
_polyName
,
_publicKeys
,
t
,
n
);
}
}
...
@@ -760,41 +707,41 @@ Json::Value
...
@@ -760,41 +707,41 @@ Json::Value
SGXWalletServer
::
dkgVerification
(
const
string
&
_publicShares
,
const
string
&
ethKeyName
,
const
string
&
SecretShare
,
SGXWalletServer
::
dkgVerification
(
const
string
&
_publicShares
,
const
string
&
ethKeyName
,
const
string
&
SecretShare
,
int
t
,
int
t
,
int
n
,
int
index
)
{
int
n
,
int
index
)
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
return
dkgVerificationImpl
(
_publicShares
,
ethKeyName
,
SecretShare
,
t
,
n
,
index
);
return
dkgVerificationImpl
(
_publicShares
,
ethKeyName
,
SecretShare
,
t
,
n
,
index
);
}
}
Json
::
Value
Json
::
Value
SGXWalletServer
::
createBLSPrivateKey
(
const
string
&
blsKeyName
,
const
string
&
ethKeyName
,
const
string
&
polyName
,
SGXWalletServer
::
createBLSPrivateKey
(
const
string
&
blsKeyName
,
const
string
&
ethKeyName
,
const
string
&
polyName
,
const
string
&
SecretShare
,
int
t
,
int
n
)
{
const
string
&
SecretShare
,
int
t
,
int
n
)
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
return
createBLSPrivateKeyImpl
(
blsKeyName
,
ethKeyName
,
polyName
,
SecretShare
,
t
,
n
);
return
createBLSPrivateKeyImpl
(
blsKeyName
,
ethKeyName
,
polyName
,
SecretShare
,
t
,
n
);
}
}
Json
::
Value
SGXWalletServer
::
getBLSPublicKeyShare
(
const
string
&
blsKeyName
)
{
Json
::
Value
SGXWalletServer
::
getBLSPublicKeyShare
(
const
string
&
blsKeyName
)
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
return
getBLSPublicKeyShareImpl
(
blsKeyName
);
return
getBLSPublicKeyShareImpl
(
blsKeyName
);
}
}
Json
::
Value
SGXWalletServer
::
generateECDSAKey
()
{
Json
::
Value
SGXWalletServer
::
generateECDSAKey
()
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
return
generateECDSAKeyImpl
();
return
generateECDSAKeyImpl
();
}
}
Json
::
Value
SGXWalletServer
::
renameECDSAKey
(
const
string
&
_keyName
,
const
string
&
_tmpKeyName
)
{
Json
::
Value
SGXWalletServer
::
renameECDSAKey
(
const
string
&
_keyName
,
const
string
&
_tmpKeyName
)
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
return
renameECDSAKeyImpl
(
_keyName
,
_tmpKeyName
);
return
renameECDSAKeyImpl
(
_keyName
,
_tmpKeyName
);
}
}
Json
::
Value
SGXWalletServer
::
getPublicECDSAKey
(
const
string
&
_keyName
)
{
Json
::
Value
SGXWalletServer
::
getPublicECDSAKey
(
const
string
&
_keyName
)
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
return
getPublicECDSAKeyImpl
(
_keyName
);
return
getPublicECDSAKeyImpl
(
_keyName
);
}
}
Json
::
Value
SGXWalletServer
::
ecdsaSignMessageHash
(
int
_base
,
const
string
&
_keyShareName
,
const
string
&
_messageHash
)
{
Json
::
Value
SGXWalletServer
::
ecdsaSignMessageHash
(
int
_base
,
const
string
&
_keyShareName
,
const
string
&
_messageHash
)
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
spdlog
::
debug
(
"MessageHash first {}"
,
_messageHash
);
spdlog
::
debug
(
"MessageHash first {}"
,
_messageHash
);
return
ecdsaSignMessageHashImpl
(
_base
,
_keyShareName
,
_messageHash
);
return
ecdsaSignMessageHashImpl
(
_base
,
_keyShareName
,
_messageHash
);
}
}
...
@@ -803,38 +750,38 @@ Json::Value SGXWalletServer::ecdsaSignMessageHash(int _base, const string &_keyS
...
@@ -803,38 +750,38 @@ Json::Value SGXWalletServer::ecdsaSignMessageHash(int _base, const string &_keyS
Json
::
Value
Json
::
Value
SGXWalletServer
::
importBLSKeyShare
(
const
string
&
_keyShare
,
const
string
&
_keyShareName
,
int
_t
,
int
_n
,
SGXWalletServer
::
importBLSKeyShare
(
const
string
&
_keyShare
,
const
string
&
_keyShareName
,
int
_t
,
int
_n
,
int
index
)
{
int
index
)
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
return
importBLSKeyShareImpl
(
_keyShare
,
_keyShareName
,
_t
,
_n
,
index
);
return
importBLSKeyShareImpl
(
_keyShare
,
_keyShareName
,
_t
,
_n
,
index
);
}
}
Json
::
Value
SGXWalletServer
::
blsSignMessageHash
(
const
string
&
_keyShareName
,
const
string
&
_messageHash
,
int
_t
,
int
_n
,
Json
::
Value
SGXWalletServer
::
blsSignMessageHash
(
const
string
&
_keyShareName
,
const
string
&
_messageHash
,
int
_t
,
int
_n
,
int
_signerIndex
)
{
int
_signerIndex
)
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
return
blsSignMessageHashImpl
(
_keyShareName
,
_messageHash
,
_t
,
_n
,
_signerIndex
);
return
blsSignMessageHashImpl
(
_keyShareName
,
_messageHash
,
_t
,
_n
,
_signerIndex
);
}
}
Json
::
Value
SGXWalletServer
::
importECDSAKey
(
const
string
&
_key
,
const
string
&
_keyName
)
{
Json
::
Value
SGXWalletServer
::
importECDSAKey
(
const
string
&
_key
,
const
string
&
_keyName
)
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
return
importECDSAKeyImpl
(
_key
,
_keyName
);
return
importECDSAKeyImpl
(
_key
,
_keyName
);
}
}
Json
::
Value
SGXWalletServer
::
complaintResponse
(
const
string
&
polyName
,
int
ind
)
{
Json
::
Value
SGXWalletServer
::
complaintResponse
(
const
string
&
polyName
,
int
ind
)
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
return
complaintResponseImpl
(
polyName
,
ind
);
return
complaintResponseImpl
(
polyName
,
ind
);
}
}
Json
::
Value
SGXWalletServer
::
multG2
(
const
string
&
x
)
{
Json
::
Value
SGXWalletServer
::
multG2
(
const
string
&
x
)
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
return
multG2Impl
(
x
);
return
multG2Impl
(
x
);
}
}
Json
::
Value
SGXWalletServer
::
isPolyExists
(
const
string
&
polyName
)
{
Json
::
Value
SGXWalletServer
::
isPolyExists
(
const
string
&
polyName
)
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
return
isPolyExistsImpl
(
polyName
);
return
isPolyExistsImpl
(
polyName
);
}
}
Json
::
Value
SGXWalletServer
::
getServerStatus
()
{
Json
::
Value
SGXWalletServer
::
getServerStatus
()
{
lock_guard
<
recursive_mutex
>
lock
(
m
);
LOCK
(
m
)
return
getServerStatusImpl
();
return
getServerStatusImpl
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment