SKALE-4411 add format check

parent baac2f5f
......@@ -994,6 +994,10 @@ Json::Value SGXWalletServer::getDecryptionShareImpl(const std::string& blsKeyNam
throw SGXException(BLS_SIGN_INVALID_KS_NAME, string(__FUNCTION__) + ":Invalid BLSKey name");
}
if ( publicDecryptionValue.length() < 7 || publicDecryptionValue.length() > 78 * 4 ) {
throw SGXException(INVALID_DECRYPTION_VALUE_FORMAT, string(__FUNCTION__) + ":Invalid publicDecryptionValue format");
}
shared_ptr<string> encryptedKeyHex_ptr = readFromDb(blsKeyName);
vector<string> decryptionValueVector = calculateDecryptionShare(encryptedKeyHex_ptr->c_str(), publicDecryptionValue);
......
......@@ -111,12 +111,12 @@ std::string ConvertG2ElementToString(const libff::alt_bn128_G2 &elem, int base =
return result;
}
std::vector <libff::alt_bn128_Fq> SplitStringToFq(const char *coeffs, const char symbol) {
std::vector <libff::alt_bn128_Fq> SplitStringToFq(const char *coords, const char symbol) {
std::vector <libff::alt_bn128_Fq > result;
std::string str(coeffs);
std::string str(coords);
std::string delim;
CHECK_ARG_CLEAN(coeffs);
CHECK_ARG_CLEAN(coords);
try {
......
......@@ -184,6 +184,7 @@ extern bool autoconfirm;
#define SGX_SERVER_FAILED_TO_START -111
#define CORRUPT_DATABASE -112
#define INVALID_SEK -113
#define INVALID_DECRYPTION_VALUE_FORMAT -114
#define SGX_ENCLAVE_ERROR -666
......
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