Assume a scenario where we want to send digital signatures to a smart contract.
A user will sign a message with his/her private key and use the signature as input when triggering a smart contract.
A function in the smart contract will then use the sender's public key to decrypt the digital signature and compare it a stored value. (For simplicity, assume we are not concerned with replay attacks.)
Is there any way to do this using Solidity? Are there any known libraries that can be used?
There is an
ecrecover function which returns the signing address of a signed message. However, this does not return the message itself.
The only use of this function is to make sure all the message sent are signed by the same sender. This is discussed nicely here: ecrecover from Geth and web3.eth.sign