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
09460501
Unverified
Commit
09460501
authored
Sep 08, 2019
by
kladkogex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding exceptions
parent
9a071923
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
6 deletions
+76
-6
RPCException.h
RPCException.h
+3
-0
SGXWalletServer.cpp
SGXWalletServer.cpp
+73
-6
No files found.
RPCException.h
View file @
09460501
...
...
@@ -10,6 +10,9 @@
#include <exception>
class
RPCException
:
public
std
::
exception
{
public
:
int32_t
status
;
std
::
string
errString
;
...
...
SGXWalletServer.cpp
View file @
09460501
...
...
@@ -18,9 +18,9 @@
#include <stdio.h>
#include "SGXWalletServer.h"
#include "RPCException.h"
#include "LevelDB.h"
#include "SGXWalletServer.h"
...
...
@@ -49,6 +49,17 @@ public:
void
checkKeyShareDoesExist
(
const
string
&
_keyShare
);
void
checkKeyShareDoesNotExist
(
const
string
&
_keyShare
);
void
checkECDSAKeyDoesExist
(
const
string
&
_keyShare
);
void
checkECDSAKeyDoesNotExist
(
const
string
&
_keyShare
);
};
SGXWalletServer
::
SGXWalletServer
(
AbstractServerConnector
&
connector
,
...
...
@@ -102,9 +113,21 @@ int init_server() {
Json
::
Value
SGXWalletServer
::
importBLSKeyShare
(
int
index
,
const
std
::
string
&
keyShare
,
const
std
::
string
&
keyShareName
,
int
n
,
int
t
)
{
Json
::
Value
result
;
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
result
[
"encryptedKeyShare"
]
=
""
;
try
{
checkKeyShareDoesNotExist
(
keyShare
);
}
catch
(
RPCException
&
_e
)
{
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
}
return
result
;
}
Json
::
Value
SGXWalletServer
::
blsSignMessageHash
(
const
std
::
string
&
keyShareName
,
const
std
::
string
&
messageHash
)
{
...
...
@@ -112,6 +135,17 @@ Json::Value SGXWalletServer::blsSignMessageHash(const std::string& keyShareName,
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
result
[
"signatureShare"
]
=
""
;
try
{
checkKeyShareDoesExist
(
keyShareName
);
}
catch
(
RPCException
&
_e
)
{
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
}
return
result
;
}
...
...
@@ -123,20 +157,53 @@ Json::Value SGXWalletServer::importECDSAKey(const std::string& key, const std::s
return
result
;
}
Json
::
Value
SGXWalletServer
::
generateECDSAKey
(
const
std
::
string
&
keyName
)
{
Json
::
Value
SGXWalletServer
::
generateECDSAKey
(
const
std
::
string
&
_keyName
)
{
Json
::
Value
result
;
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
result
[
"encryptedKey"
]
=
""
;
try
{
checkECDSAKeyDoesNotExist
(
_keyName
);
}
catch
(
RPCException
&
_e
)
{
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
}
}
Json
::
Value
SGXWalletServer
::
ecdsaSignMessageHash
(
const
std
::
string
&
keyShareName
,
const
std
::
string
&
messageHash
)
{
Json
::
Value
SGXWalletServer
::
ecdsaSignMessageHash
(
const
std
::
string
&
_
keyShareName
,
const
std
::
string
&
messageHash
)
{
Json
::
Value
result
;
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
result
[
"signature"
]
=
""
;
try
{
checkECDSAKeyDoesExist
(
_keyShareName
);
}
catch
(
RPCException
&
_e
)
{
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
}
return
result
;
}
void
SGXWalletServer
::
checkKeyShareDoesExist
(
const
string
&
_keyShare
)
{
}
void
SGXWalletServer
::
checkKeyShareDoesNotExist
(
const
string
&
_keyShare
)
{
}
void
SGXWalletServer
::
checkECDSAKeyDoesExist
(
const
string
&
_keyShare
)
{
}
void
SGXWalletServer
::
checkECDSAKeyDoesNotExist
(
const
string
&
_keyShare
)
{
}
\ No newline at end of file
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