ecVerify static method
Verifying the given signedData with the given publicKey and the given signature.
Will return true if the given signature matches the signedData.
The default algorithm used is SHA-1/ECDSA. All supported algorihms are :
- SHA-1/ECDSA
- SHA-224/ECDSA
- SHA-256/ECDSA
- SHA-384/ECDSA
- SHA-512/ECDSA
- SHA-1/DET-ECDSA
- SHA-224/DET-ECDSA
- SHA-256/DET-ECDSA
- SHA-384/DET-ECDSA
- SHA-512/DET-ECDSA
Implementation
static bool ecVerify(
ECPublicKey publicKey, Uint8List signedData, ECSignature signature,
{String algorithm = 'SHA-1/ECDSA'}) {
final verifier = Signer(algorithm) as ECDSASigner;
verifier.init(false, PublicKeyParameter<ECPublicKey>(publicKey));
try {
return verifier.verifySignature(signedData, signature);
} on ArgumentError {
return false;
}
}