public static ECDsaParameters CreateNewECDsaParameters(KeyStrength strength)
    {
        using var provider = ECDsa.Create();
        var curve = ECDsaParameters.ChooseCurve(strength);

        provider.GenerateKey(curve);
        return(new ECDsaParameters(provider.ExportParameters(true), strength, ECDsaParameters.ChooseHashAlgo(curve)));
    }
 private static bool VerifyStream(Stream dataStream, TagSignature signature, ECParameters parameters)
 {
     try {
         if (signature.Required().Algorithm != Algorithm.EcDSA)
         {
             throw new InvalidDataException($"Signature uses different algorithm {signature.Algorithm} from this ECDsa key!");
         }
         if (parameters.D == null)
         {
             throw new InvalidDataException($"This ECDsa key is not properly configured to be able to verify a signature!");
         }
         using var algo = OpenWith(parameters);
         return(algo.VerifyData(dataStream, signature.Data, ECDsaParameters.ChooseHashAlgo(parameters.Curve).ToName()));
     } catch (CryptographicException e) {
         throw new InterlockLedgerCryptographicException("Failed to verify data with current parameters and signature", e);
     }
 }