Sign/verify Message using incorrect keys to sign/verify
vinarmani opened this issue · 1 comments
I have tested this issue using Electron Cash and the bcoin/bcash javascript libraries as reference. Both Electron Cash and bcoin properly sign and verify messages. ElectrumABC does not. I will provide messages, signatures, addresses and public keys to reproduce behavior.
Signed by Electron Cash and bcoin:
msg: cashtab
address:
bitcoincash:qq9a0y2wtqcqu83dhpy8p4n05557u00yscrjpuaf85 / ecash:qq9a0y2wtqcqu83dhpy8p4n05557u00ysc6l4hxnpr / 125cg1ZZm6Pim4FPrsN762H7NW7Cwdvd8T
public key displayed by Electron Cash: 032ab23a5d9f6e53c3972bbd5b45e1a9f6d8c503db5ffcffbe352a71d9068fc1d7
public key recovered by bcoin: 032ab23a5d9f6e53c3972bbd5b45e1a9f6d8c503db5ffcffbe352a71d9068fc1d7
signature:
IGuiW+No+UoD/kyIW8YIsCf4S+7MQKWihCEmfa9DRHsmbzAYEVOuocCC0lrx9GHb6YcRWsKJkcEfLj66ay+edwY=
Verification Result:
Electron Cash: pass
bcoin: pass
Electrum ABC: fail
Signed by Electrum ABC:
msg: cashtab
address:
bitcoincash:qpq0zj7y0d43shc70wjv9rkhdvxnlk7ewgza0d2267 / ecash:qpq0zj7y0d43shc70wjv9rkhdvxnlk7ewgmsmx3suf / 16vPJpG8QS7LBZgzQpbqFYj9RwTAXRyJom
public key displayed by Electrum ABC: 02a01e600984e2fda7e76ccaf59d8372c43741ed9b04aa9df7977ae34486b6cb09
public key recovered by bcoin: 02c04cf7ffb0bcc109aade0861cacd6c1b3ce3adb78e8847961f699478d7006fc9
signature:
H6/MZUiv2OUNhUL3qA08A1j989UHTiPKQkTpLoPxoYItZKT+d46VRq2Bd+oUGNukXmRypNcmbvc7kE6s2umNbno=
Verification Result:
Electron Cash: fail
bcoin: fail
Electrum ABC: pass
If you look at the recovered public key for the signature done by Electrum ABC, you can see that it is not the public key that it is supposed to be. It is however, a vaild signature, that passes in Electron Cash and bcoin for the address associated with that public key ( ecash:qzr7ylkammjkhzacf82fphrx2uhg7myhacylulw7p0 / bitcoincash:qzr7ylkammjkhzacf82fphrx2uhg7myhacajg54y8c / 1DPVZ5xKFAtLuJ5Rghzdc35Qi1Rkzm6Wqr ). Using that different address, along with the msg and signature generated by Electrum ABC will pass verification in both Electron Cash and bcoin.
It appears that there is a bug in the process of selecting and processing the private key for a specified address in Sign/verify Message. The recovered public key / address was not in any of my visible addresses.
This issue is caused by a change in the message signature algorithm, in #130.
It was not a great idea to remove the legacy signature scheme without a warning (other than a release note item). I'm working on supporting both the new eCash signatures and the legacy Bitcoin signatures in the GUI in #174.
It seems to work with your first signature (bcoin & Electron Cash):