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
18ed06f8
Unverified
Commit
18ed06f8
authored
Nov 06, 2020
by
kladko
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into develop_merge
parents
e0392674
f53e5094
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
144 additions
and
24 deletions
+144
-24
dockerimagebase.yml
.github/workflows/dockerimagebase.yml
+1
-1
DKGCrypto.cpp
DKGCrypto.cpp
+1
-1
Dockerfile
Dockerfile
+2
-0
DockerfileRelease
DockerfileRelease
+6
-0
DockerfileSimulation
DockerfileSimulation
+2
-1
ECDSACrypto.cpp
ECDSACrypto.cpp
+27
-0
ECDSACrypto.h
ECDSACrypto.h
+2
-0
Makefile.am
Makefile.am
+2
-2
SEKManager.cpp
SEKManager.cpp
+3
-3
SGXWalletServer.cpp
SGXWalletServer.cpp
+36
-1
SGXWalletServer.hpp
SGXWalletServer.hpp
+5
-0
ServerInit.cpp
ServerInit.cpp
+1
-1
TestUtils.cpp
TestUtils.cpp
+0
-3
TestUtils.h
TestUtils.h
+2
-3
VERSION
VERSION
+1
-1
abstractstubserver.h
abstractstubserver.h
+6
-0
common.h
common.h
+1
-1
start.sh
docker/start.sh
+1
-1
libBLS
libBLS
+1
-1
sgxwallet_common.h
sgxwallet_common.h
+1
-1
stubclient.h
stubclient.h
+12
-0
testw.cpp
testw.cpp
+30
-3
testw.py
testw.py
+1
-0
No files found.
.github/workflows/dockerimagebase.yml
View file @
18ed06f8
...
...
@@ -16,7 +16,7 @@ jobs:
-
name
:
submodule update
run
:
git submodule update --init --recursive
-
name
:
Build the Docker image
run
:
docker build . --file DockerfileBase --tag skalenetwork/sgxwallet_base:latest
run
:
docker build . --file DockerfileBase --tag skalenetwork/sgxwallet_base:latest
&& docker push skalenetwork/sgxwallet_base:latest
-
name
:
deploy docker image
if
:
contains(github.ref, 'develop') || contains(github.ref, 'beta') || contains(github.ref, 'master') || contains(github.ref, 'stable')
run
:
|
...
...
DKGCrypto.cpp
View file @
18ed06f8
...
...
@@ -236,7 +236,7 @@ getSecretShares(const string &_polyName, const char *_encryptedPolyHex, const ve
sgx_status_t
status
=
SGX_SUCCESS
;
READ_LOCK
(
i
nitMutex
);
READ_LOCK
(
sgxI
nitMutex
);
status
=
trustedSetEncryptedDkgPoly
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
encLen
);
...
...
Dockerfile
View file @
18ed06f8
...
...
@@ -10,4 +10,6 @@ RUN bash -c "make -j$(nproc)"
RUN
ccache
-sz
RUN
mkdir
-p
/usr/src/sdk/sgx_data
COPY
docker/start.sh ./
RUN
rm
-rf
/usr/src/sdk/sgx-sdk-build/
RUN
rm
/opt/intel/sgxsdk/lib64/
*
_sim.so
ENTRYPOINT
["/usr/src/sdk/start.sh"]
DockerfileRelease
View file @
18ed06f8
...
...
@@ -14,4 +14,10 @@ RUN cd scripts && ./sign_enclave.bash
RUN ccache -sz
RUN mkdir -p /usr/src/sdk/sgx_data
COPY docker/start.sh ./
RUN rm -rf /usr/src/sdk/sgx-sdk-build/
RUN rm /opt/intel/sgxsdk/lib64/*_sim.so
RUN rm /usr/src/sdk/secure_enclave/secure_enclave*.so
RUN cd /usr/src/sdk/secure_enclave && \
curl --output secure_enclave.signed.so \
https://raw.githubusercontent.com/skalenetwork/signed_sgx_enclaves/master/secure_enclave_signed.so.1
ENTRYPOINT ["/usr/src/sdk/start.sh"]
DockerfileSimulation
View file @
18ed06f8
FROM skalenetwork/sgxwallet_base:latest
RUN apt update &&
apt install -y curl secure-delete
RUN apt update && apt install -y curl secure-delete
RUN ccache -sz
...
...
@@ -15,5 +15,6 @@ RUN ./autoconf.bash && \
mkdir -p /usr/src/sdk/sgx_data
COPY docker/start.sh ./
RUN rm -rf /usr/src/sdk/sgx-sdk-build/
ENTRYPOINT ["/usr/src/sdk/start.sh"]
ECDSACrypto.cpp
View file @
18ed06f8
...
...
@@ -228,3 +228,30 @@ vector <string> ecdsaSignHash(const std::string& encryptedKeyHex, const char *ha
return
signatureVector
;
}
string
encryptECDSAKey
(
const
string
&
_key
)
{
vector
<
char
>
key
(
BUF_LEN
,
0
);
for
(
size_t
i
=
0
;
i
<
_key
.
size
();
++
i
)
{
key
[
i
]
=
_key
[
i
];
}
vector
<
uint8_t
>
encryptedKey
(
BUF_LEN
,
0
);
int
errStatus
=
0
;
vector
<
char
>
errString
(
BUF_LEN
,
0
);
uint64_t
enc_len
=
0
;
sgx_status_t
status
=
SGX_SUCCESS
;
RESTART_BEGIN
status
=
trustedEncryptKey
(
eid
,
&
errStatus
,
errString
.
data
(),
key
.
data
(),
encryptedKey
.
data
(),
&
enc_len
);
RESTART_END
if
(
status
!=
0
)
{
throw
SGXException
(
status
,
string
(
"Could not encrypt ECDSA key: "
+
string
(
errString
.
begin
(),
errString
.
end
())).
c_str
());
}
vector
<
char
>
hexEncrKey
=
carray2Hex
(
encryptedKey
.
data
(),
enc_len
);
return
string
(
hexEncrKey
.
begin
(),
hexEncrKey
.
end
());
}
ECDSACrypto.h
View file @
18ed06f8
...
...
@@ -35,5 +35,7 @@ string getECDSAPubKey(const std::string& _encryptedKeyHex);
vector
<
string
>
ecdsaSignHash
(
const
std
::
string
&
encryptedKeyHex
,
const
char
*
hashHex
,
int
base
);
string
encryptECDSAKey
(
const
string
&
key
);
#endif //SGXD_ECDSACRYPTO_H
Makefile.am
View file @
18ed06f8
...
...
@@ -103,7 +103,7 @@ sgxwallet_LDADD=-l$(SGX_URTS_LIB) -l$(SGX_UAE_SERVICE_LIB) -LlibBLS/deps/deps_in
-l
:libbls.a
-l
:libleveldb.a
\
-l
:libff.a
-lgmp
-ldl
-l
:libsgx_capable.a
-l
:libsgx_tprotected_fs.a
\
-ljsonrpccpp-stub
-ljsonrpccpp-server
-ljsonrpccpp-client
-ljsonrpccpp-common
-ljsoncpp
-lmicrohttpd
\
-lboost_system
-lboost_thread
-lgnutls
-lgcrypt
-lcurl
-lssl
-lcrypto
-lz
-lpthread
-lstdc
++fs
-lboost_system
-lboost_thread
-lgnutls
-lgcrypt
-l
idn2
-l
curl
-lssl
-lcrypto
-lz
-lpthread
-lstdc
++fs
testw_SOURCES
=
testw.cpp
$(COMMON_SRC)
...
...
@@ -115,4 +115,4 @@ cert_util_SOURCES= InvalidStateException.cpp Exception.cpp InvalidArgumentExcep
cert_util_LDADD
=
-LlibBLS
/deps/deps_inst/x86_or_x64/lib
-Lleveldb
/build
-LlibBLS
/build
\
-LlibBLS
/build/libff/libff
\
-l
:libbls.a
-l
:libleveldb.a
\
-l
:libff.a
-lgmp
-ljsonrpccpp-stub
-ljsonrpccpp-server
-ljsonrpccpp-client
-ljsonrpccpp-common
-ljsoncpp
-lmicrohttpd
-lgnutls
-lgcrypt
-lcurl
-lssl
-lcrypto
-lz
-lpthread
-ldl
-l
:libff.a
-lgmp
-ljsonrpccpp-stub
-ljsonrpccpp-server
-ljsonrpccpp-client
-ljsonrpccpp-common
-ljsoncpp
-lmicrohttpd
-lgnutls
-lgcrypt
-l
idn2
-l
curl
-lssl
-lcrypto
-lz
-lpthread
-ldl
SEKManager.cpp
View file @
18ed06f8
...
...
@@ -65,7 +65,7 @@ void create_test_key() {
sgx_status_t
status
=
SGX_SUCCESS
;
{
READ_LOCK
(
i
nitMutex
);
READ_LOCK
(
sgxI
nitMutex
);
status
=
trustedEncryptKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
key
.
c_str
(),
encrypted_key
,
&
enc_len
);
}
...
...
@@ -96,7 +96,7 @@ void validate_SEK() {
sgx_status_t
status
=
SGX_SUCCESS
;
{
READ_LOCK
(
i
nitMutex
);
READ_LOCK
(
sgxI
nitMutex
);
status
=
trustedDecryptKey
(
eid
,
&
err_status
,
errMsg
.
data
(),
encr_test_key
.
data
(),
len
,
decr_key
.
data
());
}
...
...
@@ -126,7 +126,7 @@ shared_ptr <vector<uint8_t>> check_and_set_SEK(const string &SEK) {
sgx_status_t
status
=
SGX_SUCCESS
;
{
READ_LOCK
(
i
nitMutex
);
READ_LOCK
(
sgxI
nitMutex
);
status
=
trustedSetSEKBackup
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_SEK
->
data
(),
&
l
,
SEK
.
c_str
());
}
...
...
SGXWalletServer.cpp
View file @
18ed06f8
...
...
@@ -54,7 +54,7 @@
using
namespace
std
;
std
::
shared_timed_mutex
i
nitMutex
;
std
::
shared_timed_mutex
sgxI
nitMutex
;
uint64_t
initTime
;
void
setFullOptions
(
uint64_t
_logLevel
,
int
_useHTTPS
,
int
_autoconfirm
,
int
_enterBackupKey
)
{
...
...
@@ -268,6 +268,37 @@ SGXWalletServer::blsSignMessageHashImpl(const string &_keyShareName, const strin
}
Json
::
Value
SGXWalletServer
::
importECDSAKeyImpl
(
const
string
&
_keyShare
,
const
string
&
_keyShareName
)
{
spdlog
::
info
(
"Entering {}"
,
__FUNCTION__
);
INIT_RESULT
(
result
)
result
[
"encryptedKey"
]
=
""
;
try
{
if
(
!
checkECDSAKeyName
(
_keyShareName
))
{
throw
SGXException
(
INVALID_ECDSA_KEY_NAME
,
"Invalid ECDSA key name"
);
}
string
hashTmp
=
_keyShare
;
if
(
hashTmp
[
0
]
==
'0'
&&
(
hashTmp
[
1
]
==
'x'
||
hashTmp
[
1
]
==
'X'
))
{
hashTmp
.
erase
(
hashTmp
.
begin
(),
hashTmp
.
begin
()
+
2
);
}
if
(
!
checkHex
(
hashTmp
))
{
throw
SGXException
(
INVALID_HEX
,
"Invalid ECDSA key share, please use hex"
);
}
string
encryptedKey
=
encryptECDSAKey
(
hashTmp
);
writeDataToDB
(
_keyShareName
,
encryptedKey
);
result
[
"encryptedKey"
]
=
encryptedKey
;
result
[
"publicKey"
]
=
getECDSAPubKey
(
encryptedKey
);
}
HANDLE_SGX_EXCEPTION
(
result
)
RETURN_SUCCESS
(
result
);
}
Json
::
Value
SGXWalletServer
::
generateECDSAKeyImpl
()
{
spdlog
::
info
(
"Entering {}"
,
__FUNCTION__
);
INIT_RESULT
(
result
)
...
...
@@ -735,6 +766,10 @@ Json::Value SGXWalletServer::calculateAllBLSPublicKeys(const Json::Value& public
return
calculateAllBLSPublicKeysImpl
(
publicShares
,
t
,
n
);
}
Json
::
Value
SGXWalletServer
::
importECDSAKey
(
const
std
::
string
&
keyShare
,
const
std
::
string
&
keyShareName
)
{
return
importECDSAKeyImpl
(
keyShare
,
keyShareName
);
}
Json
::
Value
SGXWalletServer
::
generateECDSAKey
()
{
return
generateECDSAKeyImpl
();
}
...
...
SGXWalletServer.hpp
View file @
18ed06f8
...
...
@@ -51,6 +51,9 @@ public:
virtual
Json
::
Value
blsSignMessageHash
(
const
string
&
_keyShareName
,
const
string
&
_messageHash
,
int
_t
,
int
_n
);
virtual
Json
::
Value
importECDSAKey
(
const
std
::
string
&
keyShare
,
const
std
::
string
&
keyShareName
);
virtual
Json
::
Value
generateECDSAKey
();
virtual
Json
::
Value
...
...
@@ -102,6 +105,8 @@ public:
static
Json
::
Value
blsSignMessageHashImpl
(
const
string
&
_keyShareName
,
const
string
&
_messageHash
,
int
t
,
int
n
);
static
Json
::
Value
importECDSAKeyImpl
(
const
string
&
_keyShare
,
const
string
&
_keyShareName
);
static
Json
::
Value
generateECDSAKeyImpl
();
static
Json
::
Value
ecdsaSignMessageHashImpl
(
int
_base
,
const
string
&
keyName
,
const
string
&
_messageHash
);
...
...
ServerInit.cpp
View file @
18ed06f8
...
...
@@ -86,7 +86,7 @@ uint64_t initEnclave() {
{
WRITE_LOCK
(
i
nitMutex
);
WRITE_LOCK
(
sgxI
nitMutex
);
if
(
eid
!=
0
)
{
if
(
sgx_destroy_enclave
(
eid
)
!=
SGX_SUCCESS
)
{
...
...
TestUtils.cpp
View file @
18ed06f8
...
...
@@ -21,12 +21,9 @@
@date 2020
*/
#include <libff/algebra/fields/fp.hpp>
#include <dkg/dkg.h>
#include <jsonrpccpp/server/connectors/httpserver.h>
#include <libff/algebra/curves/alt_bn128/alt_bn128_pp.hpp>
#include <libff/algebra/exponentiation/exponentiation.hpp>
#include <libff/algebra/fields/fp.hpp>
#include <dkg/dkg.h>
#include "sgxwallet_common.h"
#include "third_party/intel/create_enclave.h"
...
...
TestUtils.h
View file @
18ed06f8
...
...
@@ -24,12 +24,11 @@
#ifndef SGXWALLET_TESTUTILS_H
#define SGXWALLET_TESTUTILS_H
#include <libff/algebra/fields/fp.hpp>
#include <dkg/dkg.h>
#include <jsonrpccpp/server/connectors/httpserver.h>
#include <libff/algebra/curves/alt_bn128/alt_bn128_pp.hpp>
#include <libff/algebra/exponentiation/exponentiation.hpp>
#include <libff/algebra/fields/fp.hpp>
//
#include <libff/algebra/exponentiation/exponentiation.hpp>
//
#include <libff/algebra/fields/fp.hpp>
#include <dkg/dkg.h>
#include "sgxwallet_common.h"
#include "third_party/intel/create_enclave.h"
...
...
VERSION
View file @
18ed06f8
1.58.5
\ No newline at end of file
1.58.6
\ No newline at end of file
abstractstubserver.h
View file @
18ed06f8
...
...
@@ -39,6 +39,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"importBLSKeyShare"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"keyShare"
,
jsonrpc
::
JSON_STRING
,
"keyShareName"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractStubServer
::
importBLSKeyShareI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"blsSignMessageHash"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"keyShareName"
,
jsonrpc
::
JSON_STRING
,
"messageHash"
,
jsonrpc
::
JSON_STRING
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
"n"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
blsSignMessageHashI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"importECDSAKey"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"key"
,
jsonrpc
::
JSON_STRING
,
"keyName"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractStubServer
::
importECDSAKeyI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"generateECDSAKey"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
NULL
),
&
AbstractStubServer
::
generateECDSAKeyI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"getPublicECDSAKey"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"keyName"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractStubServer
::
getPublicECDSAKeyI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"ecdsaSignMessageHash"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"base"
,
jsonrpc
::
JSON_INTEGER
,
"keyName"
,
jsonrpc
::
JSON_STRING
,
"messageHash"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractStubServer
::
ecdsaSignMessageHashI
);
...
...
@@ -68,6 +69,10 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
response
=
this
->
blsSignMessageHash
(
request
[
"keyShareName"
].
asString
(),
request
[
"messageHash"
].
asString
(),
request
[
"t"
].
asInt
(),
request
[
"n"
].
asInt
());
}
inline
virtual
void
importECDSAKeyI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
{
response
=
this
->
importECDSAKey
(
request
[
"key"
].
asString
(),
request
[
"keyName"
].
asString
());
}
inline
virtual
void
generateECDSAKeyI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
{
(
void
)
request
;
...
...
@@ -141,6 +146,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
virtual
Json
::
Value
importBLSKeyShare
(
const
std
::
string
&
keyShare
,
const
std
::
string
&
keyShareName
)
=
0
;
virtual
Json
::
Value
blsSignMessageHash
(
const
std
::
string
&
keyShareName
,
const
std
::
string
&
messageHash
,
int
t
,
int
n
)
=
0
;
virtual
Json
::
Value
importECDSAKey
(
const
std
::
string
&
keyShare
,
const
std
::
string
&
keyShareName
)
=
0
;
virtual
Json
::
Value
generateECDSAKey
()
=
0
;
virtual
Json
::
Value
getPublicECDSAKey
(
const
std
::
string
&
keyName
)
=
0
;
virtual
Json
::
Value
ecdsaSignMessageHash
(
int
base
,
const
std
::
string
&
keyName
,
const
std
::
string
&
messageHash
)
=
0
;
...
...
common.h
View file @
18ed06f8
...
...
@@ -98,7 +98,7 @@ BOOST_THROW_EXCEPTION(runtime_error(__ERR_STRING__)); \
#include <shared_mutex>
extern
std
::
shared_timed_mutex
i
nitMutex
;
extern
std
::
shared_timed_mutex
sgxI
nitMutex
;
extern
uint64_t
initTime
;
#ifdef SGX_HW_SIM
...
...
docker/start.sh
View file @
18ed06f8
...
...
@@ -28,7 +28,7 @@ cd /usr/src/sdk;
if
[[
-f
"/var/hwmode"
]]
then
echo
"Running in SGX hardware mode"
export
LD_LIBRARY_PATH
=
${
LD_LIBRARY_PATH
}
:/opt/intel/sgxpsw/aesm/
export
LD_LIBRARY_PATH
=
/usr/src/sdk/secure_enclave:
${
LD_LIBRARY_PATH
}
:/opt/intel/sgxpsw/aesm
jhid
-d
/opt/intel/sgxpsw/aesm/aesm_service &
pid
=
$!
...
...
libBLS
@
82884ec8
Subproject commit
78ea56c3b5251e9d840ef65705bb2c5f8f193662
Subproject commit
82884ec89e84539f25af206a0148ca34c35e078f
sgxwallet_common.h
View file @
18ed06f8
...
...
@@ -115,7 +115,7 @@ int __ATTEMPTS__ = 0; \
do {\
__ATTEMPTS__++; \
{\
READ_LOCK(
i
nitMutex);
READ_LOCK(
sgxI
nitMutex);
#define RESTART_END \
} \
...
...
stubclient.h
View file @
18ed06f8
...
...
@@ -39,6 +39,18 @@ class StubClient : public jsonrpc::Client
throw
jsonrpc
::
JsonRpcException
(
jsonrpc
::
Errors
::
ERROR_CLIENT_INVALID_RESPONSE
,
result
.
toStyledString
());
}
Json
::
Value
importECDSAKey
(
const
std
::
string
&
keyShare
,
const
std
::
string
&
keyShareName
)
{
Json
::
Value
p
;
p
[
"key"
]
=
keyShare
;
p
[
"keyName"
]
=
keyShareName
;
Json
::
Value
result
=
this
->
CallMethod
(
"importECDSAKey"
,
p
);
if
(
result
.
isObject
())
return
result
;
else
throw
jsonrpc
::
JsonRpcException
(
jsonrpc
::
Errors
::
ERROR_CLIENT_INVALID_RESPONSE
,
result
.
toStyledString
());
}
Json
::
Value
generateECDSAKey
()
{
Json
::
Value
p
;
...
...
testw.cpp
View file @
18ed06f8
...
...
@@ -21,12 +21,9 @@
@date 2020
*/
#include <libff/algebra/fields/fp.hpp>
#include <dkg/dkg.h>
#include <jsonrpccpp/server/connectors/httpserver.h>
#include <libff/algebra/curves/alt_bn128/alt_bn128_pp.hpp>
#include <libff/algebra/exponentiation/exponentiation.hpp>
#include <libff/algebra/fields/fp.hpp>
#include <dkg/dkg.h>
#include "sgxwallet_common.h"
#include "third_party/intel/create_enclave.h"
...
...
@@ -457,6 +454,21 @@ TEST_CASE_METHOD(TestFixture, "Delete Bls Key", "[delete-bls-key]") {
REQUIRE
(
c
.
deleteBlsKey
(
name
)[
"deleted"
]
==
true
);
}
TEST_CASE_METHOD
(
TestFixture
,
"Import ECDSA Key"
,
"[import-ecdsa-key]"
)
{
HttpClient
client
(
RPC_ENDPOINT
);
StubClient
c
(
client
,
JSONRPC_CLIENT_V2
);
std
::
string
name
=
"NEK:abcdef"
;
auto
response
=
c
.
importECDSAKey
(
"6507625568967977077291849236396320012317305261598035438182864059942098934847"
,
name
);
REQUIRE
(
response
[
"status"
]
!=
0
);
string
key_str
=
"0xe632f7fde2c90a073ec43eaa90dca7b82476bf28815450a11191484934b9c3f"
;
response
=
c
.
importECDSAKey
(
key_str
,
name
);
REQUIRE
(
response
[
"status"
]
==
0
);
REQUIRE
(
c
.
ecdsaSignMessageHash
(
16
,
name
,
SAMPLE_HASH
)[
"status"
]
==
0
);
}
TEST_CASE_METHOD
(
TestFixture
,
"Backup Key"
,
"[backup-key]"
)
{
HttpClient
client
(
RPC_ENDPOINT
);
StubClient
c
(
client
,
JSONRPC_CLIENT_V2
);
...
...
@@ -683,6 +695,21 @@ TEST_CASE_METHOD(TestFixture, "AES_DKG test", "[aes-dkg]") {
REQUIRE
(
convertG2ToString
(
decrypted_share_G2
)
==
shareG2
);
Json
::
Value
verificationVectorMult
=
complaintResponse
[
"verificationVectorMult"
];
libff
::
alt_bn128_G2
verificationValue
=
libff
::
alt_bn128_G2
::
zero
();
for
(
int
i
=
0
;
i
<
t
;
++
i
)
{
libff
::
alt_bn128_G2
value
;
value
.
Z
=
libff
::
alt_bn128_Fq2
::
one
();
value
.
X
.
c0
=
libff
::
alt_bn128_Fq
(
verificationVectorMult
[
i
][
0
].
asCString
());
value
.
X
.
c1
=
libff
::
alt_bn128_Fq
(
verificationVectorMult
[
i
][
1
].
asCString
());
value
.
Y
.
c0
=
libff
::
alt_bn128_Fq
(
verificationVectorMult
[
i
][
2
].
asCString
());
value
.
Y
.
c1
=
libff
::
alt_bn128_Fq
(
verificationVectorMult
[
i
][
3
].
asCString
());
verificationValue
=
verificationValue
+
value
;
}
verificationValue
.
to_affine_coordinates
();
REQUIRE
(
verificationValue
==
decrypted_share_G2
);
BLSSigShareSet
sigShareSet
(
t
,
n
);
string
hash
=
SAMPLE_HASH
;
...
...
testw.py
View file @
18ed06f8
...
...
@@ -36,6 +36,7 @@ testList = ["[first-run]",
"[get-server-version]"
,
"[backup-key]"
,
"[delete-bls-key]"
,
"[import-ecdsa-key]"
,
"[ecdsa-aes-key-gen]"
,
"[ecdsa-aes-key-sig-gen]"
,
"[ecdsa-aes-get-pub-key]"
,
...
...
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