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
fc1458a2
Unverified
Commit
fc1458a2
authored
Jun 23, 2020
by
Oleh Nikolaiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2794 refactoring
parent
17310b56
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
37 additions
and
164 deletions
+37
-164
BLSCrypto.cpp
BLSCrypto.cpp
+1
-21
ECDSACrypto.cpp
ECDSACrypto.cpp
+0
-10
SGXWalletServer.cpp
SGXWalletServer.cpp
+10
-33
SGXWalletServer.h
SGXWalletServer.h
+0
-7
SGXWalletServer.hpp
SGXWalletServer.hpp
+0
-6
TestUtils.cpp
TestUtils.cpp
+1
-20
TestUtils.h
TestUtils.h
+0
-3
AESUtils.c
secure_enclave/AESUtils.c
+3
-7
sgxwall.cpp
sgxwall.cpp
+13
-34
sgxwall.h
sgxwall.h
+3
-3
sgxwallet_common.h
sgxwallet_common.h
+6
-19
stubclient.cpp
stubclient.cpp
+0
-1
No files found.
BLSCrypto.cpp
View file @
fc1458a2
...
@@ -183,22 +183,13 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
...
@@ -183,22 +183,13 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
throw
SGXException
(
INVALID_HEX
,
"Invalid hash"
);
throw
SGXException
(
INVALID_HEX
,
"Invalid hash"
);
}
}
// auto keyShare = make_shared<BLSPrivateKeyShareSGX>(keyStr, _t, _n);
//
// auto sigShare = keyShare->signWithHelperSGX(hash, _signerIndex);
//
// auto sigShareStr = sigShare->toString();
//
// strncpy(_sig, sigShareStr->c_str(), BUF_LEN);
shared_ptr
<
signatures
::
Bls
>
obj
;
shared_ptr
<
signatures
::
Bls
>
obj
;
obj
=
make_shared
<
signatures
::
Bls
>
(
signatures
::
Bls
(
_t
,
_n
));
obj
=
make_shared
<
signatures
::
Bls
>
(
signatures
::
Bls
(
_t
,
_n
));
std
::
pair
<
libff
::
alt_bn128_G1
,
std
::
string
>
hash_with_hint
=
std
::
pair
<
libff
::
alt_bn128_G1
,
std
::
string
>
hash_with_hint
=
obj
->
HashtoG1withHint
(
hash
);
obj
->
HashtoG1withHint
(
hash
);
int
errStatus
=
0
;
int
errStatus
=
0
;
string
*
xStr
=
FqToString
(
&
(
hash_with_hint
.
first
.
X
));
string
*
xStr
=
FqToString
(
&
(
hash_with_hint
.
first
.
X
));
if
(
xStr
==
nullptr
)
{
if
(
xStr
==
nullptr
)
{
...
@@ -213,7 +204,6 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
...
@@ -213,7 +204,6 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
BOOST_THROW_EXCEPTION
(
runtime_error
(
"Null yStr"
));
BOOST_THROW_EXCEPTION
(
runtime_error
(
"Null yStr"
));
}
}
char
errMsg
[
BUF_LEN
];
char
errMsg
[
BUF_LEN
];
memset
(
errMsg
,
0
,
BUF_LEN
);
memset
(
errMsg
,
0
,
BUF_LEN
);
...
@@ -257,13 +247,6 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
...
@@ -257,13 +247,6 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
strncpy
(
_sig
,
sig
.
c_str
(),
BUF_LEN
);
strncpy
(
_sig
,
sig
.
c_str
(),
BUF_LEN
);
//string sigShareStr = keyShare->signWithHelperSGXstr(hash, _signerIndex);
//strncpy(_sig, sigShareStr.c_str(), BUF_LEN);
// string test_sig = "8175162913343900215959836578795929492705714455632345516427532159927644835012:15265825550804683171644566522808807137117748565649051208189914766494241035855:9810286616503120081238481858289626967170509983220853777870754480048381194141:5";
// auto sig_ptr = make_shared<string>(test_sig);
// strncpy(_sig, sig_ptr->c_str(), BUF_LEN);
return
true
;
return
true
;
}
}
...
@@ -286,9 +269,7 @@ char *encryptBLSKeyShare2Hex(int *errStatus, char *err_string, const char *_key)
...
@@ -286,9 +269,7 @@ char *encryptBLSKeyShare2Hex(int *errStatus, char *err_string, const char *_key)
spdlog
::
debug
(
"errStatus is {}"
,
*
errStatus
);
spdlog
::
debug
(
"errStatus is {}"
,
*
errStatus
);
spdlog
::
debug
(
" errMsg is "
,
errMsg
->
data
());
spdlog
::
debug
(
" errMsg is "
,
errMsg
->
data
());
if
(
status
!=
SGX_SUCCESS
)
{
if
(
status
!=
SGX_SUCCESS
)
{
*
errStatus
=
-
1
;
*
errStatus
=
-
1
;
return
nullptr
;
return
nullptr
;
}
}
...
@@ -297,7 +278,6 @@ char *encryptBLSKeyShare2Hex(int *errStatus, char *err_string, const char *_key)
...
@@ -297,7 +278,6 @@ char *encryptBLSKeyShare2Hex(int *errStatus, char *err_string, const char *_key)
throw
SGXException
(
-
666
,
errMsg
->
data
());
throw
SGXException
(
-
666
,
errMsg
->
data
());
}
}
char
*
result
=
(
char
*
)
calloc
(
2
*
BUF_LEN
,
1
);
char
*
result
=
(
char
*
)
calloc
(
2
*
BUF_LEN
,
1
);
carray2Hex
(
encryptedKey
->
data
(),
encryptedLen
,
result
);
carray2Hex
(
encryptedKey
->
data
(),
encryptedLen
,
result
);
...
...
ECDSACrypto.cpp
View file @
fc1458a2
...
@@ -31,25 +31,15 @@
...
@@ -31,25 +31,15 @@
#include <gmp.h>
#include <gmp.h>
#include <random>
#include <random>
#include "spdlog/spdlog.h"
#include "spdlog/spdlog.h"
#include "common.h"
#include "common.h"
#include "secure_enclave/Verify.h"
#include "secure_enclave/Verify.h"
#include "BLSCrypto.h"
#include "BLSCrypto.h"
#include "ECDSACrypto.h"
#include "ECDSACrypto.h"
string
concatPubKeyWith0x
(
char
*
pub_key_x
,
char
*
pub_key_y
)
{
string
px
=
pub_key_x
;
string
py
=
pub_key_y
;
string
result
=
"0x"
+
px
+
py
;
return
result
;
}
void
fillRandomBuffer
(
vector
<
unsigned
char
>
&
_buffer
)
{
void
fillRandomBuffer
(
vector
<
unsigned
char
>
&
_buffer
)
{
ifstream
devRandom
(
"/dev/urandom"
,
ios
::
in
|
ios
::
binary
);
ifstream
devRandom
(
"/dev/urandom"
,
ios
::
in
|
ios
::
binary
);
devRandom
.
exceptions
(
ifstream
::
failbit
|
ifstream
::
badbit
);
devRandom
.
exceptions
(
ifstream
::
failbit
|
ifstream
::
badbit
);
...
...
SGXWalletServer.cpp
View file @
fc1458a2
...
@@ -22,7 +22,6 @@
...
@@ -22,7 +22,6 @@
#include "sgxwallet_common.h"
#include "sgxwallet_common.h"
#include "SGXException.h"
#include "SGXException.h"
#include "LevelDB.h"
#include "LevelDB.h"
#include "BLSCrypto.h"
#include "BLSCrypto.h"
...
@@ -60,22 +59,19 @@ void setFullOptions(int _printDebugInfo,
...
@@ -60,22 +59,19 @@ void setFullOptions(int _printDebugInfo,
spdlog
::
info
(
"encryptKeys set to "
+
std
::
to_string
(
encryptKeys
));
spdlog
::
info
(
"encryptKeys set to "
+
std
::
to_string
(
encryptKeys
));
}
}
void
setOptions
(
int
_printDebugInfo
,
void
setOptions
(
int
_printDebugInfo
,
int
_printTraceInfo
,
int
_useHTTPS
,
int
_autoconfirm
)
{
int
_printTraceInfo
,
int
_useHTTPS
,
int
_autoconfirm
)
{
setFullOptions
(
_printDebugInfo
,
setFullOptions
(
_printDebugInfo
,
_printTraceInfo
,
_useHTTPS
,
_autoconfirm
,
false
);
_printTraceInfo
,
_useHTTPS
,
_autoconfirm
,
false
);
}
}
bool
isStringDec
(
const
string
&
_str
)
{
bool
isStringDec
(
string
&
_str
)
{
auto
res
=
find_if_not
(
_str
.
begin
(),
_str
.
end
(),
[](
char
c
)
->
bool
{
auto
res
=
find_if_not
(
_str
.
begin
(),
_str
.
end
(),
[](
char
c
)
->
bool
{
return
isdigit
(
c
);
return
isdigit
(
c
);
});
});
return
!
_str
.
empty
()
&&
res
==
_str
.
end
();
return
!
_str
.
empty
()
&&
res
==
_str
.
end
();
}
}
shared_ptr
<
SGXWalletServer
>
SGXWalletServer
::
server
=
nullptr
;
shared_ptr
<
SGXWalletServer
>
SGXWalletServer
::
server
=
nullptr
;
shared_ptr
<
HttpServer
>
SGXWalletServer
::
httpServer
=
nullptr
;
shared_ptr
<
HttpServer
>
SGXWalletServer
::
httpServer
=
nullptr
;
...
@@ -144,7 +140,6 @@ int SGXWalletServer::initHttpsServer(bool _checkCerts) {
...
@@ -144,7 +140,6 @@ int SGXWalletServer::initHttpsServer(bool _checkCerts) {
return
0
;
return
0
;
}
}
int
SGXWalletServer
::
initHttpServer
()
{
//without ssl
int
SGXWalletServer
::
initHttpServer
()
{
//without ssl
httpServer
=
make_shared
<
HttpServer
>
(
BASE_PORT
+
3
);
httpServer
=
make_shared
<
HttpServer
>
(
BASE_PORT
+
3
);
server
=
make_shared
<
SGXWalletServer
>
(
*
httpServer
,
server
=
make_shared
<
SGXWalletServer
>
(
*
httpServer
,
...
@@ -161,7 +156,7 @@ SGXWalletServer::importBLSKeyShareImpl(const string &_keyShare, const string &_k
...
@@ -161,7 +156,7 @@ SGXWalletServer::importBLSKeyShareImpl(const string &_keyShare, const string &_k
Json
::
Value
result
;
Json
::
Value
result
;
int
errStatus
=
UNKNOWN_ERROR
;
int
errStatus
=
UNKNOWN_ERROR
;
char
*
errMsg
=
(
char
*
)
calloc
(
BUF_LEN
,
1
);
string
errMsg
(
BUF_LEN
,
'\0'
);
result
[
"status"
]
=
0
;
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
result
[
"errorMessage"
]
=
""
;
...
@@ -170,14 +165,14 @@ SGXWalletServer::importBLSKeyShareImpl(const string &_keyShare, const string &_k
...
@@ -170,14 +165,14 @@ SGXWalletServer::importBLSKeyShareImpl(const string &_keyShare, const string &_k
char
*
encryptedKeyShareHex
=
nullptr
;
char
*
encryptedKeyShareHex
=
nullptr
;
try
{
try
{
encryptedKeyShareHex
=
encryptBLSKeyShare2Hex
(
&
errStatus
,
errMsg
,
_keyShare
.
c_str
());
encryptedKeyShareHex
=
encryptBLSKeyShare2Hex
(
&
errStatus
,
&
errMsg
.
front
()
,
_keyShare
.
c_str
());
if
(
e
ncryptedKeyShareHex
==
nullptr
)
{
if
(
e
rrStatus
!=
0
)
{
throw
SGXException
(
UNKNOWN_ERROR
,
""
);
throw
SGXException
(
errStatus
,
errMsg
.
data
()
);
}
}
if
(
e
rrStatus
!=
0
)
{
if
(
e
ncryptedKeyShareHex
==
nullptr
)
{
throw
SGXException
(
errStatus
,
errMsg
);
throw
SGXException
(
UNKNOWN_ERROR
,
""
);
}
}
result
[
"encryptedKeyShare"
]
=
string
(
encryptedKeyShareHex
);
result
[
"encryptedKeyShare"
]
=
string
(
encryptedKeyShareHex
);
...
@@ -203,7 +198,8 @@ SGXWalletServer::blsSignMessageHashImpl(const string &_keyShareName, const strin
...
@@ -203,7 +198,8 @@ SGXWalletServer::blsSignMessageHashImpl(const string &_keyShareName, const strin
result
[
"errorMessage"
]
=
"Unknown server error"
;
result
[
"errorMessage"
]
=
"Unknown server error"
;
result
[
"signatureShare"
]
=
""
;
result
[
"signatureShare"
]
=
""
;
char
*
signature
=
(
char
*
)
calloc
(
BUF_LEN
,
1
);
// char *signature = (char *) calloc(BUF_LEN, 1); // remove
string
signature
(
BUF_LEN
,
'\0'
);
shared_ptr
<
string
>
value
=
nullptr
;
shared_ptr
<
string
>
value
=
nullptr
;
...
@@ -237,7 +233,7 @@ SGXWalletServer::blsSignMessageHashImpl(const string &_keyShareName, const strin
...
@@ -237,7 +233,7 @@ SGXWalletServer::blsSignMessageHashImpl(const string &_keyShareName, const strin
}
}
try
{
try
{
if
(
!
bls_sign
(
value
->
c_str
(),
_messageHash
.
c_str
(),
t
,
n
,
_signerIndex
,
signature
))
{
if
(
!
bls_sign
(
value
->
c_str
(),
_messageHash
.
c_str
(),
t
,
n
,
_signerIndex
,
&
signature
.
front
()
))
{
result
[
"status"
]
=
-
1
;
result
[
"status"
]
=
-
1
;
result
[
"errorMessage"
]
=
"Could not sign"
;
result
[
"errorMessage"
]
=
"Could not sign"
;
return
result
;
return
result
;
...
@@ -254,7 +250,6 @@ SGXWalletServer::blsSignMessageHashImpl(const string &_keyShareName, const strin
...
@@ -254,7 +250,6 @@ SGXWalletServer::blsSignMessageHashImpl(const string &_keyShareName, const strin
return
result
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
importECDSAKeyImpl
(
const
string
&
_key
,
const
string
&
_keyName
)
{
Json
::
Value
SGXWalletServer
::
importECDSAKeyImpl
(
const
string
&
_key
,
const
string
&
_keyName
)
{
Json
::
Value
result
;
Json
::
Value
result
;
result
[
"status"
]
=
0
;
result
[
"status"
]
=
0
;
...
@@ -263,14 +258,12 @@ Json::Value SGXWalletServer::importECDSAKeyImpl(const string &_key, const string
...
@@ -263,14 +258,12 @@ Json::Value SGXWalletServer::importECDSAKeyImpl(const string &_key, const string
return
result
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
generateECDSAKeyImpl
()
{
Json
::
Value
SGXWalletServer
::
generateECDSAKeyImpl
()
{
Json
::
Value
result
;
Json
::
Value
result
;
result
[
"status"
]
=
0
;
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
result
[
"errorMessage"
]
=
""
;
result
[
"encryptedKey"
]
=
""
;
result
[
"encryptedKey"
]
=
""
;
vector
<
string
>
keys
;
vector
<
string
>
keys
;
try
{
try
{
...
@@ -291,7 +284,6 @@ Json::Value SGXWalletServer::generateECDSAKeyImpl() {
...
@@ -291,7 +284,6 @@ Json::Value SGXWalletServer::generateECDSAKeyImpl() {
result
[
"publicKey"
]
=
keys
.
at
(
1
);
result
[
"publicKey"
]
=
keys
.
at
(
1
);
result
[
"PublicKey"
]
=
keys
.
at
(
1
);
result
[
"PublicKey"
]
=
keys
.
at
(
1
);
result
[
"keyName"
]
=
keyName
;
result
[
"keyName"
]
=
keyName
;
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
return
result
;
return
result
;
...
@@ -319,13 +311,11 @@ Json::Value SGXWalletServer::renameECDSAKeyImpl(const string &_keyName, const st
...
@@ -319,13 +311,11 @@ Json::Value SGXWalletServer::renameECDSAKeyImpl(const string &_keyName, const st
writeDataToDB
(
_keyName
,
*
encryptedKey
);
writeDataToDB
(
_keyName
,
*
encryptedKey
);
LevelDB
::
getLevelDb
()
->
deleteTempNEK
(
_tempKeyName
);
LevelDB
::
getLevelDb
()
->
deleteTempNEK
(
_tempKeyName
);
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
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
)
{
INIT_RESULT
(
result
)
INIT_RESULT
(
result
)
...
@@ -366,7 +356,6 @@ Json::Value SGXWalletServer::ecdsaSignMessageHashImpl(int _base, const string &_
...
@@ -366,7 +356,6 @@ Json::Value SGXWalletServer::ecdsaSignMessageHashImpl(int _base, const string &_
result
[
"signature_v"
]
=
signatureVector
.
at
(
0
);
result
[
"signature_v"
]
=
signatureVector
.
at
(
0
);
result
[
"signature_r"
]
=
signatureVector
.
at
(
1
);
result
[
"signature_r"
]
=
signatureVector
.
at
(
1
);
result
[
"signature_s"
]
=
signatureVector
.
at
(
2
);
result
[
"signature_s"
]
=
signatureVector
.
at
(
2
);
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
return
result
;
return
result
;
...
@@ -391,7 +380,6 @@ Json::Value SGXWalletServer::getPublicECDSAKeyImpl(const string &_keyName) {
...
@@ -391,7 +380,6 @@ Json::Value SGXWalletServer::getPublicECDSAKeyImpl(const string &_keyName) {
result
[
"PublicKey"
]
=
publicKey
;
result
[
"PublicKey"
]
=
publicKey
;
result
[
"publicKey"
]
=
publicKey
;
result
[
"publicKey"
]
=
publicKey
;
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
return
result
;
return
result
;
...
@@ -412,8 +400,6 @@ Json::Value SGXWalletServer::generateDKGPolyImpl(const string &_polyName, int _t
...
@@ -412,8 +400,6 @@ 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
);
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
return
result
;
return
result
;
...
@@ -610,11 +596,9 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int
...
@@ -610,11 +596,9 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int
result
[
"share*G2"
]
=
*
shareG2_ptr
;
result
[
"share*G2"
]
=
*
shareG2_ptr
;
result
[
"dhKey"
]
=
DHKey
;
result
[
"dhKey"
]
=
DHKey
;
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
return
result
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
multG2Impl
(
const
string
&
_x
)
{
Json
::
Value
SGXWalletServer
::
multG2Impl
(
const
string
&
_x
)
{
...
@@ -625,7 +609,6 @@ Json::Value SGXWalletServer::multG2Impl(const string &_x) {
...
@@ -625,7 +609,6 @@ Json::Value SGXWalletServer::multG2Impl(const string &_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
);
}
}
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
return
result
;
return
result
;
...
@@ -653,14 +636,12 @@ Json::Value SGXWalletServer::getServerStatusImpl() {
...
@@ -653,14 +636,12 @@ Json::Value SGXWalletServer::getServerStatusImpl() {
return
result
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
getServerVersionImpl
()
{
Json
::
Value
SGXWalletServer
::
getServerVersionImpl
()
{
INIT_RESULT
(
result
)
INIT_RESULT
(
result
)
result
[
"version"
]
=
TOSTRING
(
SGXWALLET_VERSION
);
result
[
"version"
]
=
TOSTRING
(
SGXWALLET_VERSION
);
return
result
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
generateDKGPoly
(
const
string
&
_polyName
,
int
_t
)
{
Json
::
Value
SGXWalletServer
::
generateDKGPoly
(
const
string
&
_polyName
,
int
_t
)
{
WRITE_LOCK
(
m
)
WRITE_LOCK
(
m
)
return
generateDKGPolyImpl
(
_polyName
,
_t
);
return
generateDKGPolyImpl
(
_polyName
,
_t
);
...
@@ -696,7 +677,6 @@ Json::Value SGXWalletServer::getBLSPublicKeyShare(const string &blsKeyName) {
...
@@ -696,7 +677,6 @@ Json::Value SGXWalletServer::getBLSPublicKeyShare(const string &blsKeyName) {
return
getBLSPublicKeyShareImpl
(
blsKeyName
);
return
getBLSPublicKeyShareImpl
(
blsKeyName
);
}
}
Json
::
Value
SGXWalletServer
::
generateECDSAKey
()
{
Json
::
Value
SGXWalletServer
::
generateECDSAKey
()
{
WRITE_LOCK
(
m
)
WRITE_LOCK
(
m
)
return
generateECDSAKeyImpl
();
return
generateECDSAKeyImpl
();
...
@@ -712,14 +692,12 @@ Json::Value SGXWalletServer::getPublicECDSAKey(const string &_keyName) {
...
@@ -712,14 +692,12 @@ Json::Value SGXWalletServer::getPublicECDSAKey(const string &_keyName) {
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
)
{
READ_LOCK
(
m
)
READ_LOCK
(
m
)
spdlog
::
debug
(
"MessageHash first {}"
,
_messageHash
);
spdlog
::
debug
(
"MessageHash first {}"
,
_messageHash
);
return
ecdsaSignMessageHashImpl
(
_base
,
_keyShareName
,
_messageHash
);
return
ecdsaSignMessageHashImpl
(
_base
,
_keyShareName
,
_messageHash
);
}
}
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
)
{
...
@@ -819,4 +797,3 @@ void SGXWalletServer::writeDataToDB(const string &Name, const string &value) {
...
@@ -819,4 +797,3 @@ void SGXWalletServer::writeDataToDB(const string &Name, const string &value) {
LevelDB
::
getLevelDb
()
->
writeString
(
key
,
value
);
LevelDB
::
getLevelDb
()
->
writeString
(
key
,
value
);
}
}
SGXWalletServer.h
View file @
fc1458a2
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
#define EXTERNC
#define EXTERNC
#endif
#endif
EXTERNC
void
setFullOptions
(
int
_printDebugInfo
,
EXTERNC
void
setFullOptions
(
int
_printDebugInfo
,
int
_printTraceInfo
,
int
_useHTTPS
,
int
_autoconfirm
,
int
_encryptKeys
);
int
_printTraceInfo
,
int
_useHTTPS
,
int
_autoconfirm
,
int
_encryptKeys
);
...
@@ -38,10 +37,4 @@ EXTERNC void setFullOptions(int _printDebugInfo,
...
@@ -38,10 +37,4 @@ EXTERNC void setFullOptions(int _printDebugInfo,
EXTERNC
void
setOptions
(
int
_printDebugInfo
,
EXTERNC
void
setOptions
(
int
_printDebugInfo
,
int
_printTraceInfo
,
int
_useHTTPS
,
int
_autoconfirm
);
int
_printTraceInfo
,
int
_useHTTPS
,
int
_autoconfirm
);
#endif //SGXWALLET_SGXWALLETSERVER_H
#endif //SGXWALLET_SGXWALLETSERVER_H
SGXWalletServer.hpp
View file @
fc1458a2
...
@@ -42,17 +42,11 @@ using namespace std;
...
@@ -42,17 +42,11 @@ using namespace std;
#define TOSTRING(x) STRINGIFY(x)
#define TOSTRING(x) STRINGIFY(x)
class
SGXWalletServer
:
public
AbstractStubServer
{
class
SGXWalletServer
:
public
AbstractStubServer
{
Lock
m
;
Lock
m
;
static
shared_ptr
<
SGXWalletServer
>
server
;
static
shared_ptr
<
SGXWalletServer
>
server
;
static
shared_ptr
<
HttpServer
>
httpServer
;
static
shared_ptr
<
HttpServer
>
httpServer
;
public
:
public
:
static
const
char
*
getVersion
()
{
static
const
char
*
getVersion
()
{
return
TOSTRING
(
SGXWALLET_VERSION
);
return
TOSTRING
(
SGXWALLET_VERSION
);
}
}
...
...
TestUtils.cpp
View file @
fc1458a2
...
@@ -71,11 +71,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
...
@@ -71,11 +71,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "testw.h"
#include "testw.h"
#include "TestUtils.h"
#include "TestUtils.h"
using
namespace
jsonrpc
;
using
namespace
jsonrpc
;
using
namespace
std
;
using
namespace
std
;
default_random_engine
TestUtils
::
randGen
((
unsigned
int
)
time
(
0
));
default_random_engine
TestUtils
::
randGen
((
unsigned
int
)
time
(
0
));
string
TestUtils
::
stringFromFr
(
libff
::
alt_bn128_Fr
&
el
)
{
string
TestUtils
::
stringFromFr
(
libff
::
alt_bn128_Fr
&
el
)
{
...
@@ -105,9 +103,6 @@ string TestUtils::convertDecToHex(string dec, int numBytes) {
...
@@ -105,9 +103,6 @@ string TestUtils::convertDecToHex(string dec, int numBytes) {
return
result
;
return
result
;
}
}
void
TestUtils
::
resetDB
()
{
void
TestUtils
::
resetDB
()
{
CHECK_STATE
(
system
(
"bash -c
\"
rm -rf "
SGXDATA_FOLDER
"*
\"
"
)
==
0
);
CHECK_STATE
(
system
(
"bash -c
\"
rm -rf "
SGXDATA_FOLDER
"*
\"
"
)
==
0
);
}
}
...
@@ -124,7 +119,6 @@ shared_ptr <string> TestUtils::encryptTestKey() {
...
@@ -124,7 +119,6 @@ shared_ptr <string> TestUtils::encryptTestKey() {
return
make_shared
<
string
>
(
encryptedKeyHex
);
return
make_shared
<
string
>
(
encryptedKeyHex
);
}
}
vector
<
libff
::
alt_bn128_Fr
>
TestUtils
::
splitStringToFr
(
const
char
*
coeffs
,
const
char
symbol
)
{
vector
<
libff
::
alt_bn128_Fr
>
TestUtils
::
splitStringToFr
(
const
char
*
coeffs
,
const
char
symbol
)
{
string
str
(
coeffs
);
string
str
(
coeffs
);
string
delim
;
string
delim
;
...
@@ -275,9 +269,6 @@ void TestUtils::destroyEnclave() {
...
@@ -275,9 +269,6 @@ void TestUtils::destroyEnclave() {
void
TestUtils
::
doDKG
(
StubClient
&
c
,
int
n
,
int
t
,
void
TestUtils
::
doDKG
(
StubClient
&
c
,
int
n
,
int
t
,
vector
<
string
>&
_ecdsaKeyNames
,
vector
<
string
>&
_blsKeyNames
,
vector
<
string
>&
_ecdsaKeyNames
,
vector
<
string
>&
_blsKeyNames
,
int
schainID
,
int
dkgID
)
{
int
schainID
,
int
dkgID
)
{
Json
::
Value
ethKeys
[
n
];
Json
::
Value
ethKeys
[
n
];
Json
::
Value
verifVects
[
n
];
Json
::
Value
verifVects
[
n
];
Json
::
Value
pubEthKeys
;
Json
::
Value
pubEthKeys
;
...
@@ -287,12 +278,9 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
...
@@ -287,12 +278,9 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
vector
<
string
>
pubShares
(
n
);
vector
<
string
>
pubShares
(
n
);
vector
<
string
>
polyNames
(
n
);
vector
<
string
>
polyNames
(
n
);
_ecdsaKeyNames
.
clear
();
_ecdsaKeyNames
.
clear
();
_blsKeyNames
.
clear
();
_blsKeyNames
.
clear
();
for
(
uint8_t
i
=
0
;
i
<
n
;
i
++
)
{
for
(
uint8_t
i
=
0
;
i
<
n
;
i
++
)
{
ethKeys
[
i
]
=
c
.
generateECDSAKey
();
ethKeys
[
i
]
=
c
.
generateECDSAKey
();
...
@@ -364,7 +352,6 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
...
@@ -364,7 +352,6 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
map
<
size_t
,
shared_ptr
<
BLSPublicKeyShare
>>
pubKeyShares
;
map
<
size_t
,
shared_ptr
<
BLSPublicKeyShare
>>
pubKeyShares
;
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
string
endName
=
polyNames
[
i
].
substr
(
4
);
string
endName
=
polyNames
[
i
].
substr
(
4
);
string
blsName
=
"BLS_KEY"
+
polyNames
[
i
].
substr
(
4
);
string
blsName
=
"BLS_KEY"
+
polyNames
[
i
].
substr
(
4
);
...
@@ -376,11 +363,9 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
...
@@ -376,11 +363,9 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
CHECK_STATE
(
response
[
"status"
]
==
0
);
CHECK_STATE
(
response
[
"status"
]
==
0
);
pubBLSKeys
[
i
]
=
c
.
getBLSPublicKeyShare
(
blsName
);
pubBLSKeys
[
i
]
=
c
.
getBLSPublicKeyShare
(
blsName
);
CHECK_STATE
(
pubBLSKeys
[
i
][
"status"
]
==
0
);
CHECK_STATE
(
pubBLSKeys
[
i
][
"status"
]
==
0
);
}
}
for
(
int
i
=
0
;
i
<
t
;
i
++
)
{
for
(
int
i
=
0
;
i
<
t
;
i
++
)
{
vector
<
string
>
pubKeyVect
;
vector
<
string
>
pubKeyVect
;
for
(
uint8_t
j
=
0
;
j
<
4
;
j
++
)
{
for
(
uint8_t
j
=
0
;
j
<
4
;
j
++
)
{
pubKeyVect
.
push_back
(
pubBLSKeys
[
i
][
"blsPublicKeyShare"
][
j
].
asString
());
pubKeyVect
.
push_back
(
pubBLSKeys
[
i
][
"blsPublicKeyShare"
][
j
].
asString
());
...
@@ -390,7 +375,6 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
...
@@ -390,7 +375,6 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
pubKeyShares
[
i
+
1
]
=
make_shared
<
BLSPublicKeyShare
>
(
pubKey
);
pubKeyShares
[
i
+
1
]
=
make_shared
<
BLSPublicKeyShare
>
(
pubKey
);
}
}
// create pub key
// create pub key
BLSPublicKey
blsPublicKey
(
make_shared
<
map
<
size_t
,
shared_ptr
<
BLSPublicKeyShare
>>>
(
pubKeyShares
),
t
,
BLSPublicKey
blsPublicKey
(
make_shared
<
map
<
size_t
,
shared_ptr
<
BLSPublicKeyShare
>>>
(
pubKeyShares
),
t
,
...
@@ -410,7 +394,6 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
...
@@ -410,7 +394,6 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
auto
pubKey
=
pubKeyShares
[
i
+
1
];
auto
pubKey
=
pubKeyShares
[
i
+
1
];
CHECK_STATE
(
pubKey
->
VerifySigWithHelper
(
hash_arr
,
make_shared
<
BLSSigShare
>
(
sig
),
t
,
n
));
CHECK_STATE
(
pubKey
->
VerifySigWithHelper
(
hash_arr
,
make_shared
<
BLSSigShare
>
(
sig
),
t
,
n
));
}
}
shared_ptr
<
BLSSignature
>
commonSig
=
sigShareSet
.
merge
();
shared_ptr
<
BLSSignature
>
commonSig
=
sigShareSet
.
merge
();
...
@@ -422,6 +405,4 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
...
@@ -422,6 +405,4 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
for
(
auto
&&
i
:
_blsKeyNames
)
for
(
auto
&&
i
:
_blsKeyNames
)
cerr
<<
i
<<
endl
;
cerr
<<
i
<<
endl
;
}
}
TestUtils.h
View file @
fc1458a2
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
#ifndef SGXWALLET_TESTUTILS_H
#ifndef SGXWALLET_TESTUTILS_H
#define SGXWALLET_TESTUTILS_H
#define SGXWALLET_TESTUTILS_H
#include <libff/algebra/fields/fp.hpp>
#include <libff/algebra/fields/fp.hpp>
#include <dkg/dkg.h>
#include <dkg/dkg.h>
#include <jsonrpccpp/server/connectors/httpserver.h>
#include <jsonrpccpp/server/connectors/httpserver.h>
...
@@ -30,11 +29,9 @@ using namespace std;
...
@@ -30,11 +29,9 @@ using namespace std;
using
namespace
jsonrpc
;
using
namespace
jsonrpc
;
class
TestUtils
{
class
TestUtils
{
public
:
public
:
static
default_random_engine
randGen
;
static
default_random_engine
randGen
;
static
string
stringFromFr
(
libff
::
alt_bn128_Fr
&
el
);
static
string
stringFromFr
(
libff
::
alt_bn128_Fr
&
el
);
...
...
secure_enclave/AESUtils.c
View file @
fc1458a2
...
@@ -29,8 +29,7 @@
...
@@ -29,8 +29,7 @@
#include "AESUtils.h"
#include "AESUtils.h"
int
AES_encrypt
(
char
*
message
,
uint8_t
*
encr_message
){
int
AES_encrypt
(
char
*
message
,
uint8_t
*
encr_message
)
{
sgx_read_rand
(
encr_message
+
SGX_AESGCM_MAC_SIZE
,
SGX_AESGCM_IV_SIZE
);
sgx_read_rand
(
encr_message
+
SGX_AESGCM_MAC_SIZE
,
SGX_AESGCM_IV_SIZE
);
sgx_status_t
status
=
sgx_rijndael128GCM_encrypt
(
&
AES_key
,
(
uint8_t
*
)
message
,
strlen
(
message
),
sgx_status_t
status
=
sgx_rijndael128GCM_encrypt
(
&
AES_key
,
(
uint8_t
*
)
message
,
strlen
(
message
),
encr_message
+
SGX_AESGCM_MAC_SIZE
+
SGX_AESGCM_IV_SIZE
,
encr_message
+
SGX_AESGCM_MAC_SIZE
+
SGX_AESGCM_IV_SIZE
,
...
@@ -38,12 +37,10 @@ int AES_encrypt(char *message, uint8_t *encr_message){
...
@@ -38,12 +37,10 @@ int AES_encrypt(char *message, uint8_t *encr_message){
NULL
,
0
,
NULL
,
0
,
(
sgx_aes_gcm_128bit_tag_t
*
)
encr_message
);
(
sgx_aes_gcm_128bit_tag_t
*
)
encr_message
);
return
status
;
return
status
;
}
}
int
AES_decrypt
(
uint8_t
*
encr_message
,
uint64_t
length
,
char
*
message
){
int
AES_decrypt
(
uint8_t
*
encr_message
,
uint64_t
length
,
char
*
message
)
{
uint64_t
len
=
length
-
SGX_AESGCM_MAC_SIZE
-
SGX_AESGCM_IV_SIZE
;
uint64_t
len
=
length
-
SGX_AESGCM_MAC_SIZE
-
SGX_AESGCM_IV_SIZE
;
sgx_status_t
status
=
sgx_rijndael128GCM_decrypt
(
&
AES_key
,
sgx_status_t
status
=
sgx_rijndael128GCM_decrypt
(
&
AES_key
,
...
@@ -53,6 +50,5 @@ int AES_decrypt(uint8_t *encr_message, uint64_t length, char *message){
...
@@ -53,6 +50,5 @@ int AES_decrypt(uint8_t *encr_message, uint64_t length, char *message){
NULL
,
0
,
NULL
,
0
,
(
sgx_aes_gcm_128bit_tag_t
*
)
encr_message
);
(
sgx_aes_gcm_128bit_tag_t
*
)
encr_message
);
return
status
;
return
status
;
}
}
sgxwall.cpp
View file @
fc1458a2
...
@@ -50,53 +50,40 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
...
@@ -50,53 +50,40 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "sgxwall.h"
#include "sgxwall.h"
#include "sgxwallet.h"
#include "sgxwallet.h"
void
SGXWallet
::
usage
()
{
void
SGXWallet
::
usage
()
{
cerr
<<
"usage: sgxwallet
\n
"
;
cerr
<<
"usage: sgxwallet
\n
"
;
exit
(
1
);
exit
(
1
);
}
}
void
SGXWallet
::
printUsage
()
{
void
SGXWallet
::
printUsage
()
{
cerr
<<
"Available flags:
\n
"
;
cerr
<<
"Available flags:
\n
"
;
cerr
<<
"-c
d
o not verify client certificate
\n
"
;
cerr
<<
"-c
D
o not verify client certificate
\n
"
;
cerr
<<
"-s
s
ign client certificate without human confirmation
\n
"
;
cerr
<<
"-s
S
ign client certificate without human confirmation
\n
"
;
cerr
<<
"-d
t
urn on debug output
\n
"
;
cerr
<<
"-d
T
urn on debug output
\n
"
;
cerr
<<
"-v
v
erbose mode: turn on debug output
\n
"
;
cerr
<<
"-v
V
erbose mode: turn on debug output
\n
"
;
cerr
<<
"-vv
d
etailed verbose mode: turn on debug and trace outputs
\n
"
;
cerr
<<
"-vv
D
etailed verbose mode: turn on debug and trace outputs
\n
"
;
cerr
<<
"-n
l
aunch SGXWalletServer using http (not https)
\n
"
;
cerr
<<
"-n
L
aunch SGXWalletServer using http (not https)
\n
"
;
cerr
<<
"-b Restore from back up (you will need to enter backup key)
\n
"
;
cerr
<<
"-b Restore from back up (you will need to enter backup key)
\n
"
;
cerr
<<
"-y Do not ask user to acknowledge receipt of backup key
\n
"
;
cerr
<<
"-y Do not ask user to acknowledge receipt of backup key
\n
"
;
cerr
<<
"-T Generate test keys
\n
"
;
}
}
enum
log_level
{
L_TRACE
=
0
,
L_DEBUG
=
1
,
L_INFO
=
2
,
L_WARNING
=
3
,
L_ERROR
=
4
};
enum
log_level
{
L_TRACE
=
0
,
L_DEBUG
=
1
,
L_INFO
=
2
,
L_WARNING
=
3
,
L_ERROR
=
4
};
void
SGXWallet
::
serializeKeys
(
const
vector
<
string
>&
_ecdsaKeyNames
,
const
vector
<
string
>&
_blsKeyNames
,
const
string
&
_fileName
)
{
void
SGXWallet
::
serializeKeys
(
vector
<
string
>&
_ecdsaKeyNames
,
vector
<
string
>&
_blsKeyNames
,
string
_fileName
)
{
Json
::
Value
top
(
Json
::
objectValue
);
Json
::
Value
top
(
Json
::
objectValue
);
Json
::
Value
ecdsaKeysJson
(
Json
::
objectValue
);
Json
::
Value
ecdsaKeysJson
(
Json
::
objectValue
);
Json
::
Value
blsKeysJson
(
Json
::
objectValue
);
Json
::
Value
blsKeysJson
(
Json
::
objectValue
);
for
(
uint
i
=
0
;
i
<
_ecdsaKeyNames
.
size
();
i
++
)
{
for
(
uint
i
=
0
;
i
<
_ecdsaKeyNames
.
size
();
i
++
)
{
auto
key
=
to_string
(
i
+
1
);
auto
key
=
to_string
(
i
+
1
);
ecdsaKeysJson
[
key
]
=
_ecdsaKeyNames
[
i
];
string
keyFull
(
3
-
key
.
size
(),
'0'
);
blsKeysJson
[
key
]
=
_blsKeyNames
[
i
];
keyFull
.
append
(
key
);
ecdsaKeysJson
[
keyFull
]
=
_ecdsaKeyNames
[
i
];
blsKeysJson
[
keyFull
]
=
_blsKeyNames
[
i
];
}
}
top
[
"ecdsaKeyNames"
]
=
ecdsaKeysJson
;
top
[
"ecdsaKeyNames"
]
=
ecdsaKeysJson
;
top
[
"blsKeyNames"
]
=
blsKeysJson
;
top
[
"blsKeyNames"
]
=
blsKeysJson
;
ofstream
fs
;
ofstream
fs
;
fs
.
open
(
_fileName
);
fs
.
open
(
_fileName
);
...
@@ -104,8 +91,6 @@ void SGXWallet::serializeKeys(vector<string>& _ecdsaKeyNames, vector<string>& _b
...
@@ -104,8 +91,6 @@ void SGXWallet::serializeKeys(vector<string>& _ecdsaKeyNames, vector<string>& _b
fs
<<
top
;
fs
<<
top
;
fs
.
close
();
fs
.
close
();
}
}
...
@@ -184,10 +169,7 @@ int main(int argc, char *argv[]) {
...
@@ -184,10 +169,7 @@ int main(int argc, char *argv[]) {
initAll
(
enclaveLogLevel
,
checkClientCertOption
,
autoSignClientCertOption
);
initAll
(
enclaveLogLevel
,
checkClientCertOption
,
autoSignClientCertOption
);
ifstream
is
(
"sgx_data/4node.json"
);
if
(
generateTestKeys
)
{
if
(
generateTestKeys
&&
!
is
.
good
())
{
cerr
<<
"Generating test keys ..."
<<
endl
;
cerr
<<
"Generating test keys ..."
<<
endl
;
HttpClient
client
(
RPC_ENDPOINT
);
HttpClient
client
(
RPC_ENDPOINT
);
...
@@ -199,21 +181,18 @@ int main(int argc, char *argv[]) {
...
@@ -199,21 +181,18 @@ int main(int argc, char *argv[]) {
int
schainID
=
1
;
int
schainID
=
1
;
int
dkgID
=
1
;
int
dkgID
=
1
;
TestUtils
::
doDKG
(
c
,
4
,
3
,
ecdsaKeyNames
,
blsKeyNames
,
schainID
,
dkgID
);
TestUtils
::
doDKG
(
c
,
4
,
1
,
ecdsaKeyNames
,
blsKeyNames
,
schainID
,
dkgID
);
SGXWallet
::
serializeKeys
(
ecdsaKeyNames
,
blsKeyNames
,
"sgx_data/4node.json"
);
SGXWallet
::
serializeKeys
(
ecdsaKeyNames
,
blsKeyNames
,
"sgx_data/4node.json"
);
schainID
=
2
;
schainID
=
2
;
dkgID
=
2
;
dkgID
=
2
;
TestUtils
::
doDKG
(
c
,
16
,
5
,
ecdsaKeyNames
,
blsKeyNames
,
schainID
,
dkgID
);
TestUtils
::
doDKG
(
c
,
16
,
11
,
ecdsaKeyNames
,
blsKeyNames
,
schainID
,
dkgID
);
SGXWallet
::
serializeKeys
(
ecdsaKeyNames
,
blsKeyNames
,
"sgx_data/16node.json"
);
SGXWallet
::
serializeKeys
(
ecdsaKeyNames
,
blsKeyNames
,
"sgx_data/16node.json"
);
cerr
<<
"Successfully completed generating test keys into sgx_data"
<<
endl
;
cerr
<<
"Successfully completed generating test keys into sgx_data"
<<
endl
;
}
}
while
(
true
)
{
while
(
true
)
{
...
...
sgxwall.h
View file @
fc1458a2
...
@@ -41,7 +41,7 @@ public:
...
@@ -41,7 +41,7 @@ public:
static
void
usage
();
static
void
usage
();
static
void
printUsage
();
static
void
printUsage
();
static
void
serializeKeys
(
static
void
serializeKeys
(
const
vector
<
string
>&
_ecdsaKeyNames
,
vector
<
string
>&
_ecdsaKeyNames
,
vector
<
string
>&
_blsKeyNames
,
string
_fileName
);
const
vector
<
string
>&
_blsKeyNames
,
const
string
&
_fileName
);
};
};
sgxwallet_common.h
View file @
fc1458a2
...
@@ -32,20 +32,10 @@
...
@@ -32,20 +32,10 @@
#include <stdbool.h>
#include <stdbool.h>
extern
int
useHTTPS
;
extern
int
useHTTPS
;
extern
int
encryptKeys
;
extern
int
encryptKeys
;
extern
int
autoconfirm
;
extern
int
autoconfirm
;
#define BUF_LEN 4096
#define BUF_LEN 4096
#define MAX_KEY_LENGTH 128
#define MAX_KEY_LENGTH 128
...
@@ -83,7 +73,6 @@ extern int autoconfirm;
...
@@ -83,7 +73,6 @@ extern int autoconfirm;
#define CERT_REQUEST_DOES_NOT_EXIST -14
#define CERT_REQUEST_DOES_NOT_EXIST -14
#define INVALID_ECDSA_KEY_NAME -20
#define INVALID_ECDSA_KEY_NAME -20
#define INVALID_HEX -21
#define INVALID_HEX -21
#define INVALID_ECSDA_SIGNATURE -22
#define INVALID_ECSDA_SIGNATURE -22
...
@@ -106,6 +95,4 @@ extern int autoconfirm;
...
@@ -106,6 +95,4 @@ extern int autoconfirm;
#define TEST_VALUE "1234567890"
#define TEST_VALUE "1234567890"
#endif //SGXWALLET_SGXWALLET_COMMON_H
#endif //SGXWALLET_SGXWALLET_COMMON_H
stubclient.cpp
View file @
fc1458a2
...
@@ -21,7 +21,6 @@
...
@@ -21,7 +21,6 @@
@date 2019
@date 2019
*/
*/
#include <iostream>
#include <iostream>
#include "stubclient.h"
#include "stubclient.h"
...
...
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