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
f7a7cf4b
Unverified
Commit
f7a7cf4b
authored
Aug 26, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3170-backup-key
parent
e9fb8940
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
SEKManager.cpp
SEKManager.cpp
+9
-11
No files found.
SEKManager.cpp
View file @
f7a7cf4b
...
...
@@ -233,35 +233,33 @@ void enter_SEK() {
ifstream
sek_file
(
BACKUP_PATH
);
string
SEK
;
sek_file
>>
SEK
;
spdlog
::
info
(
"Reading backup key from file ..."
);
cin
>>
SEK
;
while
(
!
checkHex
(
SEK
,
16
)
||
!
check_SEK
(
SEK
))
{
string
sek
((
istreambuf_iterator
<
char
>
(
sek_file
)),
istreambuf_iterator
<
char
>
());
while
(
!
checkHex
(
sek
,
16
)
||
!
check_SEK
(
sek
))
{
spdlog
::
error
(
"Invalid key"
);
throw
SGXException
(
-
1
,
"Invalid key"
);
exit
(
-
1
);
}
spdlog
::
info
(
"Setting backup key ..."
);
status
=
trustedSetSEK_backup
(
eid
,
&
err_status
,
errMsg
.
data
(),
encr_SEK
.
data
(),
&
enc_len
,
SEK
.
c_str
());
status
=
trustedSetSEK_backup
(
eid
,
&
err_status
,
errMsg
.
data
(),
encr_SEK
.
data
(),
&
enc_len
,
sek
.
c_str
());
if
(
status
!=
SGX_SUCCESS
)
{
spdlog
::
error
(
"RPCException thrown with status {}"
,
status
);
throw
SGXException
(
status
,
errMsg
.
data
());
}
if
(
err_status
!=
0
)
{
cerr
<<
"RPCException thrown"
<<
endl
;
throw
SGXException
(
err_status
,
errMsg
.
data
()
);
spdlog
::
error
(
"trustedSetSEK_backup returned err_status {}"
,
err_status
)
;
exit
(
-
1
);
}
vector
<
char
>
hexEncrKey
(
2
*
enc_len
+
1
,
0
);
carray2Hex
(
encr_SEK
.
data
(),
enc_len
,
hexEncrKey
.
data
());
spdlog
::
info
(
"Got sealed storage encryption key."
);
LevelDB
::
getLevelDb
()
->
deleteKey
(
"SEK"
);
...
...
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