diff --git a/dkim/sign.go b/dkim/sign.go index 3d25e14..f056b41 100644 --- a/dkim/sign.go +++ b/dkim/sign.go @@ -260,6 +260,12 @@ func NewSigner(options *SignOptions) (*Signer, error) { } hashed := hasher.Sum(nil) + // Don't pass Hash to Sign for ed25519 as it doesn't support it + // and will return an error ("ed25519: cannot sign hashed message"). + if keyAlgo == "ed25519" { + hash = crypto.Hash(0) + } + sig, err := options.Signer.Sign(randReader, hashed, hash) if err != nil { closeReadWithError(err)