verifyECDSASignature function

bool verifyECDSASignature(
  1. int keyType,
  2. ECDSAKey publicKey,
  3. ECDSASignature signature,
  4. Uint8List message
)

Verifies ECDSA signature on message with private key matching publicKey.

Implementation

bool verifyECDSASignature(int keyType, ECDSAKey publicKey,
    ECDSASignature signature, Uint8List message) {
  ECDSASigner signer = ECDSASigner(Key.ellipticCurveHash(keyType));
  ECDomainParameters curve = Key.ellipticCurve(keyType);
  signer.init(
      false,
      PublicKeyParameter(
          ECPublicKey(curve.curve.decodePoint(publicKey.q), curve)));
  return signer.verifySignature(message, ECSignature(signature.r, signature.s));
}