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
6e6f76f8
Unverified
Commit
6e6f76f8
authored
Sep 10, 2019
by
kladkogex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed import
parent
bd4f9c28
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
SGXWalletServer.cpp
SGXWalletServer.cpp
+2
-2
testw.cpp
testw.cpp
+16
-5
No files found.
SGXWalletServer.cpp
View file @
6e6f76f8
...
@@ -93,8 +93,6 @@ Json::Value importBLSKeyShareImpl(int index, const std::string& _keyShare, cons
...
@@ -93,8 +93,6 @@ Json::Value importBLSKeyShareImpl(int index, const std::string& _keyShare, cons
result
[
"errorMessage"
]
=
""
;
result
[
"errorMessage"
]
=
""
;
result
[
"encryptedKeyShare"
]
=
""
;
result
[
"encryptedKeyShare"
]
=
""
;
try
{
try
{
...
@@ -108,6 +106,8 @@ Json::Value importBLSKeyShareImpl(int index, const std::string& _keyShare, cons
...
@@ -108,6 +106,8 @@ Json::Value importBLSKeyShareImpl(int index, const std::string& _keyShare, cons
throw
RPCException
(
errStatus
,
errMsg
);
throw
RPCException
(
errStatus
,
errMsg
);
}
}
result
[
"encryptedKeyShare"
]
=
encryptedKeyShareHex
;
writeKeyShare
(
_keyShareName
,
encryptedKeyShareHex
);
writeKeyShare
(
_keyShareName
,
encryptedKeyShareHex
);
}
catch
(
RPCException
&
_e
)
{
}
catch
(
RPCException
&
_e
)
{
...
...
testw.cpp
View file @
6e6f76f8
...
@@ -67,7 +67,8 @@ int updated;
...
@@ -67,7 +67,8 @@ int updated;
#define TEST_KEY "4160780231445160889237664391382223604184857153814275770598791864649971919844"
#define TEST_BLS_KEY_SHARE "4160780231445160889237664391382223604184857153814275770598791864649971919844"
#define TEST_BLS_KEY_NAME "SCHAIN:17:INDEX:5:KEY:1"
void
reset_db
()
{
void
reset_db
()
{
REQUIRE
(
system
(
"rm -rf "
WALLETDB_NAME
)
==
0
);
REQUIRE
(
system
(
"rm -rf "
WALLETDB_NAME
)
==
0
);
...
@@ -75,7 +76,7 @@ void reset_db() {
...
@@ -75,7 +76,7 @@ void reset_db() {
char
*
encryptTestKey
()
{
char
*
encryptTestKey
()
{
const
char
*
key
=
TEST_
KEY
;
const
char
*
key
=
TEST_
BLS_KEY_SHARE
;
int
errStatus
=
-
1
;
int
errStatus
=
-
1
;
...
@@ -123,7 +124,7 @@ TEST_CASE("BLS key encrypt/decrypt", "[bls-key-encrypt-decrypt]") {
...
@@ -123,7 +124,7 @@ TEST_CASE("BLS key encrypt/decrypt", "[bls-key-encrypt-decrypt]") {
REQUIRE
(
errStatus
==
0
);
REQUIRE
(
errStatus
==
0
);
REQUIRE
(
strcmp
(
plaintextKey
,
TEST_
KEY
)
==
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
);
printf
(
"Decrypted key len %d
\n
"
,
(
int
)
strlen
(
plaintextKey
));
printf
(
"Decrypted key len %d
\n
"
,
(
int
)
strlen
(
plaintextKey
));
...
@@ -134,6 +135,16 @@ TEST_CASE("BLS key encrypt/decrypt", "[bls-key-encrypt-decrypt]") {
...
@@ -134,6 +135,16 @@ TEST_CASE("BLS key encrypt/decrypt", "[bls-key-encrypt-decrypt]") {
}
}
TEST_CASE
(
"BLS key import"
,
"[bls-key-import]"
)
{
TEST_CASE
(
"BLS key import"
,
"[bls-key-import]"
)
{
reset_db
();
init_all
();
auto
result
=
importBLSKeyShareImpl
(
1
,
TEST_BLS_KEY_SHARE
,
TEST_BLS_KEY_NAME
,
2
,
2
);
REQUIRE
(
result
[
"status"
]
==
0
);
REQUIRE
(
result
[
"encryptedKeyShare"
]
!=
""
);
}
}
...
@@ -176,8 +187,8 @@ TEST_CASE("KeysDB test", "[keys-db]") {
...
@@ -176,8 +187,8 @@ TEST_CASE("KeysDB test", "[keys-db]") {
init_all
();
init_all
();
string
key
=
"SCHAIN:17:INDEX:5:KEY:1"
;
string
key
=
TEST_BLS_KEY_SHARE
;
string
value
=
TEST_
KEY
;
string
value
=
TEST_
BLS_KEY_SHARE
;
...
...
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