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
60fdc4c9
Unverified
Commit
60fdc4c9
authored
Mar 26, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "SKALE-2341 Added tags for older commits"
This reverts commit
59dc6125
.
parent
845088e7
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
221 additions
and
169 deletions
+221
-169
BLSCrypto.cpp
BLSCrypto.cpp
+10
-7
BLSCrypto.h
BLSCrypto.h
+10
-0
BLSCrypto.hpp
BLSCrypto.hpp
+0
-41
SGXWalletServer.cpp
SGXWalletServer.cpp
+6
-3
SGXWalletServer.hpp
SGXWalletServer.hpp
+1
-3
run_skale_admin_tests.sh
run_skale_admin_tests.sh
+0
-7
testw.cpp
testw.cpp
+194
-108
No files found.
BLSCrypto.cpp
View file @
60fdc4c9
...
...
@@ -47,8 +47,6 @@
#include "SGXWalletServer.h"
#include "BLSCrypto.h"
#include "BLSCrypto.hpp"
#include "ServerInit.h"
#include "RPCException.h"
...
...
@@ -164,11 +162,16 @@ bool sign(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, size_t
if
(
!
hex2carray
(
_hashHex
,
&
binLen
,
hash
->
data
()))
{
throw
RPCException
(
INVALID_HEX
,
"Invalid hash"
);
}
// assert(binLen == hash->size());
auto
keyShare
=
make_shared
<
BLSPrivateKeyShareSGX
>
(
keyStr
,
_t
,
_n
);
//cerr << "keyShare created" << endl;
// {
auto
sigShare
=
keyShare
->
signWithHelperSGX
(
hash
,
_signerIndex
);
// }
auto
sigShareStr
=
sigShare
->
toString
();
...
...
@@ -309,7 +312,7 @@ bool bls_sign(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
}
}
shared_ptr
<
string
>
encryptBLSKeyShare2Hex
(
int
*
errStatus
,
char
*
err_string
,
const
char
*
_key
)
{
char
*
encryptBLSKeyShare2Hex
(
int
*
errStatus
,
char
*
err_string
,
const
char
*
_key
)
{
auto
keyArray
=
make_shared
<
vector
<
char
>>
(
BUF_LEN
,
0
);
auto
encryptedKey
=
make_shared
<
vector
<
uint8_t
>>
(
BUF_LEN
,
0
);
auto
errMsg
=
make_shared
<
vector
<
char
>>
(
BUF_LEN
,
0
);
...
...
@@ -318,7 +321,7 @@ shared_ptr<string> encryptBLSKeyShare2Hex(int *errStatus, char *err_string, cons
unsigned
int
encryptedLen
=
0
;
//status = encrypt_key(eid, errStatus, errMsg, keyArray, encryptedKey, &encryptedLen);
status
=
encrypt_key_aes
(
eid
,
errStatus
,
errMsg
->
data
(),
keyArray
->
data
(),
encryptedKey
->
data
(),
&
encryptedLen
);
spdlog
::
debug
(
"errStatus is {}"
,
*
errStatus
);
...
...
@@ -336,11 +339,11 @@ shared_ptr<string> encryptBLSKeyShare2Hex(int *errStatus, char *err_string, cons
}
vector
<
char
>
result
(
2
*
BUF_LEN
,
0
);
char
*
result
=
(
char
*
)
calloc
(
2
*
BUF_LEN
,
1
);
carray2Hex
(
encryptedKey
->
data
(),
encryptedLen
,
result
.
data
()
);
carray2Hex
(
encryptedKey
->
data
(),
encryptedLen
,
result
);
return
make_shared
<
string
>
(
result
.
data
())
;
return
result
;
}
char
*
decryptBLSKeyShareFromHex
(
int
*
errStatus
,
char
*
errMsg
,
const
char
*
_encryptedKey
)
{
...
...
BLSCrypto.h
View file @
60fdc4c9
...
...
@@ -30,6 +30,12 @@
#define EXTERNC
#endif
//EXTERNC void init_all();
//
//EXTERNC void init_daemon();
//
//EXTERNC void init_enclave();
EXTERNC
bool
bls_sign
(
const
char
*
encryptedKeyHex
,
const
char
*
hashHex
,
size_t
t
,
size_t
n
,
size_t
signerIndex
,
char
*
_sig
);
...
...
@@ -43,4 +49,8 @@ EXTERNC bool hex2carray2(const char * _hex, uint64_t *_bin_len,
char
*
encryptBLSKeyShare2Hex
(
int
*
errStatus
,
char
*
err_string
,
const
char
*
_key
);
char
*
decryptBLSKeyShareFromHex
(
int
*
errStatus
,
char
*
errMsg
,
const
char
*
_encryptedKey
);
#endif //SGXWALLET_BLSCRYPTO_H
BLSCrypto.hpp
deleted
100644 → 0
View file @
845088e7
/*
Copyright (C) 2019-Present SKALE Labs
This file is part of sgxwallet.
sgxwallet is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
sgxwallet is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with sgxwallet. If not, see <https://www.gnu.org/licenses/>.
@file BLSCrypto.hpp
@author Stan Kladko
@date 2019
*/
#ifndef SGXWALLET_BLSCRYPTO_HPP
#define SGXWALLET_BLSCRYPTO_HPP
#ifdef __cplusplus
#define EXTERNC extern "C"
#else
#define EXTERNC
#endif
using
namespace
std
;
shared_ptr
<
string
>
encryptBLSKeyShare2Hex
(
int
*
errStatus
,
char
*
err_string
,
const
char
*
_key
);
char
*
decryptBLSKeyShareFromHex
(
int
*
errStatus
,
char
*
errMsg
,
const
char
*
_encryptedKey
);
#endif //SGXWALLET_BLSCRYPTO_H
SGXWalletServer.cpp
View file @
60fdc4c9
...
...
@@ -164,7 +164,7 @@ SGXWalletServer::importBLSKeyShareImpl(const string &_keyShare, const string &_k
result
[
"errorMessage"
]
=
""
;
result
[
"encryptedKeyShare"
]
=
""
;
shared_ptr
<
string
>
encryptedKeyShareHex
=
nullptr
;
char
*
encryptedKeyShareHex
=
nullptr
;
try
{
...
...
@@ -178,15 +178,18 @@ SGXWalletServer::importBLSKeyShareImpl(const string &_keyShare, const string &_k
throw
RPCException
(
errStatus
,
errMsg
);
}
result
[
"encryptedKeyShare"
]
=
*
encryptedKeyShareHex
;
result
[
"encryptedKeyShare"
]
=
string
(
encryptedKeyShareHex
)
;
writeKeyShare
(
_keyShareName
,
*
encryptedKeyShareHex
,
_index
,
n
,
t
);
writeKeyShare
(
_keyShareName
,
encryptedKeyShareHex
,
_index
,
n
,
t
);
}
catch
(
RPCException
&
_e
)
{
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
}
if
(
encryptedKeyShareHex
!=
nullptr
)
{
free
(
encryptedKeyShareHex
);
}
return
result
;
}
...
...
SGXWalletServer.hpp
View file @
60fdc4c9
...
...
@@ -25,11 +25,9 @@
#define SGXWALLET_SGXWALLETSERVER_HPP
#include <mutex>
#include "abstractstubserver.h"
#include <mutex>
#include "BLSCrypto.hpp"
using
namespace
jsonrpc
;
using
namespace
std
;
...
...
run_skale_admin_tests.sh
deleted
100755 → 0
View file @
845088e7
#!/bin/bash
cd
../skale-admin
source
skale-admin/bin/activate
docker stop
$(
docker ps
-a
-q
)
docker pull skalenetwork/sgxwalletsim:latest
ETH_PRIVATE_KEY
=
3dd85d854e41db7585080dfdb90f88a83f0c70e229c509a4a1da63d0c82d5ad0
MANAGER_BRANCH
=
delegation-fix bash ./scripts/deploy_manager.sh
ETH_PRIVATE_KEY
=
3dd85d854e41db7585080dfdb90f88a83f0c70e229c509a4a1da63d0c82d5ad0
IMA_ENDPOINT
=
http://localhost:1000
SCHAIN_TYPE
=
test2 bash ./scripts/run_tests.sh
testw.cpp
View file @
60fdc4c9
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