verifySignature method

bool verifySignature(
  1. ECPublicKey publicKey,
  2. Uint8List messageBytes,
  3. Uint8List signaturebytes
)

Implementation

bool verifySignature(
  ECPublicKey publicKey, Uint8List messageBytes, Uint8List signaturebytes) {
var verifier = ECDSASigner()
  ..init(
    false,
    PublicKeyParameter(publicKey),
  );
var sequence = ASN1Sequence.fromBytes(signaturebytes);
var r = (sequence.elements![0] as ASN1Integer).integer;
var s = (sequence.elements![1] as ASN1Integer).integer;
var signature = ECSignature(r!, s!);

var verified = verifier.verifySignature(messageBytes, signature);
return verified;
}