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
3074ad6a
Unverified
Commit
3074ad6a
authored
Feb 17, 2020
by
Stan Kladko
Committed by
GitHub
Feb 17, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #53 from skalenetwork/SKALE-2167-tests
Skale 2167 tests
parents
2e95b40d
bc527bf2
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1086 additions
and
1105 deletions
+1086
-1105
BLSCrypto.cpp
BLSCrypto.cpp
+9
-10
BLSCrypto.h
BLSCrypto.h
+2
-2
DKGCrypto.cpp
DKGCrypto.cpp
+3
-3
Dockerfile
Dockerfile
+0
-2
DockerfileSimulation
DockerfileSimulation
+2
-2
Makefile.am
Makefile.am
+4
-2
SEKManager.cpp
SEKManager.cpp
+5
-1
SGXWalletServer.cpp
SGXWalletServer.cpp
+11
-5
start.sh
docker/start.sh
+26
-8
docker-compose.yml
run_sgx/docker-compose.yml
+2
-2
docker-compose.yml
run_sgx_sim/docker-compose.yml
+2
-2
docker_test.py
scripts/docker_test.py
+17
-12
Makefile.in
secure_enclave/Makefile.in
+37
-85
sgxwallet.c
sgxwallet.c
+5
-4
stubclient.h
stubclient.h
+19
-19
tests.bash
tests.bash
+22
-0
testw.cpp
testw.cpp
+920
-946
No files found.
BLSCrypto.cpp
View file @
3074ad6a
...
@@ -314,22 +314,21 @@ bool bls_sign(const char* _encryptedKeyHex, const char* _hashHex, size_t _t, siz
...
@@ -314,22 +314,21 @@ bool bls_sign(const char* _encryptedKeyHex, const char* _hashHex, size_t _t, siz
}
}
}
}
char
*
encryptBLSKeyShare2Hex
(
int
*
errStatus
,
char
*
err_string
,
const
char
*
_key
)
{
char
*
encryptBLSKeyShare2Hex
(
int
*
errStatus
,
char
*
err_string
,
const
char
*
_key
)
{
char
*
keyArray
=
(
char
*
)
calloc
(
BUF_LEN
,
1
);
auto
keyArray
=
make_shared
<
vector
<
char
>>
(
BUF_LEN
,
0
);
uint8_t
*
encryptedKey
=
(
uint8_t
*
)
calloc
(
BUF_LEN
,
1
);
auto
encryptedKey
=
make_shared
<
vector
<
uint8_t
>>
(
BUF_LEN
,
0
);
char
*
errMsg
=
(
char
*
)
calloc
(
BUF_LEN
,
1
);
auto
errMsg
=
make_shared
<
vector
<
char
>>
(
BUF_LEN
,
0
);
strncpy
((
char
*
)
keyArray
,
(
char
*
)
_key
,
BUF_LEN
);
strncpy
(
keyArray
->
data
(),
_key
,
BUF_LEN
);
*
errStatus
=
-
1
;
*
errStatus
=
-
1
;
unsigned
int
encryptedLen
=
0
;
unsigned
int
encryptedLen
=
0
;
//status = encrypt_key(eid, errStatus, errMsg, keyArray, encryptedKey, &encryptedLen);
//status = encrypt_key(eid, errStatus, errMsg, keyArray, encryptedKey, &encryptedLen);
status
=
encrypt_key_aes
(
eid
,
errStatus
,
errMsg
,
keyArray
,
encryptedKey
,
&
encryptedLen
);
status
=
encrypt_key_aes
(
eid
,
errStatus
,
errMsg
->
data
(),
keyArray
->
data
(),
encryptedKey
->
data
()
,
&
encryptedLen
);
if
(
DEBUG_PRINT
)
{
if
(
DEBUG_PRINT
)
{
spdlog
::
info
(
"errStatus is {}"
,
*
errStatus
);
spdlog
::
info
(
"errStatus is {}"
,
*
errStatus
);
spdlog
::
info
(
" errMsg is "
,
errMsg
);
spdlog
::
info
(
" errMsg is "
,
errMsg
->
data
()
);
}
}
if
(
status
!=
SGX_SUCCESS
)
{
if
(
status
!=
SGX_SUCCESS
)
{
...
@@ -339,13 +338,13 @@ char *encryptBLSKeyShare2Hex(int *errStatus, char *err_string, const char *_key)
...
@@ -339,13 +338,13 @@ char *encryptBLSKeyShare2Hex(int *errStatus, char *err_string, const char *_key)
}
}
if
(
*
errStatus
!=
0
)
{
if
(
*
errStatus
!=
0
)
{
throw
RPCException
(
-
666
,
errMsg
);
throw
RPCException
(
-
666
,
errMsg
->
data
()
);
}
}
char
*
result
=
(
char
*
)
calloc
(
2
*
BUF_LEN
,
1
);
char
*
result
=
(
char
*
)
calloc
(
2
*
BUF_LEN
,
1
);
carray2Hex
(
encryptedKey
,
encryptedLen
,
result
);
carray2Hex
(
encryptedKey
->
data
()
,
encryptedLen
,
result
);
return
result
;
return
result
;
}
}
...
...
BLSCrypto.h
View file @
3074ad6a
...
@@ -49,8 +49,8 @@ EXTERNC bool hex2carray2(const char * _hex, uint64_t *_bin_len,
...
@@ -49,8 +49,8 @@ EXTERNC bool hex2carray2(const char * _hex, uint64_t *_bin_len,
EXTERNC
char
*
encryptBLSKeyShare2Hex
(
int
*
errStatus
,
char
*
err_string
,
const
char
*
_key
);
char
*
encryptBLSKeyShare2Hex
(
int
*
errStatus
,
char
*
err_string
,
const
char
*
_key
);
EXTERNC
char
*
decryptBLSKeyShareFromHex
(
int
*
errStatus
,
char
*
errMsg
,
const
char
*
_encryptedKey
);
char
*
decryptBLSKeyShareFromHex
(
int
*
errStatus
,
char
*
errMsg
,
const
char
*
_encryptedKey
);
#endif //SGXWALLET_BLSCRYPTO_H
#endif //SGXWALLET_BLSCRYPTO_H
DKGCrypto.cpp
View file @
3074ad6a
...
@@ -146,7 +146,8 @@ vector <vector<string>> get_verif_vect(const char* encryptedPolyHex, int t, int
...
@@ -146,7 +146,8 @@ vector <vector<string>> get_verif_vect(const char* encryptedPolyHex, int t, int
// printf(" %d ", encr_dkg_poly[i] );
// printf(" %d ", encr_dkg_poly[i] );
}
}
uint32_t
len
;
uint32_t
len
=
0
;
if
(
!
is_aes
)
if
(
!
is_aes
)
status
=
get_public_shares
(
eid
,
&
err_status
,
errMsg1
,
encr_dkg_poly
,
len
,
public_shares
,
t
,
n
);
status
=
get_public_shares
(
eid
,
&
err_status
,
errMsg1
,
encr_dkg_poly
,
len
,
public_shares
,
t
,
n
);
else
{
else
{
...
@@ -170,7 +171,7 @@ vector <vector<string>> get_verif_vect(const char* encryptedPolyHex, int t, int
...
@@ -170,7 +171,7 @@ vector <vector<string>> get_verif_vect(const char* encryptedPolyHex, int t, int
vector
<
string
>
G2_strings
=
SplitString
(
public_shares
,
','
);
vector
<
string
>
G2_strings
=
SplitString
(
public_shares
,
','
);
vector
<
vector
<
string
>>
pub_shares_vect
;
vector
<
vector
<
string
>>
pub_shares_vect
;
for
(
in
t
i
=
0
;
i
<
G2_strings
.
size
();
i
++
){
for
(
uint64_
t
i
=
0
;
i
<
G2_strings
.
size
();
i
++
){
vector
<
string
>
koef_str
=
SplitString
(
G2_strings
.
at
(
i
).
c_str
(),
':'
);
vector
<
string
>
koef_str
=
SplitString
(
G2_strings
.
at
(
i
).
c_str
(),
':'
);
pub_shares_vect
.
push_back
(
koef_str
);
pub_shares_vect
.
push_back
(
koef_str
);
}
}
...
@@ -382,7 +383,6 @@ vector<string> GetBLSPubKey(const char * encryptedKeyHex){
...
@@ -382,7 +383,6 @@ vector<string> GetBLSPubKey(const char * encryptedKeyHex){
int
err_status
=
0
;
int
err_status
=
0
;
uint64_t
dec_key_len
;
uint64_t
dec_key_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 encryptedKeyHex"
);
throw
RPCException
(
INVALID_HEX
,
"Invalid encryptedKeyHex"
);
...
...
Dockerfile
View file @
3074ad6a
...
@@ -7,7 +7,6 @@ COPY *.txt ./
...
@@ -7,7 +7,6 @@ COPY *.txt ./
COPY
*.c ./
COPY
*.c ./
COPY
*.am ./
COPY
*.am ./
COPY
*.hpp ./
COPY
*.hpp ./
COPY
*.sh ./
COPY
*.gmp ./
COPY
*.gmp ./
COPY
*.ac ./
COPY
*.ac ./
COPY
*.json ./
COPY
*.json ./
...
@@ -34,6 +33,5 @@ RUN ./configure
...
@@ -34,6 +33,5 @@ RUN ./configure
RUN
make
RUN
make
RUN
mkdir
/usr/src/sdk/sgx_data
RUN
mkdir
/usr/src/sdk/sgx_data
COPY
docker/start.sh ./
COPY
docker/start.sh ./
ENTRYPOINT
["/usr/src/sdk/start.sh"]
ENTRYPOINT
["/usr/src/sdk/start.sh"]
DockerfileSimulation
View file @
3074ad6a
...
@@ -7,7 +7,6 @@ COPY *.txt ./
...
@@ -7,7 +7,6 @@ COPY *.txt ./
COPY *.c ./
COPY *.c ./
COPY *.am ./
COPY *.am ./
COPY *.hpp ./
COPY *.hpp ./
COPY *.sh ./
COPY *.gmp ./
COPY *.gmp ./
COPY *.ac ./
COPY *.ac ./
COPY *.json ./
COPY *.json ./
...
@@ -33,6 +32,7 @@ RUN make
...
@@ -33,6 +32,7 @@ RUN make
RUN mkdir /usr/src/sdk/sgx_data
RUN mkdir /usr/src/sdk/sgx_data
COPY docker/start.sh ./
COPY docker/start.sh ./
ENTRYPOINT ["/usr/src/sdk/start.sh"]
ENTRYPOINT ["/usr/src/sdk/start.sh"]
\ No newline at end of file
Makefile.am
View file @
3074ad6a
...
@@ -44,8 +44,10 @@ secure_enclave.edl: secure_enclave/secure_enclave.edl
...
@@ -44,8 +44,10 @@ secure_enclave.edl: secure_enclave/secure_enclave.edl
##
##
#AM_CPPFLAGS += -g -Og
#AM_CPPFLAGS += -g -Og
#AM_CFLAGS = -g -Og -rdynamic -Wl,--no-as-needed -lSegFault -fsanitize=address
#AM_CXXFLAGS = ${AM_CPPFLAGS} -rdynamic -Wl,--no-as-needed -lSegFault -fsanitize=address
AM_CFLAGS
=
-g
-Og
-rdynamic
-Wl
,--no-as-needed
-lSegFault
AM_CXXFLAGS
=
${
AM_CPPFLAGS
}
-rdynamic
-Wl
,--no-as-needed
-lSegFault
AM_CPPFLAGS
+=
-Wall
-DSKALE_SGX
=
1
-DBINARY_OUTPUT
=
1
-Ileveldb
/include
-IlibBLS
/bls
-IlibBLS
/libff
-IlibBLS
-fno-builtin-memset
$(GMP_CPPFLAGS)
-I
.
-I
./libBLS/deps/deps_inst/x86_or_x64/include
AM_CPPFLAGS
+=
-Wall
-DSKALE_SGX
=
1
-DBINARY_OUTPUT
=
1
-Ileveldb
/include
-IlibBLS
/bls
-IlibBLS
/libff
-IlibBLS
-fno-builtin-memset
$(GMP_CPPFLAGS)
-I
.
-I
./libBLS/deps/deps_inst/x86_or_x64/include
...
...
SEKManager.cpp
View file @
3074ad6a
...
@@ -154,7 +154,11 @@ void gen_SEK(){
...
@@ -154,7 +154,11 @@ void gen_SEK(){
std
::
getline
(
std
::
cin
,
buffer
);
std
::
getline
(
std
::
cin
,
buffer
);
}
while
(
case_insensitive_match
(
confirm_str
,
buffer
));
//(strcmp(confirm_str.c_str(), buffer.c_str()) != 0);
}
while
(
case_insensitive_match
(
confirm_str
,
buffer
));
//(strcmp(confirm_str.c_str(), buffer.c_str()) != 0);
}
}
system
(
"reset"
);
if
(
system
(
"reset"
)
!=
0
)
{
cerr
<<
"Could not execute reset"
<<
endl
;
}
LevelDB
::
getLevelDb
()
->
writeDataUnique
(
"SEK"
,
hexEncrKey
.
data
());
LevelDB
::
getLevelDb
()
->
writeDataUnique
(
"SEK"
,
hexEncrKey
.
data
());
create_test_key
();
create_test_key
();
...
...
SGXWalletServer.cpp
View file @
3074ad6a
...
@@ -152,11 +152,13 @@ importBLSKeyShareImpl(const string &_keyShare, const string &_keyShareName, int
...
@@ -152,11 +152,13 @@ importBLSKeyShareImpl(const string &_keyShare, const string &_keyShareName, int
result
[
"errorMessage"
]
=
""
;
result
[
"errorMessage"
]
=
""
;
result
[
"encryptedKeyShare"
]
=
""
;
result
[
"encryptedKeyShare"
]
=
""
;
char
*
encryptedKeyShareHex
=
nullptr
;
try
{
try
{
// if ( !checkName(_keyShare, "BLS_KEY")){
// if ( !checkName(_keyShare, "BLS_KEY")){
// throw RPCException(INVALID_POLY_NAME, "Invalid BLSKey name");
// throw RPCException(INVALID_POLY_NAME, "Invalid BLSKey name");
// }
// }
char
*
encryptedKeyShareHex
=
encryptBLSKeyShare2Hex
(
&
errStatus
,
errMsg
,
_keyShare
.
c_str
());
encryptedKeyShareHex
=
encryptBLSKeyShare2Hex
(
&
errStatus
,
errMsg
,
_keyShare
.
c_str
());
if
(
encryptedKeyShareHex
==
nullptr
)
{
if
(
encryptedKeyShareHex
==
nullptr
)
{
throw
RPCException
(
UNKNOWN_ERROR
,
""
);
throw
RPCException
(
UNKNOWN_ERROR
,
""
);
...
@@ -166,7 +168,7 @@ importBLSKeyShareImpl(const string &_keyShare, const string &_keyShareName, int
...
@@ -166,7 +168,7 @@ importBLSKeyShareImpl(const string &_keyShare, const string &_keyShareName, int
throw
RPCException
(
errStatus
,
errMsg
);
throw
RPCException
(
errStatus
,
errMsg
);
}
}
result
[
"encryptedKeyShare"
]
=
encryptedKeyShareHex
;
result
[
"encryptedKeyShare"
]
=
string
(
encryptedKeyShareHex
)
;
writeKeyShare
(
_keyShareName
,
encryptedKeyShareHex
,
index
,
n
,
t
);
writeKeyShare
(
_keyShareName
,
encryptedKeyShareHex
,
index
,
n
,
t
);
...
@@ -175,6 +177,10 @@ importBLSKeyShareImpl(const string &_keyShare, const string &_keyShareName, int
...
@@ -175,6 +177,10 @@ importBLSKeyShareImpl(const string &_keyShare, const string &_keyShareName, int
result
[
"errorMessage"
]
=
_e
.
errString
;
result
[
"errorMessage"
]
=
_e
.
errString
;
}
}
if
(
encryptedKeyShareHex
!=
nullptr
)
{
free
(
encryptedKeyShareHex
);
}
return
result
;
return
result
;
}
}
...
@@ -487,7 +493,7 @@ Json::Value getSecretShareImpl(const string& polyName, const Json::Value& public
...
@@ -487,7 +493,7 @@ Json::Value getSecretShareImpl(const string& polyName, const Json::Value& public
result
[
"errorMessage"
]
=
""
;
result
[
"errorMessage"
]
=
""
;
try
{
try
{
if
(
publicKeys
.
size
()
!=
n
){
if
(
publicKeys
.
size
()
!=
(
uint64_t
)
n
){
throw
RPCException
(
INVALID_DKG_PARAMS
,
"wrong number of public keys"
);
throw
RPCException
(
INVALID_DKG_PARAMS
,
"wrong number of public keys"
);
}
}
if
(
!
checkName
(
polyName
,
"POLY"
)){
if
(
!
checkName
(
polyName
,
"POLY"
)){
...
@@ -543,7 +549,7 @@ Json::Value dkgVerificationImpl(const string& publicShares, const string& ethKey
...
@@ -543,7 +549,7 @@ Json::Value dkgVerificationImpl(const string& publicShares, const string& ethKey
if
(
!
checkHex
(
SecretShare
,
SECRET_SHARE_NUM_BYTES
)){
if
(
!
checkHex
(
SecretShare
,
SECRET_SHARE_NUM_BYTES
)){
throw
RPCException
(
INVALID_HEX
,
"Invalid Secret share"
);
throw
RPCException
(
INVALID_HEX
,
"Invalid Secret share"
);
}
}
if
(
publicShares
.
length
()
!=
256
*
t
){
if
(
publicShares
.
length
()
!=
(
uint64_t
)
256
*
t
){
throw
RPCException
(
INVALID_DKG_PARAMS
,
"Invalid length of public shares"
);
throw
RPCException
(
INVALID_DKG_PARAMS
,
"Invalid length of public shares"
);
}
}
...
@@ -573,7 +579,7 @@ Json::Value createBLSPrivateKeyImpl(const string & blsKeyName, const string& eth
...
@@ -573,7 +579,7 @@ Json::Value createBLSPrivateKeyImpl(const string & blsKeyName, const string& eth
try
{
try
{
if
(
SecretShare
.
length
()
!=
n
*
192
){
if
(
SecretShare
.
length
()
!=
(
uint64_t
)
n
*
192
){
spdlog
::
info
(
"wrong length of secret shares - {}"
,
SecretShare
.
length
());
spdlog
::
info
(
"wrong length of secret shares - {}"
,
SecretShare
.
length
());
spdlog
::
info
(
"secret shares - {}"
,
SecretShare
);
spdlog
::
info
(
"secret shares - {}"
,
SecretShare
);
throw
RPCException
(
INVALID_SECRET_SHARES_LENGTH
,
"Invalid secret share length"
);
throw
RPCException
(
INVALID_SECRET_SHARES_LENGTH
,
"Invalid secret share length"
);
...
...
docker/start.sh
View file @
3074ad6a
#!/bin/bash
#!/bin/bash
source
/opt/intel/sgxsdk/environment
source
/opt/intel/sgxsdk/environment
export
LD_LIBRARY_PATH
=
${
LD_LIBRARY_PATH
}
:/opt/intel/sgxpsw/aesm/
cd
/usr/src/sdk
;
jhid
-d
/opt/intel/sgxpsw/aesm/aesm_service &
pid
=
$!
sleep
2
echo
$1
cd
/usr/src/sdk
;
./sgxwallet
$1
$2
$3
$4
if
[
"
$1
"
=
-t
]
;
then
set
-e
./testw
[
bls-key-encrypt]
./testw
[
bls-key-encrypt-decrypt]
./testw
[
dkg-gen]
./testw
[
dkg-pub_shares]
./testw
[
dkg-verify]
./testw
[
ecdsa_test]
./testw
[
test_test]
./testw
[
get_pub_ecdsa_key_test]
./testw
[
bls_dkg]
./testw
[
api_test]
./testw
[
getServerStatus_test]
./testw
[
dkg_api_test]
./testw
[
is_poly_test]
./testw
[
AES-encrypt-decrypt]
#./testw [ecdsa_api_test]
#./testw [dkg-encr_sshares]
# ./testw [bls_sign]
#./testw [many_threads_test]
# ./testw [aes_dkg]
else
./sgxwallet
$1
$2
$3
$4
fi
run_sgx/docker-compose.yml
View file @
3074ad6a
version
:
'
3'
version
:
'
3'
services
:
services
:
sgxwallet
:
sgxwallet
:
image
:
skalenetwork/sgxwallet:latest
image
:
skalenetwork/sgxwallet:latest
_commit
ports
:
ports
:
-
"
1026:1026"
-
"
1026:1026"
-
"
1027:1027"
-
"
1027:1027"
...
@@ -17,6 +17,6 @@ services:
...
@@ -17,6 +17,6 @@ services:
max-size
:
"
10m"
max-size
:
"
10m"
max-file
:
"
4"
max-file
:
"
4"
restart
:
unless-stopped
restart
:
unless-stopped
command
:
-
s
command
:
-
t
run_sgx_sim/docker-compose.yml
View file @
3074ad6a
version
:
'
3'
version
:
'
3'
services
:
services
:
sgxwallet
:
sgxwallet
:
image
:
skalenetwork/sgxwalletsim:latest
image
:
skalenetwork/sgxwalletsim:latest
_commit
ports
:
ports
:
-
"
1026:1026"
-
"
1026:1026"
-
"
1027:1027"
-
"
1027:1027"
...
@@ -14,5 +14,5 @@ services:
...
@@ -14,5 +14,5 @@ services:
max-size
:
"
10m"
max-size
:
"
10m"
max-file
:
"
4"
max-file
:
"
4"
restart
:
unless-stopped
restart
:
unless-stopped
command
:
-
s -d -y
command
:
-
t
scripts/docker_test.py
View file @
3074ad6a
...
@@ -23,6 +23,12 @@
...
@@ -23,6 +23,12 @@
#
#
import
sys
,
os
,
subprocess
,
socket
,
time
import
sys
,
os
,
subprocess
,
socket
,
time
os
.
chdir
(
".."
)
os
.
chdir
(
".."
)
topDir
=
os
.
getcwd
()
+
"/sgxwallet"
topDir
=
os
.
getcwd
()
+
"/sgxwallet"
print
(
"Starting build push"
)
print
(
"Starting build push"
)
...
@@ -44,13 +50,18 @@ print("Running tests for branch " + BRANCH);
...
@@ -44,13 +50,18 @@ print("Running tests for branch " + BRANCH);
assert
subprocess
.
call
([
"docker"
,
"image"
,
"inspect"
,
FULL_IMAGE_NAME
])
==
0
;
assert
subprocess
.
call
([
"docker"
,
"image"
,
"inspect"
,
FULL_IMAGE_NAME
])
==
0
;
#assert subprocess.call(["docker", "run", "-v", topDir + "/sgx_data:/usr/src/sdk/sgx_data",
completedProcess
=
subprocess
.
run
([
"docker"
,
"run"
,
"-v"
,
topDir
+
"/sgx_data:/usr/src/sdk/sgx_data"
,
"-t"
,
# "-d", "--network=host", "skalenetwork/" + IMAGE_NAME +":" + TAG_POSTFIX]) == 0
"--name"
,
"sgxwallet"
,
"--network=host"
,
"skalenetwork/"
+
IMAGE_NAME
+
":"
+
TAG_POSTFIX
,
"-t"
])
print
(
completedProcess
.
stdout
)
print
(
completedProcess
.
stderr
)
assert
completedProcess
.
returncode
==
0
;
obj
=
subprocess
.
Popen
([
"docker"
,
"run"
,
"-v"
,
topDir
+
"/sgx_data:/usr/src/sdk/sgx_data"
,
"-d"
,
"--network=host"
,
"skalenetwork/"
+
IMAGE_NAME
+
":"
+
TAG_POSTFIX
,
"-y"
],
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
)
obj
.
communicate
(
input
=
b
"i confirm"
,
timeout
=
5
)
assert
subprocess
.
call
([
"docker"
,
"rm"
,
"sgxwallet"
])
==
0
obj
.
terminate
()
assert
subprocess
.
call
([
"docker"
,
"run"
,
"-v"
,
topDir
+
"/sgx_data:/usr/src/sdk/sgx_data"
,
"-d"
,
obj
.
wait
()
"--name"
,
"sgxwallet"
,
"--network=host"
,
"skalenetwork/"
+
IMAGE_NAME
+
":"
+
TAG_POSTFIX
,
"-y"
])
==
0
time
.
sleep
(
5
);
time
.
sleep
(
5
);
...
@@ -74,9 +85,3 @@ s3.connect((address, 1028))
...
@@ -74,9 +85,3 @@ s3.connect((address, 1028))
s1
.
close
()
s1
.
close
()
s2
.
close
()
s2
.
close
()
s3
.
close
()
s3
.
close
()
secure_enclave/Makefile.in
View file @
3074ad6a
# Makefile.in generated by automake 1.1
6
.1 from Makefile.am.
# Makefile.in generated by automake 1.1
5
.1 from Makefile.am.
# @configure_input@
# @configure_input@
# Copyright (C) 1994-201
8
Free Software Foundation, Inc.
# Copyright (C) 1994-201
7
Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# gives unlimited permission to copy and/or distribute it,
...
@@ -137,16 +137,7 @@ am__v_at_0 = @
...
@@ -137,16 +137,7 @@ am__v_at_0 = @
am__v_at_1
=
am__v_at_1
=
DEFAULT_INCLUDES
=
-I
.@am__isrc@
DEFAULT_INCLUDES
=
-I
.@am__isrc@
depcomp
=
$(SHELL)
$(top_srcdir)
/depcomp
depcomp
=
$(SHELL)
$(top_srcdir)
/depcomp
am__maybe_remake_depfiles
=
depfiles
am__depfiles_maybe
=
depfiles
am__depfiles_remade
=
./
$(DEPDIR)
/AESUtils.Po
\
./
$(DEPDIR)
/BLSEnclave.Po ./
$(DEPDIR)
/DH_dkg.Po
\
./
$(DEPDIR)
/DKGUtils.Po ./
$(DEPDIR)
/alt_bn128_g1.Po
\
./
$(DEPDIR)
/alt_bn128_g2.Po ./
$(DEPDIR)
/alt_bn128_init.Po
\
./
$(DEPDIR)
/curves.Po ./
$(DEPDIR)
/domain_parameters.Po
\
./
$(DEPDIR)
/numbertheory.Po ./
$(DEPDIR)
/point.Po
\
./
$(DEPDIR)
/secure_enclave.Po ./
$(DEPDIR)
/secure_enclave_t.Po
\
./
$(DEPDIR)
/signature.Po ./
$(DEPDIR)
/signed_enclave_debug.Po
\
./
$(DEPDIR)
/signed_enclave_rel.Po
am__mv
=
mv
-f
am__mv
=
mv
-f
COMPILE
=
$(CC)
$(DEFS)
$(DEFAULT_INCLUDES)
$(INCLUDES)
$(AM_CPPFLAGS)
\
COMPILE
=
$(CC)
$(DEFS)
$(DEFAULT_INCLUDES)
$(INCLUDES)
$(AM_CPPFLAGS)
\
$(CPPFLAGS)
$(AM_CFLAGS)
$(CFLAGS)
$(CPPFLAGS)
$(AM_CFLAGS)
$(CFLAGS)
...
@@ -375,8 +366,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
...
@@ -375,8 +366,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*
config.status
*
)
\
*
config.status
*
)
\
cd
$(top_builddir)
&&
$(MAKE)
$(AM_MAKEFLAGS)
am--refresh
;;
\
cd
$(top_builddir)
&&
$(MAKE)
$(AM_MAKEFLAGS)
am--refresh
;;
\
*
)
\
*
)
\
echo
' cd
$(top_builddir)
&&
$(SHELL)
./config.status
$(subdir)
/$@
$(am__
maybe_remake_depfiles
)
'
;
\
echo
' cd
$(top_builddir)
&&
$(SHELL)
./config.status
$(subdir)
/$@
$(am__
depfiles_maybe
)
'
;
\
cd
$(top_builddir)
&&
$(SHELL)
./config.status
$(subdir)
/
$@
$(am__
maybe_remake_depfiles
)
;;
\
cd
$(top_builddir)
&&
$(SHELL)
./config.status
$(subdir)
/
$@
$(am__
depfiles_maybe
)
;;
\
esac
;
esac
;
$(top_srcdir)/build-aux/sgx_enclave.am $(am__empty)
:
$(top_srcdir)/build-aux/sgx_enclave.am $(am__empty)
:
...
@@ -441,28 +432,22 @@ mostlyclean-compile:
...
@@ -441,28 +432,22 @@ mostlyclean-compile:
distclean-compile
:
distclean-compile
:
-
rm
-f
*
.tab.c
-
rm
-f
*
.tab.c
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/AESUtils.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/AESUtils.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/BLSEnclave.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/BLSEnclave.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/DH_dkg.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/DH_dkg.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/DKGUtils.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/DKGUtils.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/alt_bn128_g1.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/alt_bn128_g1.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/alt_bn128_g2.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/alt_bn128_g2.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/alt_bn128_init.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/alt_bn128_init.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/curves.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/curves.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/domain_parameters.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/domain_parameters.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/numbertheory.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/numbertheory.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/point.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/point.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/secure_enclave.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/secure_enclave.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/secure_enclave_t.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/secure_enclave_t.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/signature.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/signature.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/signed_enclave_debug.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/signed_enclave_debug.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/signed_enclave_rel.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/signed_enclave_rel.Po@am__quote@
$(am__depfiles_remade)
:
@
$(MKDIR_P)
$
(
@D
)
@
echo
'# dummy'
>
$@
-t
&&
$(am__mv)
$@
-t
$@
am--depfiles
:
$(am__depfiles_remade)
.c.o
:
.c.o
:
@am__fastdepCC_TRUE@
$(AM_V_CC)$(COMPILE)
-MT
$@
-MD
-MP
-MF
$(DEPDIR)/$*.Tpo
-c
-o
$@
$<
@am__fastdepCC_TRUE@
$(AM_V_CC)$(COMPILE)
-MT
$@
-MD
-MP
-MF
$(DEPDIR)/$*.Tpo
-c
-o
$@
$<
...
@@ -586,10 +571,7 @@ cscopelist-am: $(am__tagged_files)
...
@@ -586,10 +571,7 @@ cscopelist-am: $(am__tagged_files)
distclean-tags
:
distclean-tags
:
-
rm
-f
TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
rm
-f
TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir
:
$(BUILT_SOURCES)
distdir
:
$(DISTFILES)
$(MAKE)
$(AM_MAKEFLAGS)
distdir-am
distdir-am
:
$(DISTFILES)
@
srcdirstrip
=
`
echo
"
$(srcdir)
"
|
sed
's/[].[^$$\\*]/\\\\&/g'
`
;
\
@
srcdirstrip
=
`
echo
"
$(srcdir)
"
|
sed
's/[].[^$$\\*]/\\\\&/g'
`
;
\
topsrcdirstrip
=
`
echo
"
$(top_srcdir)
"
|
sed
's/[].[^$$\\*]/\\\\&/g'
`
;
\
topsrcdirstrip
=
`
echo
"
$(top_srcdir)
"
|
sed
's/[].[^$$\\*]/\\\\&/g'
`
;
\
list
=
'
$(DISTFILES)
'
;
\
list
=
'
$(DISTFILES)
'
;
\
...
@@ -662,22 +644,7 @@ clean: clean-am
...
@@ -662,22 +644,7 @@ clean: clean-am
clean-am
:
clean-generic clean-libexecPROGRAMS mostlyclean-am
clean-am
:
clean-generic clean-libexecPROGRAMS mostlyclean-am
distclean
:
distclean-am
distclean
:
distclean-am
-
rm
-f
./
$(DEPDIR)
/AESUtils.Po
-
rm
-rf
./
$(DEPDIR)
-
rm
-f
./
$(DEPDIR)
/BLSEnclave.Po
-
rm
-f
./
$(DEPDIR)
/DH_dkg.Po
-
rm
-f
./
$(DEPDIR)
/DKGUtils.Po
-
rm
-f
./
$(DEPDIR)
/alt_bn128_g1.Po
-
rm
-f
./
$(DEPDIR)
/alt_bn128_g2.Po
-
rm
-f
./
$(DEPDIR)
/alt_bn128_init.Po
-
rm
-f
./
$(DEPDIR)
/curves.Po
-
rm
-f
./
$(DEPDIR)
/domain_parameters.Po
-
rm
-f
./
$(DEPDIR)
/numbertheory.Po
-
rm
-f
./
$(DEPDIR)
/point.Po
-
rm
-f
./
$(DEPDIR)
/secure_enclave.Po
-
rm
-f
./
$(DEPDIR)
/secure_enclave_t.Po
-
rm
-f
./
$(DEPDIR)
/signature.Po
-
rm
-f
./
$(DEPDIR)
/signed_enclave_debug.Po
-
rm
-f
./
$(DEPDIR)
/signed_enclave_rel.Po
-
rm
-f
Makefile
-
rm
-f
Makefile
distclean-am
:
clean-am distclean-compile distclean-generic
\
distclean-am
:
clean-am distclean-compile distclean-generic
\
distclean-tags
distclean-tags
...
@@ -723,22 +690,7 @@ install-ps-am:
...
@@ -723,22 +690,7 @@ install-ps-am:
installcheck-am
:
installcheck-am
:
maintainer-clean
:
maintainer-clean-am
maintainer-clean
:
maintainer-clean-am
-
rm
-f
./
$(DEPDIR)
/AESUtils.Po
-
rm
-rf
./
$(DEPDIR)
-
rm
-f
./
$(DEPDIR)
/BLSEnclave.Po
-
rm
-f
./
$(DEPDIR)
/DH_dkg.Po
-
rm
-f
./
$(DEPDIR)
/DKGUtils.Po
-
rm
-f
./
$(DEPDIR)
/alt_bn128_g1.Po
-
rm
-f
./
$(DEPDIR)
/alt_bn128_g2.Po
-
rm
-f
./
$(DEPDIR)
/alt_bn128_init.Po
-
rm
-f
./
$(DEPDIR)
/curves.Po
-
rm
-f
./
$(DEPDIR)
/domain_parameters.Po
-
rm
-f
./
$(DEPDIR)
/numbertheory.Po
-
rm
-f
./
$(DEPDIR)
/point.Po
-
rm
-f
./
$(DEPDIR)
/secure_enclave.Po
-
rm
-f
./
$(DEPDIR)
/secure_enclave_t.Po
-
rm
-f
./
$(DEPDIR)
/signature.Po
-
rm
-f
./
$(DEPDIR)
/signed_enclave_debug.Po
-
rm
-f
./
$(DEPDIR)
/signed_enclave_rel.Po
-
rm
-f
Makefile
-
rm
-f
Makefile
maintainer-clean-am
:
distclean-am maintainer-clean-generic
maintainer-clean-am
:
distclean-am maintainer-clean-generic
...
@@ -758,19 +710,19 @@ uninstall-am: uninstall-libexecPROGRAMS
...
@@ -758,19 +710,19 @@ uninstall-am: uninstall-libexecPROGRAMS
.MAKE
:
install-am install-strip
.MAKE
:
install-am install-strip
.PHONY
:
CTAGS GTAGS TAGS all all-am
am--depfiles check check-am clean
\
.PHONY
:
CTAGS GTAGS TAGS all all-am
check check-am clean clean-generic
\
clean-
generic clean-libexecPROGRAMS cscopelist-am ctags
\
clean-
libexecPROGRAMS cscopelist-am ctags ctags-am distclean
\
ctags-am distclean distclean-compile distclean-generic
\
distclean-compile distclean-generic distclean-tags distdir dvi
\
d
istclean-tags distdir dvi dvi-am html html-am info info
-am
\
d
vi-am html html-am info info-am install install
-am
\
install
install-am install-data install-data-am install-dvi
\
install
-data install-data-am install-dvi install-dvi-am
\
install-
dvi-am install-exec install-exec-am install-html
\
install-
exec install-exec-am install-html install-html-am
\
install-
html-am install-info install-info-am
\
install-
info install-info-am install-libexecPROGRAMS
\
install-
libexecPROGRAMS install-man install-pdf install-pdf-am
\
install-
man install-pdf install-pdf-am install-ps
\
install-ps
install-ps-am install-strip installcheck
\
install-ps
-am install-strip installcheck installcheck-am
\
install
check-am installdirs maintainer-clean
\
install
dirs maintainer-clean maintainer-clean-generic
\
m
aintainer-clean-generic mostlyclean mostlyclean-compile
\
m
ostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am
\
mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall
\
ps ps-am tags tags-am uninstall uninstall-am
\
uninstall-
am uninstall-
libexecPROGRAMS
uninstall-libexecPROGRAMS
.PRECIOUS
:
Makefile
.PRECIOUS
:
Makefile
...
...
sgxwallet.c
View file @
3074ad6a
...
@@ -73,11 +73,12 @@ int main(int argc, char *argv[]) {
...
@@ -73,11 +73,12 @@ int main(int argc, char *argv[]) {
switch
(
opt
)
{
switch
(
opt
)
{
case
'h'
:
case
'h'
:
if
(
strlen
(
argv
[
1
])
==
2
)
{
if
(
strlen
(
argv
[
1
])
==
2
)
{
fprintf
(
stderr
,
"-c
client certificate will not be checked
\n
"
);
fprintf
(
stderr
,
"-c
do not verify client certificate
\n
"
);
fprintf
(
stderr
,
"-s
client certificate will be signed automatically
\n
"
);
fprintf
(
stderr
,
"-s
sign client certificate without human confirmation
\n
"
);
fprintf
(
stderr
,
"-d turn on debug output
\n
"
);
fprintf
(
stderr
,
"-d turn on debug output
\n
"
);
fprintf
(
stderr
,
"-0 SGXWalletServer will be launched on http (not https)
\n
"
);
fprintf
(
stderr
,
"-0 launch SGXWalletServer using http (not https)
\n
"
);
fprintf
(
stderr
,
"-b Enter backup key
\n
"
);
fprintf
(
stderr
,
"-b Restore from back up (you will need to enter backup key)
\n
"
);
fprintf
(
stderr
,
"-y Do not ask user to acknoledge receipt of backup key
\n
"
);
exit
(
0
);
exit
(
0
);
}
else
{
}
else
{
fprintf
(
stderr
,
"unknown flag %s
\n
"
,
argv
[
1
]);
fprintf
(
stderr
,
"unknown flag %s
\n
"
,
argv
[
1
]);
...
...
stubclient.h
View file @
3074ad6a
...
@@ -12,7 +12,7 @@ class StubClient : public jsonrpc::Client
...
@@ -12,7 +12,7 @@ class StubClient : public jsonrpc::Client
public
:
public
:
StubClient
(
jsonrpc
::
IClientConnector
&
conn
,
jsonrpc
::
clientVersion_t
type
=
jsonrpc
::
JSONRPC_CLIENT_V2
)
:
jsonrpc
::
Client
(
conn
,
type
)
{}
StubClient
(
jsonrpc
::
IClientConnector
&
conn
,
jsonrpc
::
clientVersion_t
type
=
jsonrpc
::
JSONRPC_CLIENT_V2
)
:
jsonrpc
::
Client
(
conn
,
type
)
{}
Json
::
Value
importBLSKeyShare
(
const
std
::
string
&
keyShare
,
const
std
::
string
&
keyShareName
,
int
t
,
int
n
,
int
index
)
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
importBLSKeyShare
(
const
std
::
string
&
keyShare
,
const
std
::
string
&
keyShareName
,
int
t
,
int
n
,
int
index
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"index"
]
=
index
;
p
[
"index"
]
=
index
;
...
@@ -27,7 +27,7 @@ class StubClient : public jsonrpc::Client
...
@@ -27,7 +27,7 @@ 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
blsSignMessageHash
(
const
std
::
string
&
keyShareName
,
const
std
::
string
&
messageHash
,
int
t
,
int
n
,
int
signerIndex
)
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
blsSignMessageHash
(
const
std
::
string
&
keyShareName
,
const
std
::
string
&
messageHash
,
int
t
,
int
n
,
int
signerIndex
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"keyShareName"
]
=
keyShareName
;
p
[
"keyShareName"
]
=
keyShareName
;
...
@@ -42,7 +42,7 @@ class StubClient : public jsonrpc::Client
...
@@ -42,7 +42,7 @@ 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
importECDSAKey
(
const
std
::
string
&
key
,
const
std
::
string
&
keyName
)
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
importECDSAKey
(
const
std
::
string
&
key
,
const
std
::
string
&
keyName
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"key"
]
=
key
;
p
[
"key"
]
=
key
;
...
@@ -54,7 +54,7 @@ class StubClient : public jsonrpc::Client
...
@@ -54,7 +54,7 @@ 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
generateECDSAKey
()
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
generateECDSAKey
()
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
=
Json
::
nullValue
;
p
=
Json
::
nullValue
;
...
@@ -65,7 +65,7 @@ class StubClient : public jsonrpc::Client
...
@@ -65,7 +65,7 @@ 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
renameECDSAKey
(
const
std
::
string
&
KeyName
,
const
std
::
string
&
tempKeyName
)
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
renameECDSAKey
(
const
std
::
string
&
KeyName
,
const
std
::
string
&
tempKeyName
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"keyName"
]
=
KeyName
;
p
[
"keyName"
]
=
KeyName
;
...
@@ -77,7 +77,7 @@ class StubClient : public jsonrpc::Client
...
@@ -77,7 +77,7 @@ 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
getPublicECDSAKey
(
const
std
::
string
&
keyName
)
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
getPublicECDSAKey
(
const
std
::
string
&
keyName
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"keyName"
]
=
keyName
;
p
[
"keyName"
]
=
keyName
;
...
@@ -88,7 +88,7 @@ class StubClient : public jsonrpc::Client
...
@@ -88,7 +88,7 @@ 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
ecdsaSignMessageHash
(
int
base
,
const
std
::
string
&
keyName
,
const
std
::
string
&
messageHash
)
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
ecdsaSignMessageHash
(
int
base
,
const
std
::
string
&
keyName
,
const
std
::
string
&
messageHash
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"base"
]
=
base
;
p
[
"base"
]
=
base
;
...
@@ -101,7 +101,7 @@ class StubClient : public jsonrpc::Client
...
@@ -101,7 +101,7 @@ 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
generateDKGPoly
(
const
std
::
string
&
polyName
,
int
t
)
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
generateDKGPoly
(
const
std
::
string
&
polyName
,
int
t
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"polyName"
]
=
polyName
;
p
[
"polyName"
]
=
polyName
;
...
@@ -113,7 +113,7 @@ class StubClient : public jsonrpc::Client
...
@@ -113,7 +113,7 @@ 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
getVerificationVector
(
const
std
::
string
&
polyName
,
int
t
,
int
n
)
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
getVerificationVector
(
const
std
::
string
&
polyName
,
int
t
,
int
n
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"polyName"
]
=
polyName
;
p
[
"polyName"
]
=
polyName
;
...
@@ -126,7 +126,7 @@ class StubClient : public jsonrpc::Client
...
@@ -126,7 +126,7 @@ 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
getSecretShare
(
const
std
::
string
&
polyName
,
const
Json
::
Value
&
publicKeys
,
int
t
,
int
n
)
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
getSecretShare
(
const
std
::
string
&
polyName
,
const
Json
::
Value
&
publicKeys
,
int
t
,
int
n
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"polyName"
]
=
polyName
;
p
[
"polyName"
]
=
polyName
;
...
@@ -140,7 +140,7 @@ class StubClient : public jsonrpc::Client
...
@@ -140,7 +140,7 @@ 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
dkgVerification
(
const
std
::
string
&
publicShares
,
const
std
::
string
&
ethKeyName
,
const
std
::
string
&
SecretShare
,
int
t
,
int
n
,
int
index
)
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
dkgVerification
(
const
std
::
string
&
publicShares
,
const
std
::
string
&
ethKeyName
,
const
std
::
string
&
SecretShare
,
int
t
,
int
n
,
int
index
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"ethKeyName"
]
=
ethKeyName
;
p
[
"ethKeyName"
]
=
ethKeyName
;
...
@@ -156,7 +156,7 @@ class StubClient : public jsonrpc::Client
...
@@ -156,7 +156,7 @@ 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
createBLSPrivateKey
(
const
std
::
string
&
blsKeyName
,
const
std
::
string
&
ethKeyName
,
const
std
::
string
&
polyName
,
const
std
::
string
&
SecretShare
,
int
t
,
int
n
)
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
createBLSPrivateKey
(
const
std
::
string
&
blsKeyName
,
const
std
::
string
&
ethKeyName
,
const
std
::
string
&
polyName
,
const
std
::
string
&
SecretShare
,
int
t
,
int
n
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"blsKeyName"
]
=
blsKeyName
;
p
[
"blsKeyName"
]
=
blsKeyName
;
...
@@ -172,7 +172,7 @@ class StubClient : public jsonrpc::Client
...
@@ -172,7 +172,7 @@ 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
getBLSPublicKeyShare
(
const
std
::
string
&
blsKeyName
)
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
getBLSPublicKeyShare
(
const
std
::
string
&
blsKeyName
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"blsKeyName"
]
=
blsKeyName
;
p
[
"blsKeyName"
]
=
blsKeyName
;
...
@@ -184,7 +184,7 @@ class StubClient : public jsonrpc::Client
...
@@ -184,7 +184,7 @@ 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
complaintResponse
(
const
std
::
string
&
polyName
,
int
ind
)
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
complaintResponse
(
const
std
::
string
&
polyName
,
int
ind
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"polyName"
]
=
polyName
;
p
[
"polyName"
]
=
polyName
;
...
@@ -196,7 +196,7 @@ class StubClient : public jsonrpc::Client
...
@@ -196,7 +196,7 @@ 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
multG2
(
const
std
::
string
&
x
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"x"
]
=
x
;
p
[
"x"
]
=
x
;
...
@@ -208,7 +208,7 @@ class StubClient : public jsonrpc::Client
...
@@ -208,7 +208,7 @@ 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
isPolyExists
(
const
std
::
string
&
polyName
)
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
isPolyExists
(
const
std
::
string
&
polyName
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"polyName"
]
=
polyName
;
p
[
"polyName"
]
=
polyName
;
...
@@ -223,7 +223,7 @@ class StubClient : public jsonrpc::Client
...
@@ -223,7 +223,7 @@ class StubClient : public jsonrpc::Client
////CSRManagerServer
////CSRManagerServer
Json
::
Value
getUnsignedCSRs
()
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
getUnsignedCSRs
()
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
=
Json
::
nullValue
;
p
=
Json
::
nullValue
;
...
@@ -236,7 +236,7 @@ class StubClient : public jsonrpc::Client
...
@@ -236,7 +236,7 @@ class StubClient : public jsonrpc::Client
Json
::
Value
signByHash
(
const
std
::
string
&
hash
,
int
status
)
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
signByHash
(
const
std
::
string
&
hash
,
int
status
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"hash"
]
=
hash
;
p
[
"hash"
]
=
hash
;
...
@@ -249,7 +249,7 @@ class StubClient : public jsonrpc::Client
...
@@ -249,7 +249,7 @@ class StubClient : public jsonrpc::Client
}
}
Json
::
Value
getServerStatus
()
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
getServerStatus
()
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
=
Json
::
nullValue
;
p
=
Json
::
nullValue
;
...
...
tests.bash
0 → 100755
View file @
3074ad6a
#!/bin/bash
set
-e
./testw
[
bls-key-encrypt]
./testw
[
bls-key-encrypt-decrypt]
./testw
[
dkg-gen]
./testw
[
dkg-pub_shares]
#./testw [dkg-encr_sshares]
./testw
[
dkg-verify]
./testw
[
ecdsa_test]
./testw
[
test_test]
./testw
[
get_pub_ecdsa_key_test]
./testw
[
bls_dkg]
./testw
[
api_test]
./testw
[
getServerStatus_test]
./testw
[
many_threads_test]
./testw
[
ecdsa_api_test]
./testw
[
dkg_api_test]
./testw
[
is_poly_test]
./testw
[
aes_dkg]
#./testw [bls_sign]
./testw
[
AES-encrypt-decrypt]
testw.cpp
View file @
3074ad6a
This diff is collapsed.
Click to expand it.
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