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
0ec388d2
Unverified
Commit
0ec388d2
authored
Jan 26, 2020
by
Stan Kladko
Committed by
GitHub
Jan 26, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #41 from skalenetwork/SKALE-2077-cleanup-sgx
SKALE-2077 Fixed Naming
parents
f20e6a97
0eefcfa3
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
41 additions
and
41 deletions
+41
-41
CSRManagerServer.cpp
CSRManagerServer.cpp
+7
-7
CSRManagerServer.h
CSRManagerServer.h
+2
-2
README.md
README.md
+1
-1
SGXRegistrationServer.cpp
SGXRegistrationServer.cpp
+6
-6
SGXRegistrationServer.h
SGXRegistrationServer.h
+2
-2
abstractCSRManagerServer.h
abstractCSRManagerServer.h
+8
-8
abstractregserver.h
abstractregserver.h
+9
-9
cert_util.cpp
cert_util.cpp
+2
-2
stubclient.h
stubclient.h
+4
-4
No files found.
CSRManagerServer.cpp
View file @
0ec388d2
...
...
@@ -23,8 +23,8 @@ CSRManagerServer::CSRManagerServer(AbstractServerConnector &connector,
serverVersion_t
type
)
:
abstractCSRManagerServer
(
connector
,
type
){}
Json
::
Value
G
etUnsignedCSRsImpl
(){
spdlog
::
info
(
"Enter
G
etUnsignedCSRsImpl"
);
Json
::
Value
g
etUnsignedCSRsImpl
(){
spdlog
::
info
(
"Enter
g
etUnsignedCSRsImpl"
);
Json
::
Value
result
;
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
...
...
@@ -44,7 +44,7 @@ Json::Value GetUnsignedCSRsImpl(){
return
result
;
}
Json
::
Value
S
ignByHashImpl
(
const
string
&
hash
,
int
status
){
Json
::
Value
s
ignByHashImpl
(
const
string
&
hash
,
int
status
){
Json
::
Value
result
;
result
[
"errorMessage"
]
=
""
;
...
...
@@ -101,14 +101,14 @@ Json::Value SignByHashImpl(const string& hash, int status){
}
Json
::
Value
CSRManagerServer
::
G
etUnsignedCSRs
(){
Json
::
Value
CSRManagerServer
::
g
etUnsignedCSRs
(){
lock_guard
<
recursive_mutex
>
lock
(
m
);
return
G
etUnsignedCSRsImpl
();
return
g
etUnsignedCSRsImpl
();
}
Json
::
Value
CSRManagerServer
::
S
ignByHash
(
const
string
&
hash
,
int
status
){
Json
::
Value
CSRManagerServer
::
s
ignByHash
(
const
string
&
hash
,
int
status
){
lock_guard
<
recursive_mutex
>
lock
(
m
);
return
S
ignByHashImpl
(
hash
,
status
);
return
s
ignByHashImpl
(
hash
,
status
);
}
int
init_csrmanager_server
(){
...
...
CSRManagerServer.h
View file @
0ec388d2
...
...
@@ -20,8 +20,8 @@ class CSRManagerServer : public abstractCSRManagerServer {
CSRManagerServer
(
AbstractServerConnector
&
connector
,
serverVersion_t
type
);
virtual
Json
::
Value
G
etUnsignedCSRs
();
virtual
Json
::
Value
S
ignByHash
(
const
std
::
string
&
hash
,
int
status
);
virtual
Json
::
Value
g
etUnsignedCSRs
();
virtual
Json
::
Value
s
ignByHash
(
const
std
::
string
&
hash
,
int
status
);
};
extern
int
init_csrmanager_server
();
...
...
README.md
View file @
0ec388d2
...
...
@@ -319,7 +319,7 @@ Example:
```
bash
export
URL_SGX_WALLET
=
"http://127.0.0.1:1027"
curl
-X
POST
--data
'{ "jsonrpc": "2.0", "id": 2, "method": "
S
ignCertificate", "params": { "certificate": "-----BEGIN CERTIFICATE REQUEST-----\nMIICYjCCAUoCAQAwHTEbMBkGA1UEAwwSc29tZVZlcnlVbmlxdWVOYW1lMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3C4ceRhzMAZnG87PwlkzMROHsm3B\ncPydIeiqs1dieuuvVETJqbXAcOENNsGA+AdXjZwFkDuIS24p2yZ8AwuIMAwdMsGa\n5Hzk0ugOy52iPyGEuooqV94nnL6eWw/zryTvkk7j239wMWn5our5Ia1/CBQlXXo2\n4IWTWfWYOz26SWUh4DuvzMOheMVSxg3KLaxpx7Bq09p32lR9xpl53+HqxSDIMYh9\nC3y3kA6NdkKsGE/Jt4WoZ5S5LlrhYjw+PFTeX2lbGDZpn/sxQIM16Pxo2LCfefIa\nik+aZBEAlpn22ljLZ5sEcVgBmOlL+v3waq9u0AaSYzdGFRA+0ceVwU/QTQIDAQAB\noAAwDQYJKoZIhvcNAQELBQADggEBAJXodL69Q/8zDt24AySXK0ksV3C3l5l10Hno\nfF6zKypsYev33CFbZu6HweSgK2f21+DeI9TsGKJxI7K6MUqyH0pJhwlFSeMB5/qP\nJueqXMuvStZSp0GGTaNy7Al/jzOKYNf0ePsv/Rx8NcOdy7RCZE0gW998B5jKb66x\nPgy6QvD8CkZULiRScYlOC8Ex6nc+1Z54pRC1NFWs/ugGyFgLJHy0J2gNkOv6yfsl\nH3V/ocCYSoF4ToUQAxwx+dcy4PXrL9vKzRNJgWzsI/LzCZkglo8iis9YZQawDOUf\nGmDMDkr0Fx1W1tSEpvkw0flkAXZ8PhIGCC0320jkuPeClt7OWNs=\n-----END CERTIFICATE REQUEST-----\n" } }'
-H
'content-type:application/json;'
$URL_SGX_WALLET
curl
-X
POST
--data
'{ "jsonrpc": "2.0", "id": 2, "method": "
s
ignCertificate", "params": { "certificate": "-----BEGIN CERTIFICATE REQUEST-----\nMIICYjCCAUoCAQAwHTEbMBkGA1UEAwwSc29tZVZlcnlVbmlxdWVOYW1lMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3C4ceRhzMAZnG87PwlkzMROHsm3B\ncPydIeiqs1dieuuvVETJqbXAcOENNsGA+AdXjZwFkDuIS24p2yZ8AwuIMAwdMsGa\n5Hzk0ugOy52iPyGEuooqV94nnL6eWw/zryTvkk7j239wMWn5our5Ia1/CBQlXXo2\n4IWTWfWYOz26SWUh4DuvzMOheMVSxg3KLaxpx7Bq09p32lR9xpl53+HqxSDIMYh9\nC3y3kA6NdkKsGE/Jt4WoZ5S5LlrhYjw+PFTeX2lbGDZpn/sxQIM16Pxo2LCfefIa\nik+aZBEAlpn22ljLZ5sEcVgBmOlL+v3waq9u0AaSYzdGFRA+0ceVwU/QTQIDAQAB\noAAwDQYJKoZIhvcNAQELBQADggEBAJXodL69Q/8zDt24AySXK0ksV3C3l5l10Hno\nfF6zKypsYev33CFbZu6HweSgK2f21+DeI9TsGKJxI7K6MUqyH0pJhwlFSeMB5/qP\nJueqXMuvStZSp0GGTaNy7Al/jzOKYNf0ePsv/Rx8NcOdy7RCZE0gW998B5jKb66x\nPgy6QvD8CkZULiRScYlOC8Ex6nc+1Z54pRC1NFWs/ugGyFgLJHy0J2gNkOv6yfsl\nH3V/ocCYSoF4ToUQAxwx+dcy4PXrL9vKzRNJgWzsI/LzCZkglo8iis9YZQawDOUf\nGmDMDkr0Fx1W1tSEpvkw0flkAXZ8PhIGCC0320jkuPeClt7OWNs=\n-----END CERTIFICATE REQUEST-----\n" } }'
-H
'content-type:application/json;'
$URL_SGX_WALLET
```
...
...
SGXRegistrationServer.cpp
View file @
0ec388d2
...
...
@@ -65,12 +65,12 @@ SGXRegistrationServer::SGXRegistrationServer(AbstractServerConnector &connector,
:
AbstractRegServer
(
connector
,
type
),
is_cert_created
(
false
),
cert_auto_sign
(
auto_sign
)
{}
Json
::
Value
S
ignCertificateImpl
(
const
string
&
csr
,
bool
auto_sign
=
false
){
Json
::
Value
s
ignCertificateImpl
(
const
string
&
csr
,
bool
auto_sign
=
false
){
Json
::
Value
result
;
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
try
{
spdlog
::
info
(
"enter
S
ignCertificateImpl"
);
spdlog
::
info
(
"enter
s
ignCertificateImpl"
);
string
status
=
"1"
;
string
hash
=
cryptlite
::
sha256
::
hash_hex
(
csr
);
...
...
@@ -172,13 +172,13 @@ Json::Value GetSertificateImpl(const string& hash){
}
Json
::
Value
SGXRegistrationServer
::
S
ignCertificate
(
const
string
&
csr
){
spdlog
::
info
(
"Enter
S
ignCertificate "
);
Json
::
Value
SGXRegistrationServer
::
s
ignCertificate
(
const
string
&
csr
){
spdlog
::
info
(
"Enter
s
ignCertificate "
);
lock_guard
<
recursive_mutex
>
lock
(
m
);
return
S
ignCertificateImpl
(
csr
,
cert_auto_sign
);
return
s
ignCertificateImpl
(
csr
,
cert_auto_sign
);
}
Json
::
Value
SGXRegistrationServer
::
G
etCertificate
(
const
string
&
hash
){
Json
::
Value
SGXRegistrationServer
::
g
etCertificate
(
const
string
&
hash
){
lock_guard
<
recursive_mutex
>
lock
(
m
);
return
GetSertificateImpl
(
hash
);
}
...
...
SGXRegistrationServer.h
View file @
0ec388d2
...
...
@@ -44,8 +44,8 @@ public:
void
set_cert_created
(
bool
b
);
virtual
Json
::
Value
S
ignCertificate
(
const
std
::
string
&
csr
);
virtual
Json
::
Value
G
etCertificate
(
const
std
::
string
&
hash
);
virtual
Json
::
Value
s
ignCertificate
(
const
std
::
string
&
csr
);
virtual
Json
::
Value
g
etCertificate
(
const
std
::
string
&
hash
);
};
...
...
abstractCSRManagerServer.h
View file @
0ec388d2
...
...
@@ -12,22 +12,22 @@ class abstractCSRManagerServer : public jsonrpc::AbstractServer<abstractCSRManag
public
:
abstractCSRManagerServer
(
jsonrpc
::
AbstractServerConnector
&
conn
,
jsonrpc
::
serverVersion_t
type
=
jsonrpc
::
JSONRPC_SERVER_V2
)
:
jsonrpc
::
AbstractServer
<
abstractCSRManagerServer
>
(
conn
,
type
)
{
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"
GetUnsignedCSRs"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
NULL
),
&
abstractCSRManagerServer
::
G
etUnsignedCSRsI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"
SignByHash"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"hash"
,
jsonrpc
::
JSON_STRING
,
"status"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
abstractCSRManagerServer
::
S
ignByHashI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"
getUnsignedCSRs"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
NULL
),
&
abstractCSRManagerServer
::
g
etUnsignedCSRsI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"
signByHash"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"hash"
,
jsonrpc
::
JSON_STRING
,
"status"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
abstractCSRManagerServer
::
s
ignByHashI
);
}
inline
virtual
void
G
etUnsignedCSRsI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
inline
virtual
void
g
etUnsignedCSRsI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
{
(
void
)
request
;
response
=
this
->
G
etUnsignedCSRs
();
response
=
this
->
g
etUnsignedCSRs
();
}
inline
virtual
void
S
ignByHashI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
inline
virtual
void
s
ignByHashI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
{
response
=
this
->
S
ignByHash
(
request
[
"hash"
].
asString
(),
request
[
"status"
].
asInt
());
response
=
this
->
s
ignByHash
(
request
[
"hash"
].
asString
(),
request
[
"status"
].
asInt
());
}
virtual
Json
::
Value
G
etUnsignedCSRs
()
=
0
;
virtual
Json
::
Value
S
ignByHash
(
const
std
::
string
&
hash
,
int
status
)
=
0
;
virtual
Json
::
Value
g
etUnsignedCSRs
()
=
0
;
virtual
Json
::
Value
s
ignByHash
(
const
std
::
string
&
hash
,
int
status
)
=
0
;
};
...
...
abstractregserver.h
View file @
0ec388d2
...
...
@@ -32,23 +32,23 @@ class AbstractRegServer : public jsonrpc::AbstractServer<AbstractRegServer>
public
:
AbstractRegServer
(
jsonrpc
::
AbstractServerConnector
&
conn
,
jsonrpc
::
serverVersion_t
type
=
jsonrpc
::
JSONRPC_SERVER_V2
)
:
jsonrpc
::
AbstractServer
<
AbstractRegServer
>
(
conn
,
type
)
{
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"
SignCertificate"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"certificate"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractRegServer
::
S
ignCertificateI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"
GetCertificate"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"hash"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractRegServer
::
G
etCertificateI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"
signCertificate"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"certificate"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractRegServer
::
s
ignCertificateI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"
getCertificate"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"hash"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractRegServer
::
g
etCertificateI
);
}
inline
virtual
void
S
ignCertificateI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
inline
virtual
void
s
ignCertificateI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
{
std
::
cerr
<<
"
S
ignCertificateI in abstr server "
<<
std
::
endl
;
response
=
this
->
S
ignCertificate
(
request
[
"certificate"
].
asString
());
std
::
cerr
<<
"
s
ignCertificateI in abstr server "
<<
std
::
endl
;
response
=
this
->
s
ignCertificate
(
request
[
"certificate"
].
asString
());
}
inline
virtual
void
G
etCertificateI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
inline
virtual
void
g
etCertificateI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
{
response
=
this
->
G
etCertificate
(
request
[
"hash"
].
asString
());
response
=
this
->
g
etCertificate
(
request
[
"hash"
].
asString
());
}
virtual
Json
::
Value
S
ignCertificate
(
const
std
::
string
&
cert
)
=
0
;
virtual
Json
::
Value
G
etCertificate
(
const
std
::
string
&
hash
)
=
0
;
virtual
Json
::
Value
s
ignCertificate
(
const
std
::
string
&
cert
)
=
0
;
virtual
Json
::
Value
g
etCertificate
(
const
std
::
string
&
hash
)
=
0
;
};
...
...
cert_util.cpp
View file @
0ec388d2
...
...
@@ -13,7 +13,7 @@ int print_hashes(){
jsonrpc
::
HttpClient
client
(
"http://localhost:1028"
);
StubClient
c
(
client
,
jsonrpc
::
JSONRPC_CLIENT_V2
);
std
::
cout
<<
"Client inited"
<<
std
::
endl
;
std
::
cout
<<
c
.
G
etUnsignedCSRs
()
<<
std
::
endl
;
std
::
cout
<<
c
.
g
etUnsignedCSRs
()
<<
std
::
endl
;
exit
(
0
);
}
...
...
@@ -21,7 +21,7 @@ void sign_by_hash(std::string & hash, int status){
jsonrpc
::
HttpClient
client
(
"http://localhost:1028"
);
StubClient
c
(
client
,
jsonrpc
::
JSONRPC_CLIENT_V2
);
std
::
cout
<<
"Client inited"
<<
std
::
endl
;
std
::
cout
<<
c
.
S
ignByHash
(
hash
,
status
)
<<
std
::
endl
;
std
::
cout
<<
c
.
s
ignByHash
(
hash
,
status
)
<<
std
::
endl
;
exit
(
0
);
}
...
...
stubclient.h
View file @
0ec388d2
...
...
@@ -223,11 +223,11 @@ class StubClient : public jsonrpc::Client
////CSRManagerServer
Json
::
Value
G
etUnsignedCSRs
()
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
g
etUnsignedCSRs
()
throw
(
jsonrpc
::
JsonRpcException
)
{
Json
::
Value
p
;
p
=
Json
::
nullValue
;
Json
::
Value
result
=
this
->
CallMethod
(
"
G
etUnsignedCSRs"
,
p
);
Json
::
Value
result
=
this
->
CallMethod
(
"
g
etUnsignedCSRs"
,
p
);
if
(
result
.
isObject
())
return
result
;
else
...
...
@@ -236,12 +236,12 @@ class StubClient : public jsonrpc::Client
Json
::
Value
S
ignByHash
(
const
std
::
string
&
hash
,
int
status
)
throw
(
jsonrpc
::
JsonRpcException
)
Json
::
Value
s
ignByHash
(
const
std
::
string
&
hash
,
int
status
)
throw
(
jsonrpc
::
JsonRpcException
)
{
Json
::
Value
p
;
p
[
"hash"
]
=
hash
;
p
[
"status"
]
=
status
;
Json
::
Value
result
=
this
->
CallMethod
(
"
S
ignByHash"
,
p
);
Json
::
Value
result
=
this
->
CallMethod
(
"
s
ignByHash"
,
p
);
if
(
result
.
isObject
())
return
result
;
else
...
...
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