ecdsaVerifyDer method

Future<bool> ecdsaVerifyDer({
  1. required String namedCurve,
  2. required String hashAlgorithm,
  3. required Uint8List spkiPublicKey,
  4. required Uint8List data,
  5. required Uint8List derSignature,
})

Implementation

Future<bool> ecdsaVerifyDer({
  required String namedCurve,
  required String hashAlgorithm,
  required Uint8List spkiPublicKey,
  required Uint8List data,
  required Uint8List derSignature,
}) async {
  final firstTry = await _crypto.ecdsaVerify(
    namedCurve: namedCurve,
    hashAlgorithm: hashAlgorithm,
    spkiPublicKey: spkiPublicKey,
    data: data,
    signature: derSignature,
  );
  if (firstTry) return true;
  try {
    final raw = ecdsaDerToRaw(derSignature, namedCurve: namedCurve);
    return _crypto.ecdsaVerify(
      namedCurve: namedCurve,
      hashAlgorithm: hashAlgorithm,
      spkiPublicKey: spkiPublicKey,
      data: data,
      signature: raw,
    );
  } catch (_) {
    return false;
  }
}