SKALE-4411 check key ownership for getDecryptionShare

parent 6c0b3753
...@@ -237,6 +237,9 @@ Json::Value deleteBLSKeyReqMessage::process() { ...@@ -237,6 +237,9 @@ Json::Value deleteBLSKeyReqMessage::process() {
Json::Value GetDecryptionShareReqMessage::process() { Json::Value GetDecryptionShareReqMessage::process() {
auto blsKeyName = getStringRapid("blsKeyName"); auto blsKeyName = getStringRapid("blsKeyName");
auto publicDecryptionValue = getStringRapid("publicDecryptionValue"); auto publicDecryptionValue = getStringRapid("publicDecryptionValue");
if (checkKeyOwnership && !isKeyByOwner(blsKeyName, getStringRapid("cert"))) {
throw std::invalid_argument("Only owner of the key can access it");
}
auto result = SGXWalletServer::getDecryptionShareImpl(blsKeyName, publicDecryptionValue); auto result = SGXWalletServer::getDecryptionShareImpl(blsKeyName, publicDecryptionValue);
result["type"] = ZMQMessage::GET_DECRYPTION_SHARE_RSP; result["type"] = ZMQMessage::GET_DECRYPTION_SHARE_RSP;
return result; return result;
......
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