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
73318e5a
Unverified
Commit
73318e5a
authored
3 years ago
by
Chadwick Strange
Committed by
GitHub
3 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into readme-updates
parents
267f16ab
87f44a17
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
7 deletions
+26
-7
sgxwallet_common.h
sgxwallet_common.h
+2
-0
ReqMessage.cpp
zmq_src/ReqMessage.cpp
+18
-6
RspMessage.h
zmq_src/RspMessage.h
+0
-1
ZMQMessage.cpp
zmq_src/ZMQMessage.cpp
+4
-0
ZMQMessage.h
zmq_src/ZMQMessage.h
+2
-0
No files found.
sgxwallet_common.h
View file @
73318e5a
...
...
@@ -185,6 +185,8 @@ extern bool autoconfirm;
#define CORRUPT_DATABASE -112
#define INVALID_SEK -113
#define INVALID_DECRYPTION_VALUE_FORMAT -114
#define INVALID_KEY_FORMAT -115
#define KEY_ALREADY_REGISTERED -116
#define SGX_ENCLAVE_ERROR -666
...
...
This diff is collapsed.
Click to expand it.
zmq_src/ReqMessage.cpp
View file @
73318e5a
...
...
@@ -32,9 +32,15 @@ Json::Value ECDSASignReqMessage::process() {
auto
base
=
getInt64Rapid
(
"base"
);
auto
keyName
=
getStringRapid
(
"keyName"
);
auto
hash
=
getStringRapid
(
"messageHash"
);
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
keyName
,
getStringRapid
(
"cert"
)))
{
spdlog
::
error
(
"Cert {} try to access key {} which does not belong to it"
,
getStringRapid
(
"cert"
),
keyName
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
if
(
checkKeyOwnership
)
{
if
(
!
isKeyRegistered
(
keyName
))
{
addKeyByOwner
(
keyName
,
getStringRapid
(
"cert"
));
}
else
{
if
(
!
isKeyByOwner
(
keyName
,
getStringRapid
(
"cert"
)))
{
spdlog
::
error
(
"Cert {} try to access key {} which does not belong to it"
,
getStringRapid
(
"cert"
),
keyName
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
}
}
}
auto
result
=
SGXWalletServer
::
ecdsaSignMessageHashImpl
(
base
,
keyName
,
hash
);
result
[
"type"
]
=
ZMQMessage
::
ECDSA_SIGN_RSP
;
...
...
@@ -46,9 +52,15 @@ Json::Value BLSSignReqMessage::process() {
auto
hash
=
getStringRapid
(
"messageHash"
);
auto
t
=
getInt64Rapid
(
"t"
);
auto
n
=
getInt64Rapid
(
"n"
);
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
keyName
,
getStringRapid
(
"cert"
)))
{
spdlog
::
error
(
"Cert {} try to access key {} which does not belong to it"
,
getStringRapid
(
"cert"
),
keyName
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
if
(
checkKeyOwnership
)
{
if
(
!
isKeyRegistered
(
keyName
))
{
addKeyByOwner
(
keyName
,
getStringRapid
(
"cert"
));
}
else
{
if
(
!
isKeyByOwner
(
keyName
,
getStringRapid
(
"cert"
)))
{
spdlog
::
error
(
"Cert {} try to access key {} which does not belong to it"
,
getStringRapid
(
"cert"
),
keyName
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
}
}
}
auto
result
=
SGXWalletServer
::
blsSignMessageHashImpl
(
keyName
,
hash
,
t
,
n
);
result
[
"type"
]
=
ZMQMessage
::
BLS_SIGN_RSP
;
...
...
This diff is collapsed.
Click to expand it.
zmq_src/RspMessage.h
View file @
73318e5a
...
...
@@ -259,5 +259,4 @@ public:
}
};
#endif //SGXWALLET_RSPMESSAGE_H
This diff is collapsed.
Click to expand it.
zmq_src/ZMQMessage.cpp
View file @
73318e5a
...
...
@@ -334,6 +334,10 @@ void ZMQMessage::addKeyByOwner(const string& keyName, const string& cert) {
SGXWalletServer
::
writeDataToDB
(
keyName
+
":OWNER"
,
cert
);
}
bool
ZMQMessage
::
isKeyRegistered
(
const
string
&
keyName
)
{
return
LevelDB
::
getLevelDb
()
->
readString
(
keyName
+
":OWNER"
)
!=
nullptr
;
}
cache
::
lru_cache
<
string
,
pair
<
EVP_PKEY
*
,
X509
*>>
ZMQMessage
::
verifiedCerts
(
256
);
const
std
::
map
<
string
,
int
>
ZMQMessage
::
requests
{
...
...
This diff is collapsed.
Click to expand it.
zmq_src/ZMQMessage.h
View file @
73318e5a
...
...
@@ -57,6 +57,8 @@ protected:
static
void
addKeyByOwner
(
const
string
&
keyName
,
const
string
&
cert
);
static
bool
isKeyRegistered
(
const
std
::
string
&
keyName
);
public
:
static
constexpr
const
char
*
BLS_SIGN_REQ
=
"BLSSignReq"
;
...
...
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