Maybe it's a dumb question, but I can't find the function to sign a text message itself.
In key.h, two sign function defined:
bool Sign(uint256 hash, std::vector<unsigned char>& vchSig);
bool SignCompact(uint256 hash, std::vector<unsigned char>& vchSig);
but both work on the hash of the message.
This is how the system works:
text message->hash->(sign)->signature
now both text message and signature are sent to destination, and signature->hash then compared to text message->hash to determine if the message is altered or not.
But I want to do this:
text message->(sign with private key)->(signed message broadcast)->(at destination)->sign with public key to get message.
Is there a function available in bitcoin for this purpose?