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
a86223fe
Unverified
Commit
a86223fe
authored
May 07, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed docs
parent
0e270582
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
16 deletions
+19
-16
SGXRegistrationServer.cpp
SGXRegistrationServer.cpp
+12
-15
SGXRegistrationServer.h
SGXRegistrationServer.h
+7
-1
No files found.
SGXRegistrationServer.cpp
View file @
a86223fe
...
...
@@ -51,8 +51,8 @@ int useHTTPS = -1;
int
encryptKeys
=
-
1
;
int
autoconfirm
=
-
1
;
SGXRegistrationServer
*
registrationS
erver
=
nullptr
;
HttpServer
*
httpServer2
=
nullptr
;
shared_ptr
<
SGXRegistrationServer
>
SGXRegistrationServer
::
s
erver
=
nullptr
;
shared_ptr
<
HttpServer
>
SGXRegistrationServer
::
httpServer
=
nullptr
;
SGXRegistrationServer
::
SGXRegistrationServer
(
AbstractServerConnector
&
connector
,
serverVersion_t
type
,
bool
_autoSign
)
...
...
@@ -60,13 +60,13 @@ SGXRegistrationServer::SGXRegistrationServer(AbstractServerConnector &connector,
Json
::
Value
signCertificateImpl
(
const
string
&
_csr
,
bool
_autoSign
=
false
)
{
spdlog
::
info
(
__FUNCTION__
);
INIT_RESULT
(
result
)
result
[
"result"
]
=
false
;
try
{
spdlog
::
info
(
__FUNCTION__
);
string
status
=
"1"
;
string
hash
=
cryptlite
::
sha256
::
hash_hex
(
_csr
);
...
...
@@ -115,16 +115,15 @@ Json::Value getCertificateImpl(const string &hash) {
string
cert
;
try
{
string
db_key
=
"CSR:HASH:"
+
hash
+
"STATUS:"
;
shared_ptr
<
string
>
status_str_ptr
=
LevelDB
::
getCsrStatusDb
()
->
readString
(
db_key
);
shared_ptr
<
string
>
status_str_ptr
=
LevelDB
::
getCsrStatusDb
()
->
readString
(
db_key
);
if
(
status_str_ptr
==
nullptr
)
{
throw
SGXException
(
KEY_SHARE_DOES_NOT_EXIST
,
"Data with this name does not exist in csr db"
);
}
int
status
=
atoi
(
status_str_ptr
->
c_str
());
if
(
status
==
0
)
{
string
crt_name
=
"cert/"
+
hash
+
".crt"
;
//if (access(crt_name.c_str(), F_OK) == 0){
ifstream
infile
(
crt_name
);
string
crtPath
=
"cert/"
+
hash
+
".crt"
;
ifstream
infile
(
crtPath
);
if
(
!
infile
.
is_open
())
{
string
status_db_key
=
"CSR:HASH:"
+
hash
+
"STATUS:"
;
LevelDB
::
getCsrStatusDb
()
->
deleteKey
(
status_db_key
);
...
...
@@ -170,16 +169,14 @@ Json::Value SGXRegistrationServer::GetCertificate(const string &hash) {
}
int
SGXRegistrationServer
::
initRegistrationServer
(
bool
_autoSign
)
{
httpServer
2
=
new
HttpServer
(
BASE_PORT
+
1
);
registrationServer
=
new
SGXRegistrationServer
(
*
httpServer2
,
JSONRPC_SERVER_V2
,
_autoSign
);
// hybrid server (json-rpc 1.0 & 2.0)
httpServer
=
make_shared
<
HttpServer
>
(
BASE_PORT
+
1
);
server
=
make_shared
<
SGXRegistrationServer
>
(
*
httpServer
,
JSONRPC_SERVER_V2
,
_autoSign
);
// hybrid server (json-rpc 1.0 & 2.0)
if
(
!
registrationS
erver
->
StartListening
())
{
if
(
!
s
erver
->
StartListening
())
{
spdlog
::
info
(
"Registration server could not start listening"
);
exit
(
-
1
);
}
else
{
...
...
SGXRegistrationServer.h
View file @
a86223fe
...
...
@@ -25,9 +25,13 @@
#define SGXD_SGXREGISTRATIONSERVER_H
#include "abstractregserver.h"
#include <mutex>
#include "abstractregserver.h"
#include <jsonrpccpp/server/connectors/httpserver.h>
using
namespace
jsonrpc
;
using
namespace
std
;
...
...
@@ -35,6 +39,8 @@ class SGXRegistrationServer: public AbstractRegServer {
recursive_mutex
m
;
bool
autoSign
;
static
shared_ptr
<
SGXRegistrationServer
>
server
;
static
shared_ptr
<
HttpServer
>
httpServer
;
public
:
...
...
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