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
3f8f0434
Unverified
Commit
3f8f0434
authored
Sep 24, 2019
by
svetaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed server
parent
5c250261
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
6 deletions
+58
-6
Makefile.am
Makefile.am
+5
-2
SGXWalletServer.cpp
SGXWalletServer.cpp
+15
-4
SGXWalletServer.hpp
SGXWalletServer.hpp
+2
-0
abstractstubserver.h
abstractstubserver.h
+1
-0
testw.cpp
testw.cpp
+35
-0
No files found.
Makefile.am
View file @
3f8f0434
...
...
@@ -89,11 +89,14 @@ secure_enclave.signed.so: secure_enclave/secure_enclave.signed.so
## Use the variables, not the actual library names to ensure these
## targets work on simulation builds.
sgxwallet_LDADD
=
-l
$(SGX_URTS_LIB)
-Lleveldb
/build
-LlibBLS
/build
-LlibBLS
/build/libff/libff
-l
:libbls.a
-l
:libleveldb.a
-l
:libff.a
-lgmp
-ldl
-l
:libsgx_capable.a
-l
:libsgx_tprotected_fs.a
-ljsonrpccpp-stub
-lpthread
-ljsonrpccpp-common
-ljsonrpccpp-server
-ljsonrpccpp-client
-ljsoncpp
-lprocps
intel-sgx-ssl/Linu./x/package/lib64/libsgx_usgxssl.a
sgxwallet_LDADD
=
-l
$(SGX_URTS_LIB)
-Lleveldb
/build
-LlibBLS
/build
-LlibBLS
/build/libff/libff
-l
:libbls.a
-l
:libleveldb.a
\
-l
:libff.a
-lgmp
-ldl
-l
:libsgx_capable.a
-l
:libsgx_tprotected_fs.a
-ljsonrpccpp-stub
-lpthread
-ljsonrpccpp-common
\
-ljsonrpccpp-server
-ljsonrpccpp-client
-ljsoncpp
-lcurl
-lprocps
intel-sgx-ssl/Linux/package/lib64/libsgx_usgxssl.a
testw_SOURCES
=
testw.cpp stubclient.cpp SGXWalletServer.cpp RPCException.cpp BLSCrypto.cpp ServerInit.cpp LevelDB.cpp BLSPrivateKeyShareSGX.cpp ECDSACrypto.cpp
$(COMMON_SRC)
testw_SOURCES
=
testw.cpp stubclient.cpp SGXWalletServer.cpp RPCException.cpp BLSCrypto.cpp ServerInit.cpp LevelDB.cpp
\
BLSPrivateKeyShareSGX.cpp ECDSACrypto.cpp
$(COMMON_SRC)
nodist_testw_SOURCES
=
${
nodist_sgxwallet_SOURCES
}
EXTRA_testw_DEPENDENCIES
=
${
EXTRA_sgxwallet_DEPENDENCIES
}
testw_LDADD
=
${
sgxwallet_LDADD
}
...
...
SGXWalletServer.cpp
View file @
3f8f0434
...
...
@@ -31,11 +31,19 @@ SGXWalletServer::SGXWalletServer(AbstractServerConnector &connector,
serverVersion_t
type
)
:
AbstractStubServer
(
connector
,
type
)
{}
SGXWalletServer
*
s
=
nullptr
;
int
init_server
()
{
HttpServer
httpserver
(
1025
);
SGXWalletServer
s
(
httpserver
,
s
=
new
SGXWalletServer
(
httpserver
,
JSONRPC_SERVER_V1V2
);
// hybrid server (json-rpc 1.0 & 2.0)
s
.
StartListening
();
if
(
!
s
->
StartListening
())
{
cerr
<<
"Server could not start listening"
<<
endl
;
exit
(
-
1
);
}
return
0
;
}
...
...
@@ -142,13 +150,16 @@ Json::Value generateECDSAKeyImpl(const std::string &_keyName) {
result
[
"errorMessage"
]
=
""
;
result
[
"encryptedKey"
]
=
""
;
cerr
<<
"Calling method"
<<
endl
;
char
*
encryptedKey
=
nullptr
;
try
{
/* char*
encryptedKey = gen_ecdsa_key();
encryptedKey
=
gen_ecdsa_key
();
if
(
encryptedKey
==
nullptr
)
{
throw
RPCException
(
UNKNOWN_ERROR
,
""
);
}
*/
}
writeECDSAKey
(
_keyName
,
encryptedKey
);
}
catch
(
RPCException
&
_e
)
{
...
...
SGXWalletServer.hpp
View file @
3f8f0434
...
...
@@ -12,6 +12,8 @@ using namespace std;
class
SGXWalletServer
:
public
AbstractStubServer
{
SGXWalletServer
*
server
=
nullptr
;
public
:
SGXWalletServer
(
AbstractServerConnector
&
connector
,
serverVersion_t
type
);
...
...
abstractstubserver.h
View file @
3f8f0434
...
...
@@ -33,6 +33,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
}
inline
virtual
void
generateECDSAKeyI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
{
std
::
cerr
<<
"Got request"
<<
std
::
endl
;
response
=
this
->
generateECDSAKey
(
request
[
"keyName"
].
asString
());
}
inline
virtual
void
ecdsaSignMessageHashI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
...
...
testw.cpp
View file @
3f8f0434
...
...
@@ -68,6 +68,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "catch.hpp"
#include "stubclient.h"
std
::
string
stringFromFr
(
libff
::
alt_bn128_Fr
&
el
)
{
mpz_t
t
;
...
...
@@ -401,6 +403,39 @@ TEST_CASE("ECDSA keygen and signature test", "[ecdsa_test]") {
printf
(
"
\n
signature v: %s "
,
signature_v
);
printf
(
"
\n
%s
\n
"
,
errMsg
);
}
#include "stubclient.h"
#include <jsonrpccpp/client/connectors/httpclient.h>
using
namespace
jsonrpc
;
using
namespace
std
;
TEST_CASE
(
"API test"
,
"[api_test]"
)
{
cerr
<<
"API test started"
<<
endl
;
// init_all();
//HttpServer httpserver(1025);
//SGXWalletServer s(httpserver,
// JSONRPC_SERVER_V1); // hybrid server (json-rpc 1.0 & 2.0)
// s.StartListening();
cerr
<<
"Server inited"
<<
endl
;
HttpClient
client
(
"http://localhost:1025"
);
StubClient
c
(
client
,
JSONRPC_CLIENT_V1
);
cerr
<<
"Client inited"
<<
endl
;
try
{
cout
<<
c
.
generateECDSAKey
(
"test_key"
)
<<
endl
;
}
catch
(
JsonRpcException
&
e
)
{
cerr
<<
e
.
what
()
<<
endl
;
}
/* shared_ptr <std::string> key_ptr = readECDSAKey("test_key");
if (key_ptr == nullptr) cerr<< " key is null" << endl;
else cerr << "key is " << *key_ptr << endl;*/
}
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