Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Unable to verify Signature from signPersonalMessage or signToSignature method #212

Open
WhiteCjy opened this issue Oct 28, 2021 · 1 comment

Comments

@WhiteCjy
Copy link

final private = EthPrivateKey.fromHex(privakey);

final sign =await  private.signPersonalMessage(Uint8List.fromList(utf8.encode(message)));
final signed =await  private.signToSignature(Uint8List.fromList(utf8.encode(message)));

var pubKey=bytesToHex(private.publicKey.getEncoded().toList());

bool isV= isValidSignature(Uint8List.fromList(utf8.encode(message)),signed,hexToBytes(pubKey));
final adds= ecRecover(Uint8List.fromList(utf8.encode(message)), signed);

print("--验证签名--$isV----恢复数据签名帐户---"+bytesToHex(adds));
print("--publicKey--=----"+pubKey);

验证签名 is. false

@ludowkm
Copy link
Contributor

ludowkm commented Nov 3, 2021

hi @WhiteCjy , you can use this one to solve your issue https://pub.dev/packages/eth_sig_util

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants