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
127f624c
Unverified
Commit
127f624c
authored
Jun 16, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix CMAKE file
parent
053fef20
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
12 deletions
+17
-12
ServerInit.cpp
ServerInit.cpp
+3
-2
TestUtils.h
TestUtils.h
+0
-3
testw.cpp
testw.cpp
+12
-7
testw.h
testw.h
+2
-0
No files found.
ServerInit.cpp
View file @
127f624c
...
...
@@ -100,11 +100,12 @@ void initEnclave(uint32_t _logLevel) {
}
void
initAll
(
uint32_t
_logLevel
,
bool
_checkCert
,
bool
_autoSign
)
{
static
int
sgxServerInited
;
static
atomic
<
int
>
sgxServerInited
(
0
);
cout
<<
"Running sgxwallet version:"
<<
SGXWalletServer
::
getVersion
()
<<
endl
;
CHECK_STATE
(
sgxServerInited
==
0
)
CHECK_STATE
(
sgxServerInited
!=
1
)
sgxServerInited
=
1
;
initEnclave
(
_logLevel
);
initUserSpace
();
...
...
TestUtils.h
View file @
127f624c
...
...
@@ -34,13 +34,10 @@ public:
static
string
stringFromFr
(
libff
::
alt_bn128_Fr
&
el
);
static
string
convertDecToHex
(
string
dec
,
int
numBytes
=
32
);
static
void
genTestKeys
();
static
int
updated
;
static
void
resetDB
();
static
shared_ptr
<
string
>
encryptTestKey
();
...
...
testw.cpp
View file @
127f624c
...
...
@@ -267,22 +267,27 @@ TEST_CASE_METHOD("BLS key encrypt/decrypt", "[bls-key-encrypt-decrypt]") {
*/
string
genECDSAKeyAPI
(
StubClient
&
_c
)
{
Json
::
Value
genKey
=
_c
.
generateECDSAKey
();
CHECK_STATE
(
genKey
[
"status"
].
asInt
()
==
0
);
auto
keyName
=
genKey
[
"keyName"
].
asString
();
CHECK_STATE
(
keyName
.
size
()
==
ECDSA_KEY_NAME_SIZE
);
return
keyName
;
}
TEST_CASE_METHOD
(
TestFixture
,
"ECDSA key gen API"
,
"[ecdsa-key-gen-api]"
)
{
HttpClient
client
(
RPC_ENDPOINT
);
StubClient
c
(
client
,
JSONRPC_CLIENT_V2
);
for
(
int
i
=
0
;
i
<=
20
;
i
++
)
{
try
{
Json
::
Value
genKey
=
c
.
generateECDSAKey
();
REQUIRE
(
genKey
[
"status"
].
asInt
()
==
0
);
auto
keyName
=
genKey
[
"keyName"
].
asString
();
REQUIRE
(
keyName
.
size
()
==
68
);
auto
keyName
=
genECDSAKeyAPI
(
c
);
Json
::
Value
sig
=
c
.
ecdsaSignMessageHash
(
16
,
genKey
[
"keyName"
].
asString
()
,
SAMPLE_HASH
);
Json
::
Value
sig
=
c
.
ecdsaSignMessageHash
(
16
,
keyName
,
SAMPLE_HASH
);
REQUIRE
(
sig
[
"status"
].
asInt
()
==
0
);
Json
::
Value
getPubKey
=
c
.
getPublicECDSAKey
(
genKey
[
"keyName"
].
asString
()
);
Json
::
Value
getPubKey
=
c
.
getPublicECDSAKey
(
keyName
);
REQUIRE
(
getPubKey
[
"status"
].
asInt
()
==
0
);
}
catch
(
JsonRpcException
&
e
)
{
cerr
<<
e
.
what
()
<<
endl
;
...
...
testw.h
View file @
127f624c
...
...
@@ -24,5 +24,7 @@
//openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr^
#define SAMPLE_CSR_FILE_NAME "samples/yourdomain.csr"
#define ECDSA_KEY_NAME_SIZE 68
#endif //SGXWALLET_TESTW_H
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