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
e9fb8940
Unverified
Commit
e9fb8940
authored
4 years ago
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3170-backup-key
parent
20466b87
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
Makefile.am
Makefile.am
+1
-1
SEKManager.cpp
SEKManager.cpp
+14
-3
No files found.
Makefile.am
View file @
e9fb8940
...
@@ -104,7 +104,7 @@ sgxwallet_LDADD=-l$(SGX_URTS_LIB) -l$(SGX_UAE_SERVICE_LIB) -LlibBLS/deps/deps_in
...
@@ -104,7 +104,7 @@ sgxwallet_LDADD=-l$(SGX_URTS_LIB) -l$(SGX_UAE_SERVICE_LIB) -LlibBLS/deps/deps_in
-ljsonrpccpp-stub
-ljsonrpccpp-server
-ljsonrpccpp-client
-ljsonrpccpp-common
-ljsoncpp
-lmicrohttpd
\
-ljsonrpccpp-stub
-ljsonrpccpp-server
-ljsonrpccpp-client
-ljsonrpccpp-common
-ljsoncpp
-lmicrohttpd
\
intel-sgx-ssl/Linux/package/lib64/libsgx_usgxssl.a
\
intel-sgx-ssl/Linux/package/lib64/libsgx_usgxssl.a
\
intel-sgx-ssl/Linux/package/lib64/libsgx_tsgxssl_crypto.a
\
intel-sgx-ssl/Linux/package/lib64/libsgx_tsgxssl_crypto.a
\
-lboost_system
-lboost_thread
-lgnutls
-lgcrypt
-lcurl
-lssl
-lcrypto
-lz
-lpthread
-lboost_system
-lboost_thread
-lgnutls
-lgcrypt
-lcurl
-lssl
-lcrypto
-lz
-lpthread
-lstdc
++fs
testw_SOURCES
=
testw.cpp
$(COMMON_SRC)
testw_SOURCES
=
testw.cpp
$(COMMON_SRC)
...
...
This diff is collapsed.
Click to expand it.
SEKManager.cpp
View file @
e9fb8940
...
@@ -39,6 +39,9 @@
...
@@ -39,6 +39,9 @@
using
namespace
std
;
using
namespace
std
;
#define BACKUP_PATH "./sgx_data/backup_key.txt"
bool
case_insensitive_match
(
string
s1
,
string
s2
)
{
bool
case_insensitive_match
(
string
s1
,
string
s2
)
{
//convert s1 and s2 into lower case strings
//convert s1 and s2 into lower case strings
transform
(
s1
.
begin
(),
s1
.
end
(),
s1
.
begin
(),
::
tolower
);
transform
(
s1
.
begin
(),
s1
.
end
(),
s1
.
begin
(),
::
tolower
);
...
@@ -81,7 +84,7 @@ void create_test_key() {
...
@@ -81,7 +84,7 @@ void create_test_key() {
}
}
#include <experimental/filesystem>
bool
check_SEK
(
const
string
&
SEK
)
{
bool
check_SEK
(
const
string
&
SEK
)
{
shared_ptr
<
string
>
test_key_ptr
=
LevelDB
::
getLevelDb
()
->
readString
(
"TEST_KEY"
);
shared_ptr
<
string
>
test_key_ptr
=
LevelDB
::
getLevelDb
()
->
readString
(
"TEST_KEY"
);
...
@@ -156,7 +159,7 @@ void gen_SEK() {
...
@@ -156,7 +159,7 @@ void gen_SEK() {
carray2Hex
(
encr_SEK
.
data
(),
enc_len
,
hexEncrKey
.
data
());
carray2Hex
(
encr_SEK
.
data
(),
enc_len
,
hexEncrKey
.
data
());
ofstream
sek_file
(
"backup_key.txt"
);
ofstream
sek_file
(
BACKUP_PATH
);
sek_file
.
clear
();
sek_file
.
clear
();
sek_file
<<
SEK
;
sek_file
<<
SEK
;
...
@@ -208,6 +211,8 @@ void trustedSetSEK(shared_ptr <string> hex_encr_SEK) {
...
@@ -208,6 +211,8 @@ void trustedSetSEK(shared_ptr <string> hex_encr_SEK) {
}
}
}
}
#include "experimental/filesystem"
void
enter_SEK
()
{
void
enter_SEK
()
{
vector
<
char
>
errMsg
(
1024
,
0
);
vector
<
char
>
errMsg
(
1024
,
0
);
int
err_status
=
0
;
int
err_status
=
0
;
...
@@ -220,7 +225,13 @@ void enter_SEK() {
...
@@ -220,7 +225,13 @@ void enter_SEK() {
exit
(
-
1
);
exit
(
-
1
);
}
}
ifstream
sek_file
(
"sgx_data/backup_key.txt"
);
if
(
!
experimental
::
filesystem
::
is_regular_file
(
BACKUP_PATH
))
{
spdlog
::
error
(
"File does not exist: "
BACKUP_PATH
);
exit
(
-
1
);
}
ifstream
sek_file
(
BACKUP_PATH
);
string
SEK
;
string
SEK
;
sek_file
>>
SEK
;
sek_file
>>
SEK
;
...
...
This diff is collapsed.
Click to expand it.
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