Unverified Commit f6583f7c authored by kladko's avatar kladko

SKALE-2678-BLS-test-vectors

parent 09e8c990
...@@ -57,7 +57,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -57,7 +57,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SGXWalletServer.hpp" #include "SGXWalletServer.hpp"
#include "catch.hpp" #include "catch.hpp"
#include "stubclient.h"
#include "BLSSigShare.h" #include "BLSSigShare.h"
#include "BLSSigShareSet.h" #include "BLSSigShareSet.h"
#include "BLSPublicKeyShare.h" #include "BLSPublicKeyShare.h"
......
...@@ -23,9 +23,13 @@ ...@@ -23,9 +23,13 @@
#include <jsonrpccpp/client/connectors/httpclient.h> #include <jsonrpccpp/client/connectors/httpclient.h>
#include <sgx_tcrypto.h> #include <sgx_tcrypto.h>
#include "stubclient.h" #include "stubclient.h"
#include <jsonrpccpp/server/connectors/httpserver.h>
#include "abstractstubserver.h"
using namespace std; using namespace std;
using namespace jsonrpc;
class TestUtils { class TestUtils {
......
...@@ -44,6 +44,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -44,6 +44,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "TestUtils.h" #include "TestUtils.h"
#include "testw.h"
#include "sgxwall.h" #include "sgxwall.h"
#include "sgxwallet.h" #include "sgxwallet.h"
...@@ -51,22 +52,22 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -51,22 +52,22 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
void SGXWallet::usage() { void SGXWallet::usage() {
fprintf(stderr, "usage: sgxwallet\n"); cerr << "usage: sgxwallet\n";
exit(1); exit(1);
} }
void SGXWallet::printUsage() { void SGXWallet::printUsage() {
fprintf(stderr, "Available flags:\n"); cerr << "Available flags:\n";
fprintf(stderr, "-c do not verify client certificate\n"); cerr << "-c do not verify client certificate\n";
fprintf(stderr, "-s sign client certificate without human confirmation \n"); cerr << "-s sign client certificate without human confirmation \n";
fprintf(stderr, "-d turn on debug output\n"); cerr << "-d turn on debug output\n";
fprintf(stderr, "-v verbose mode: turn on debug output\n"); cerr << "-v verbose mode: turn on debug output\n";
fprintf(stderr, "-vv detailed verbose mode: turn on debug and trace outputs\n"); cerr << "-vv detailed verbose mode: turn on debug and trace outputs\n";
fprintf(stderr, "-n launch SGXWalletServer using http (not https)\n"); cerr << "-n launch SGXWalletServer using http (not https)\n";
fprintf(stderr, "-b Restore from back up (you will need to enter backup key) \n"); cerr << "-b Restore from back up (you will need to enter backup key) \n";
fprintf(stderr, "-y Do not ask user to acknowledge receipt of backup key \n"); cerr << "-y Do not ask user to acknowledge receipt of backup key \n";
} }
enum log_level {L_TRACE = 0, L_DEBUG = 1, L_INFO = 2,L_WARNING = 3, L_ERROR = 4 }; enum log_level {L_TRACE = 0, L_DEBUG = 1, L_INFO = 2,L_WARNING = 3, L_ERROR = 4 };
...@@ -92,7 +93,7 @@ int main(int argc, char *argv[]) { ...@@ -92,7 +93,7 @@ int main(int argc, char *argv[]) {
exit(1); exit(1);
} }
while ((opt = getopt(argc, argv, "cshd0abyvVn")) != -1) { while ((opt = getopt(argc, argv, "cshd0abyvVnT")) != -1) {
switch (opt) { switch (opt) {
case 'h': case 'h':
SGXWallet::printUsage(); SGXWallet::printUsage();
...@@ -151,7 +152,27 @@ int main(int argc, char *argv[]) { ...@@ -151,7 +152,27 @@ int main(int argc, char *argv[]) {
initAll(enclaveLogLevel, checkClientCertOption, autoSignClientCertOption); initAll(enclaveLogLevel, checkClientCertOption, autoSignClientCertOption);
if (generateTestKeys) { if (generateTestKeys) {
SGXWallet::genTestKeys();
cerr << "Generating test keys ..." << endl;
HttpClient client(RPC_ENDPOINT);
StubClient c(client, JSONRPC_CLIENT_V2);
vector<string> ecdsaKeyNames;
vector<string> blsKeyNames;
int schainID = 1;
int dkgID = 1;
TestUtils::doDKG(c, 4, 1, ecdsaKeyNames, blsKeyNames, schainID, dkgID);
schainID = 2;
dkgID = 2;
TestUtils::doDKG(c, 16, 5, ecdsaKeyNames, blsKeyNames, schainID, dkgID);
cerr << "Successfully completed generating test keys into sgx_data" << endl;
} }
while (true) { while (true) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment