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
23e5ad22
Unverified
Commit
23e5ad22
authored
Sep 10, 2019
by
kladkogex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes
parent
13d43b91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
SGXWalletServer.cpp
SGXWalletServer.cpp
+12
-0
testw.cpp
testw.cpp
+27
-0
No files found.
SGXWalletServer.cpp
View file @
23e5ad22
...
...
@@ -126,6 +126,7 @@ Json::Value blsSignMessageHashImpl(const std::string& keyShareName, const std::s
result
[
"signatureShare"
]
=
""
;
//int errStatus = UNKNOWN_ERROR;
//char *errMsg = (char *) calloc(BUF_LEN, 1);
char
*
signature
=
(
char
*
)
calloc
(
BUF_LEN
,
1
);
...
...
@@ -140,13 +141,24 @@ Json::Value blsSignMessageHashImpl(const std::string& keyShareName, const std::s
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
return
result
;
}
catch
(...)
{
result
[
"status"
]
=
-
1
;
result
[
"errorMessage"
]
=
"Read key share has thrown exception"
;
return
result
;
}
try
{
if
(
!
sign
(
value
->
c_str
(),
messageHash
.
c_str
(),
2
,
2
,
1
,
signature
))
{
result
[
"status"
]
=
-
1
;
result
[
"errorMessage"
]
=
"Could not sign"
;
return
result
;
}
}
catch
(...)
{
result
[
"status"
]
=
-
1
;
result
[
"errorMessage"
]
=
"Sign has thrown exception"
;
return
result
;
}
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
...
...
testw.cpp
View file @
23e5ad22
...
...
@@ -177,7 +177,34 @@ TEST_CASE("BLS sign test", "[bls-sign]") {
}
TEST_CASE
(
"Server BLS sign test"
,
"[bls-server-sign]"
)
{
reset_db
();
init_all
();
char
*
encryptedKeyHex
=
encryptTestKey
();
REQUIRE
(
encryptedKeyHex
!=
nullptr
);
const
char
*
hexHash
=
"001122334455667788"
"001122334455667788"
"001122334455667788"
"001122334455667788"
;
Json
::
Value
result
;
REQUIRE_NOTHROW
(
result
=
blsSignMessageHashImpl
(
TEST_BLS_KEY_NAME
,
hexHash
));
if
(
result
[
"status"
]
!=
0
)
{
printf
(
"Error message: %s"
,
result
[
"errorMessage"
].
asString
().
c_str
());
}
REQUIRE
(
result
[
"status"
]
==
0
);
REQUIRE
(
result
[
"signatureShare"
]
!=
""
);
printf
(
"Signature is: %s
\n
"
,
result
[
"signatureShare"
].
asString
().
c_str
());
}
TEST_CASE
(
"KeysDB test"
,
"[keys-db]"
)
{
...
...
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