rsaVerify static method

bool rsaVerify(
  1. RSAPublicKey publicKey,
  2. Uint8List signedData,
  3. Uint8List signature
)

Verifying the given signedData with the given publicKey and the given signature. Will return true if the given signature matches the signedData. algorithm support SHA-256/RSA only

Implementation

static bool rsaVerify(
    RSAPublicKey publicKey, Uint8List signedData, Uint8List signature) {
  const String algorithm = 'SHA-256/RSA';
  final sig = RSASignature(signature);

  final verifier = Signer(algorithm);

  verifier.init(false, PublicKeyParameter<RSAPublicKey>(publicKey));

  try {
    return verifier.verifySignature(signedData, sig);
  } on ArgumentError {
    return false;
  }
}