How does one create a proper signature for a given message using Bitcoin private keys?
I have an input address of
5JeWZ1z6sRcLTJXdQEDdB986E6XfLAkj9CgNE4EHzr5GmjrVFpf
or
6d7f6815bd7927423a728db28c5f4ea4032a81ab8dbca06ec41476508de48a6d
I want to sign message:
test
I convert it to hex:
74657374
I feed it to a signing function of ECDSA library that uses secp256k1, and I get two outputs,
r = D16A44BF1095FB7D517C7C4DD6A51E3EFD29548C5CAD8CA4AB763946D02AE0E8
s = 2AB3E674B788804B87CED50619A1EFA267E17D20C016D0779BC3203D40E8105D
If I marshal it with DER/asn1 as a list of Big Integers, I get a result of:
MEUCIQDRakS/EJX7fVF8fE3WpR4+/SlUjFytjKSrdjlG0Crg6AIgKrPmdLeIgEuHztUGGaHvomfhfSDAFtB3m8MgPUDoEF0=
If I marshal them as a list of byte arrays, I get
MEQEINFqRL8Qlft9UXx8TdalHj79KVSMXK2MpKt2OUbQKuDoBCAqs+Z0t4iAS4fO1QYZoe+iZ+F9IMAW0HebwyA9QOgQXQ==
if I marshal them as one long byte array, I get 0WpEvxCV+31RfHxN1qUePv0pVIxcrYykq3Y5RtAq4Ogqs+Z0t4iAS4fO1QYZoe+iZ+F9IMAW0HebwyA9QOgQXQ==
None of them appear to work as signatures when I try to verify the message signature using tools like http://brainwallet.org/#verify .
How do I properly sign messages using Bitcoin private keys to be compatible with BitcoinQT?
signmessage <bitcoinaddress> <message>
?