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
152e6db8
Unverified
Commit
152e6db8
authored
Jul 07, 2021
by
Oleh Nikolaiev
Committed by
GitHub
Jul 07, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #331 from skalenetwork/enhancement/SKALE-2941-interactive-mode
Enhancement/skale 2941 interactive mode
parents
681cbd3b
d876778a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
14 deletions
+4
-14
SEKManager.cpp
SEKManager.cpp
+1
-11
SGXRegistrationServer.cpp
SGXRegistrationServer.cpp
+3
-3
No files found.
SEKManager.cpp
View file @
152e6db8
...
...
@@ -28,7 +28,6 @@
#include "third_party/spdlog/spdlog.h"
#include "sgxwallet_common.h"
#include "common.h"
#include "sgxwallet.h"
...
...
@@ -76,7 +75,6 @@ void create_test_key() {
LevelDB
::
getLevelDb
()
->
writeDataUnique
(
"TEST_KEY"
,
hexEncrKey
.
data
());
}
void
validate_SEK
()
{
shared_ptr
<
string
>
test_key_ptr
=
LevelDB
::
getLevelDb
()
->
readString
(
"TEST_KEY"
);
...
...
@@ -112,7 +110,6 @@ void validate_SEK() {
}
}
shared_ptr
<
vector
<
uint8_t
>>
check_and_set_SEK
(
const
string
&
SEK
)
{
vector
<
char
>
decr_key
(
BUF_LEN
,
0
);
...
...
@@ -131,7 +128,6 @@ shared_ptr <vector<uint8_t>> check_and_set_SEK(const string &SEK) {
SEK
.
c_str
());
}
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
err_status
,
errMsg
.
data
());
encrypted_SEK
->
resize
(
l
);
...
...
@@ -151,7 +147,6 @@ void gen_SEK() {
spdlog
::
info
(
"Generating backup key. Will be stored in backup_key.txt ... "
);
sgx_status_t
status
=
SGX_SUCCESS
;
{
...
...
@@ -160,7 +155,6 @@ void gen_SEK() {
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
err_status
,
errMsg
.
data
());
if
(
strnlen
(
SEK
,
33
)
!=
32
)
{
throw
SGXException
(
-
1
,
"strnlen(SEK,33) != 32"
);
}
...
...
@@ -174,24 +168,21 @@ void gen_SEK() {
sek_file
<<
SEK
;
cout
<<
"ATTENTION! YOUR BACKUP KEY HAS BEEN WRITTEN INTO sgx_data/backup_key.txt
\n
"
<<
"PLEASE COPY IT TO THE SAFE PLACE AND THEN DELETE THE FILE MANUALLY BY RUNNING THE FOLLOWING COMMAND:
\n
"
<<
"apt-get install secure-delete && srm -vz sgx_data/backup_key.txt"
<<
endl
;
if
(
!
autoconfirm
)
{
sleep
(
10
);
string
confirm_str
=
"I confirm"
;
string
buffer
;
do
{
cout
<<
" DO YOU CONFIRM THAT YOU COPIED THE KEY? (if you confirm type - I confirm)"
<<
endl
;
sleep
(
10
);
getline
(
cin
,
buffer
);
}
while
(
case_insensitive_match
(
confirm_str
,
buffer
));
}
LevelDB
::
getLevelDb
()
->
writeDataUnique
(
"SEK"
,
hexEncrKey
.
data
());
create_test_key
();
...
...
@@ -242,7 +233,6 @@ void enter_SEK() {
throw
SGXException
(
CORRUPT_DATABASE
,
"Could not find TEST_KEY in database."
);
}
if
(
!
experimental
::
filesystem
::
is_regular_file
(
BACKUP_PATH
))
{
spdlog
::
error
(
"File does not exist: "
BACKUP_PATH
);
throw
SGXException
(
FILE_NOT_FOUND
,
"File does not exist: "
BACKUP_PATH
);
...
...
SGXRegistrationServer.cpp
View file @
152e6db8
...
...
@@ -97,9 +97,6 @@ Json::Value SGXRegistrationServer::SignCertificate(const string &csr) {
if
(
system
(
genCert
.
c_str
())
==
0
)
{
spdlog
::
info
(
"Client cert "
+
hash
+
" generated"
);
string
db_key
=
"CSR:HASH:"
+
hash
+
"STATUS:"
;
string
status
=
"0"
;
LevelDB
::
getCsrStatusDb
()
->
writeDataUnique
(
db_key
,
status
);
}
else
{
spdlog
::
error
(
"Client cert generation failed: {} "
,
genCert
);
throw
SGXException
(
FAIL_TO_CREATE_CERTIFICATE
,
"CLIENT CERTIFICATE GENERATION FAILED"
);
...
...
@@ -108,6 +105,9 @@ Json::Value SGXRegistrationServer::SignCertificate(const string &csr) {
string
db_key
=
"CSR:HASH:"
+
hash
;
LevelDB
::
getCsrStatusDb
()
->
writeDataUnique
(
db_key
,
csr
);
}
string
db_key
=
"CSR:HASH:"
+
hash
+
"STATUS:"
;
string
status
=
"0"
;
LevelDB
::
getCsrStatusDb
()
->
writeDataUnique
(
db_key
,
status
);
result
[
"result"
]
=
true
;
result
[
"hash"
]
=
hash
;
...
...
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