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
f0f84a0f
Unverified
Commit
f0f84a0f
authored
Feb 15, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2077 Fixed Naming
parent
f2b8271f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
29 deletions
+29
-29
stubclient.h
stubclient.h
+19
-19
testw.cpp
testw.cpp
+10
-10
No files found.
stubclient.h
View file @
f0f84a0f
...
...
@@ -12,7 +12,7 @@ class StubClient : public jsonrpc::Client
public
:
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
;
p
[
"index"
]
=
index
;
...
...
@@ -27,7 +27,7 @@ class StubClient : public jsonrpc::Client
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
;
p
[
"keyShareName"
]
=
keyShareName
;
...
...
@@ -42,7 +42,7 @@ class StubClient : public jsonrpc::Client
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
;
p
[
"key"
]
=
key
;
...
...
@@ -54,7 +54,7 @@ class StubClient : public jsonrpc::Client
throw
jsonrpc
::
JsonRpcException
(
jsonrpc
::
Errors
::
ERROR_CLIENT_INVALID_RESPONSE
,
result
.
toStyledString
());
}
Json
::
Value
generateECDSAKey
()
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
generateECDSAKey
()
{
Json
::
Value
p
;
p
=
Json
::
nullValue
;
...
...
@@ -65,7 +65,7 @@ class StubClient : public jsonrpc::Client
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
;
p
[
"keyName"
]
=
KeyName
;
...
...
@@ -77,7 +77,7 @@ class StubClient : public jsonrpc::Client
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
;
p
[
"keyName"
]
=
keyName
;
...
...
@@ -88,7 +88,7 @@ class StubClient : public jsonrpc::Client
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
;
p
[
"base"
]
=
base
;
...
...
@@ -101,7 +101,7 @@ class StubClient : public jsonrpc::Client
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
;
p
[
"polyName"
]
=
polyName
;
...
...
@@ -113,7 +113,7 @@ class StubClient : public jsonrpc::Client
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
;
p
[
"polyName"
]
=
polyName
;
...
...
@@ -126,7 +126,7 @@ class StubClient : public jsonrpc::Client
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
;
p
[
"polyName"
]
=
polyName
;
...
...
@@ -140,7 +140,7 @@ class StubClient : public jsonrpc::Client
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
;
p
[
"ethKeyName"
]
=
ethKeyName
;
...
...
@@ -156,7 +156,7 @@ class StubClient : public jsonrpc::Client
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
;
p
[
"blsKeyName"
]
=
blsKeyName
;
...
...
@@ -172,7 +172,7 @@ class StubClient : public jsonrpc::Client
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
;
p
[
"blsKeyName"
]
=
blsKeyName
;
...
...
@@ -184,7 +184,7 @@ class StubClient : public jsonrpc::Client
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
;
p
[
"polyName"
]
=
polyName
;
...
...
@@ -196,7 +196,7 @@ class StubClient : public jsonrpc::Client
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
;
p
[
"x"
]
=
x
;
...
...
@@ -208,7 +208,7 @@ class StubClient : public jsonrpc::Client
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
;
p
[
"polyName"
]
=
polyName
;
...
...
@@ -223,7 +223,7 @@ class StubClient : public jsonrpc::Client
////CSRManagerServer
Json
::
Value
getUnsignedCSRs
()
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
getUnsignedCSRs
()
{
Json
::
Value
p
;
p
=
Json
::
nullValue
;
...
...
@@ -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
;
p
[
"hash"
]
=
hash
;
...
...
@@ -249,7 +249,7 @@ class StubClient : public jsonrpc::Client
}
Json
::
Value
getServerStatus
()
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
getServerStatus
()
{
Json
::
Value
p
;
p
=
Json
::
nullValue
;
...
...
testw.cpp
View file @
f0f84a0f
...
...
@@ -124,9 +124,8 @@ TEST_CASE("BLS key encrypt", "[bls-key-encrypt]") {
DEBUG_PRINT
=
1
;
is_sgx_https
=
0
;
init_all
(
false
,
false
,
init_SEK
);
char
*
key
=
encryptTestKey
(
);
auto
key
=
shared_ptr
<
char
>
(
encryptTestKey
()
);
REQUIRE
(
key
!=
nullptr
);
/*free*/
(
key
);
}
...
...
@@ -137,6 +136,7 @@ TEST_CASE("BLS key encrypt/decrypt", "[bls-key-encrypt-decrypt]") {
is_sgx_https
=
0
;
init_all
(
false
,
false
,
init_SEK
);
//init_enclave();
int
errStatus
=
-
1
;
...
...
@@ -152,7 +152,7 @@ TEST_CASE("BLS key encrypt/decrypt", "[bls-key-encrypt-decrypt]") {
REQUIRE
(
errStatus
==
0
);
REQUIRE
(
strcmp
(
plaintextKey
,
TEST_BLS_KEY_SHARE
)
==
0
);
printf
(
"Decrypt key completed with status: %d %s
\n
"
,
errStatus
,
errMsg
);
printf
(
"Decrypt key completed with status: %d %s
\n
"
,
errStatus
,
errMsg
.
data
()
);
printf
(
"Decrypted key len %d
\n
"
,
(
int
)
strlen
(
plaintextKey
));
printf
(
"Decrypted key: %s
\n
"
,
plaintextKey
);
...
...
@@ -189,7 +189,7 @@ TEST_CASE("DKG gen test", "[dkg-gen]") {
printf
(
"
\n
decrypt_dkg_secret completed with status: %d %s
\n
"
,
err_status
,
errMsg1
.
data
());
printf
(
"decrypted secret %s
\n\n
"
,
secret
.
data
());
printf
(
"secret length %d
\n
"
,
strlen
(
secret
.
data
()));
printf
(
"secret length %d
\n
"
,
(
int
)
strlen
(
secret
.
data
()));
printf
(
"decr length %d
\n
"
,
dec_len
);
sgx_destroy_enclave
(
eid
);
...
...
@@ -276,14 +276,14 @@ TEST_CASE("DKG public shares test", "[dkg-pub_shares]") {
encrypted_dkg_secret
.
data
(),
enc_len
,
public_shares
.
data
(),
t
,
n
);
REQUIRE
(
status
==
SGX_SUCCESS
);
printf
(
"
\n
get_public_shares status: %d error %s
\n\n
"
,
err_status
,
errMsg1
.
data
());
printf
(
" LEN: %d
\n
"
,
strlen
(
public_shares
.
data
()));
printf
(
" LEN: %d
\n
"
,
(
int
)
strlen
(
public_shares
.
data
()));
printf
(
" result: %s
\n
"
,
public_shares
.
data
());
vector
<
string
>
G2_strings
=
SplitString
(
public_shares
.
data
(),
','
);
vector
<
libff
::
alt_bn128_G2
>
pub_shares_G2
;
for
(
in
t
i
=
0
;
i
<
G2_strings
.
size
();
i
++
)
{
for
(
u_int64_
t
i
=
0
;
i
<
G2_strings
.
size
();
i
++
)
{
vector
<
string
>
koef_str
=
SplitString
(
G2_strings
.
at
(
i
).
c_str
(),
':'
);
libff
::
alt_bn128_G2
el
=
VectStringToG2
(
koef_str
);
//
libff::alt_bn128_G2 el = VectStringToG2(koef_str);
//cerr << "pub_share G2 " << i+1 << " : " << endl;
//el.print_coordinates();
pub_shares_G2
.
push_back
(
VectStringToG2
(
koef_str
));
...
...
@@ -422,7 +422,7 @@ TEST_CASE("ECDSA keygen and signature test", "[ecdsa_test]") {
string
hex
=
"3F891FDA3704F0368DAB65FA81EBE616F4AA2A0854995DA4DC0B59D2CADBD64F"
;
// char* hex = "0x09c6137b97cdf159b9950f1492ee059d1e2b10eaf7d51f3a97d61f2eee2e81db";
printf
(
"hash length %d "
,
hex
.
size
());
printf
(
"hash length %d "
,
(
int
)
hex
.
size
());
vector
<
char
>
signature_r
(
1024
,
0
);
vector
<
char
>
signature_s
(
1024
,
0
);
uint8_t
signature_v
=
0
;
...
...
@@ -488,8 +488,8 @@ TEST_CASE("get public ECDSA key", "[get_pub_ecdsa_key_test]") {
printf
(
"
\n
errMsg %s
\n
"
,
errMsg
.
data
());
REQUIRE
(
status
==
SGX_SUCCESS
);
printf
(
"
\n
was pub_key_x %s length %d:
\n
"
,
pub_key_x
.
data
(),
strlen
(
pub_key_x
.
data
()));
printf
(
"
\n
was pub_key_y %s length %d:
\n
"
,
pub_key_y
.
data
(),
strlen
(
pub_key_y
.
data
()));
printf
(
"
\n
was pub_key_x %s length %d:
\n
"
,
pub_key_x
.
data
(),
(
int
)
strlen
(
pub_key_x
.
data
()));
printf
(
"
\n
was pub_key_y %s length %d:
\n
"
,
pub_key_y
.
data
(),
(
int
)
strlen
(
pub_key_y
.
data
()));
/*printf("\nencr priv_key %s: \n");
for ( int i = 0; i < 1024 ; i++)
...
...
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