keyRequiresOneShotSignature method

bool keyRequiresOneShotSignature(
  1. EvpPkey key
)

Whether key signs the message directly and therefore rejects an external digest (Ed25519, Ed448 and the ML-DSA family).

These keys must go through signOneShot/verifyOneShot; using EVP_DigestSignInit with a digest yields error:1C80007A:Provider routines::invalid digest, which does not say what is actually wrong.

Implementation

bool keyRequiresOneShotSignature(EvpPkey key) {
  final id = bindings.EVP_PKEY_get_base_id(key.handle);
  if (id == NID_ED25519 || id == NID_ED448) return true;

  // ML-DSA ids only exist from OpenSSL 3.5 on; match by name so that older
  // headers do not break the build.
  const mlDsaNames = {'ML-DSA-44', 'ML-DSA-65', 'ML-DSA-87'};
  return mlDsaNames.contains(_keyTypeName(key));
}