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
003b4fca
Unverified
Commit
003b4fca
authored
Jun 07, 2021
by
Oleh Nikolaiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3951 add req methods
parent
877c416a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
174 deletions
+29
-174
BLSSignReqMessage.cpp
zmq_src/BLSSignReqMessage.cpp
+0
-36
BLSSignReqMessage.h
zmq_src/BLSSignReqMessage.h
+0
-38
ECDSASignReqMessage.cpp
zmq_src/ECDSASignReqMessage.cpp
+0
-38
ECDSASignReqMessage.h
zmq_src/ECDSASignReqMessage.h
+0
-40
ZMQClient.cpp
zmq_src/ZMQClient.cpp
+1
-2
ZMQMessage.cpp
zmq_src/ZMQMessage.cpp
+26
-19
ZMQMessage.h
zmq_src/ZMQMessage.h
+2
-1
No files found.
zmq_src/BLSSignReqMessage.cpp
deleted
100644 → 0
View file @
877c416a
/*
Copyright (C) 2018-2019 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 BLSSignReqMessage.cpp
@author Stan Kladko
@date 2021
*/
#include "BLSSignReqMessage.h"
#include "SGXWalletServer.hpp"
Json
::
Value
BLSSignReqMessage
::
process
()
{
auto
keyName
=
getStringRapid
(
"keyShareName"
);
auto
hash
=
getStringRapid
(
"messageHash"
);
auto
t
=
getUint64Rapid
(
"t"
);
auto
n
=
getUint64Rapid
(
"n"
);
auto
result
=
SGXWalletServer
::
blsSignMessageHashImpl
(
keyName
,
hash
,
t
,
n
);
result
[
"type"
]
=
ZMQMessage
::
BLS_SIGN_RSP
;
return
result
;
}
\ No newline at end of file
zmq_src/BLSSignReqMessage.h
deleted
100644 → 0
View file @
877c416a
/*
Copyright (C) 2018-2019 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 BLSReqSignMessage.h
@author Stan Kladko
@date 2020
*/
#ifndef SGXWALLET_BLSSIGNREQMSG_H
#define SGXWALLET_BLSSIGNREQMSG_H
#include "ZMQMessage.h"
class
BLSSignReqMessage
:
public
ZMQMessage
{
public
:
BLSSignReqMessage
(
shared_ptr
<
rapidjson
::
Document
>&
_d
)
:
ZMQMessage
(
_d
)
{};
virtual
Json
::
Value
process
();
};
#endif //SGXWALLET_BLSSIGNREQMSG_H
zmq_src/ECDSASignReqMessage.cpp
deleted
100644 → 0
View file @
877c416a
/*
Copyright (C) 2018-2019 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 ECDSASignReqMessage.cpp
@author Stan Kladko
@date 2020
*/
#include "SGXWalletServer.hpp"
#include "ECDSASignReqMessage.h"
Json
::
Value
ECDSASignReqMessage
::
process
()
{
auto
base
=
getUint64Rapid
(
"base"
);
auto
keyName
=
getStringRapid
(
"keyName"
);
auto
hash
=
getStringRapid
(
"messageHash"
);
auto
result
=
SGXWalletServer
::
ecdsaSignMessageHashImpl
(
base
,
keyName
,
hash
);
result
[
"type"
]
=
ZMQMessage
::
ECDSA_SIGN_RSP
;
return
result
;
}
\ No newline at end of file
zmq_src/ECDSASignReqMessage.h
deleted
100644 → 0
View file @
877c416a
/*
Copyright (C) 2018- 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 ECDSAReqSignMessage.h
@author Stan Kladko
@date 2020
*/
#ifndef SGXWALLET_ECDSASIGNREQMESSAGE_H
#define SGXWALLET_ECDSASIGNREQMESSAGE_H
#include "ZMQMessage.h"
class
ECDSASignReqMessage
:
public
ZMQMessage
{
public
:
ECDSASignReqMessage
(
shared_ptr
<
rapidjson
::
Document
>
&
_d
)
:
ZMQMessage
(
_d
)
{};
virtual
Json
::
Value
process
();
};
#endif //SGXWALLET_ECDSASIGNREQMESSAGE_H
zmq_src/ZMQClient.cpp
View file @
003b4fca
...
...
@@ -33,9 +33,8 @@
#include "sgxwallet_common.h"
#include "common.h"
#include "BLSCrypto.h"
#include "
BLSSign
ReqMessage.h"
#include "ReqMessage.h"
#include "BLSSignRspMessage.h"
#include "ECDSASignReqMessage.h"
#include "ECDSASignRspMessage.h"
#include "ZMQClient.h"
...
...
zmq_src/ZMQMessage.cpp
View file @
003b4fca
...
...
@@ -29,9 +29,8 @@
#include "ZMQClient.h"
#include "SGXWalletServer.hpp"
#include "
BLSSign
ReqMessage.h"
#include "ReqMessage.h"
#include "BLSSignRspMessage.h"
#include "ECDSASignReqMessage.h"
#include "ECDSASignRspMessage.h"
#include "ZMQMessage.h"
...
...
@@ -44,6 +43,14 @@ uint64_t ZMQMessage::getUint64Rapid(const char *_name) {
return
a
.
GetUint64
();
};
Json
::
Value
ZMQMessage
::
getJsonArray
(
const
char
*
_name
)
{
CHECK_STATE
(
_name
);
CHECK_STATE
(
d
->
HasMember
(
_name
));
const
rapidjson
::
Value
&
a
=
(
*
d
)[
_name
];
CHECK_STATE
(
a
.
IsArray
());
return
a
.
GetUint64
();
}
string
ZMQMessage
::
getStringRapid
(
const
char
*
_name
)
{
CHECK_STATE
(
_name
);
CHECK_STATE
(
d
->
HasMember
(
_name
));
...
...
@@ -155,55 +162,55 @@ shared_ptr <ZMQMessage> ZMQMessage::buildRequest(string &_type, shared_ptr <rapi
ret
=
make_shared
<
ECDSASignReqMessage
>
(
_d
);
break
;
case
ENUM_IMPORT_BLS_REQ
:
ret
=
make_shared
<
ECDSASign
ReqMessage
>
(
_d
);
ret
=
make_shared
<
importBLS
ReqMessage
>
(
_d
);
break
;
case
ENUM_IMPORT_ECDSA_REQ
:
ret
=
make_shared
<
ECDSASign
ReqMessage
>
(
_d
);
ret
=
make_shared
<
importECDSA
ReqMessage
>
(
_d
);
break
;
case
ENUM_GENERATE_ECDSA_REQ
:
ret
=
make_shared
<
ECDSASign
ReqMessage
>
(
_d
);
ret
=
make_shared
<
generateECDSA
ReqMessage
>
(
_d
);
break
;
case
ENUM_GET_PUBLIC_ECDSA_REQ
:
ret
=
make_shared
<
ECDSASign
ReqMessage
>
(
_d
);
ret
=
make_shared
<
getPublicECDSA
ReqMessage
>
(
_d
);
break
;
case
ENUM_GENERATE_DKG_POLY_REQ
:
ret
=
make_shared
<
ECDSASign
ReqMessage
>
(
_d
);
ret
=
make_shared
<
generateDKGPoly
ReqMessage
>
(
_d
);
break
;
case
ENUM_GET_VV_REQ
:
ret
=
make_shared
<
ECDSASign
ReqMessage
>
(
_d
);
ret
=
make_shared
<
getVerificationVector
ReqMessage
>
(
_d
);
break
;
case
ENUM_GET_SECRET_SHARE_REQ
:
ret
=
make_shared
<
ECDSASign
ReqMessage
>
(
_d
);
ret
=
make_shared
<
getSecretShare
ReqMessage
>
(
_d
);
break
;
case
ENUM_DKG_VERIFY_REQ
:
ret
=
make_shared
<
ECDSASig
nReqMessage
>
(
_d
);
ret
=
make_shared
<
dkgVerificatio
nReqMessage
>
(
_d
);
break
;
case
ENUM_CREATE_BLS_PRIVATE_REQ
:
ret
=
make_shared
<
ECDSASign
ReqMessage
>
(
_d
);
ret
=
make_shared
<
createBLSPrivateKey
ReqMessage
>
(
_d
);
break
;
case
ENUM_GET_BLS_PUBLIC_REQ
:
ret
=
make_shared
<
ECDSASign
ReqMessage
>
(
_d
);
ret
=
make_shared
<
getBLSPublic
ReqMessage
>
(
_d
);
break
;
case
ENUM_GET_ALL_BLS_PUBLIC_REQ
:
ret
=
make_shared
<
ECDSASign
ReqMessage
>
(
_d
);
ret
=
make_shared
<
getAllBLSPublicKeys
ReqMessage
>
(
_d
);
break
;
case
ENUM_COMPLAINT_RESPONSE_REQ
:
ret
=
make_shared
<
ECDSASign
ReqMessage
>
(
_d
);
ret
=
make_shared
<
complaintResponse
ReqMessage
>
(
_d
);
break
;
case
ENUM_MULT_G2_REQ
:
ret
=
make_shared
<
ECDSASign
ReqMessage
>
(
_d
);
ret
=
make_shared
<
multG2
ReqMessage
>
(
_d
);
break
;
case
ENUM_IS_POLY_EXISTS_REQ
:
ret
=
make_shared
<
ECDSASign
ReqMessage
>
(
_d
);
ret
=
make_shared
<
isPolyExists
ReqMessage
>
(
_d
);
break
;
case
ENUM_GET_SERVER_STATUS_REQ
:
ret
=
make_shared
<
ECDSASign
ReqMessage
>
(
_d
);
ret
=
make_shared
<
getServerStatus
ReqMessage
>
(
_d
);
break
;
case
ENUM_GET_SERVER_VERSION_REQ
:
ret
=
make_shared
<
ECDSASig
nReqMessage
>
(
_d
);
ret
=
make_shared
<
getServerVersio
nReqMessage
>
(
_d
);
break
;
case
ENUM_DELETE_BLS_KEY_REQ
:
ret
=
make_shared
<
ECDSASign
ReqMessage
>
(
_d
);
ret
=
make_shared
<
deleteBLSKey
ReqMessage
>
(
_d
);
break
;
default
:
break
;
...
...
zmq_src/ZMQMessage.h
View file @
003b4fca
...
...
@@ -49,7 +49,6 @@ class ZMQMessage {
shared_ptr
<
rapidjson
::
Document
>
d
;
static
cache
::
lru_cache
<
string
,
pair
<
EVP_PKEY
*
,
X509
*>>
verifiedCerts
;
public
:
...
...
@@ -111,6 +110,8 @@ public:
uint64_t
getUint64Rapid
(
const
char
*
_name
);
Json
::
Value
getJsonArray
(
const
char
*
_name
);
uint64_t
getStatus
()
{
return
getUint64Rapid
(
"status"
);
}
...
...
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