trusteddomainproject / OpenDKIM

Other
97 stars 52 forks source link

auto detect SignatureAlgorithm #107

Open andreasschulze opened 4 years ago

andreasschulze commented 4 years ago

when KeyFile point to an RSA key, SignatureAlgorithm must not be set because of the default rsa-sha256. setting only KeyFile to an ED25519 key, a signature fail:

opendkim: 4CXq1m6bJ4z45Vg: SSL error:0607907F:digital envelope routines:EVP_PKEY_get0_RSA:expecting an rsa key
opendkim: 4CXq1m6bJ4z45Vg: dkim_eom(): resource unavailable: EVP_PKEY_get1_RSA() failed

this error goes away if I set SignatureAlgorithm ed25519-sha256.

Wouldn't It would be helpful, if opendkim could detect the SignatureAlgorithm depending on the presented key?

The current code seem to work in the other direction: keytype depends on the selected SignatureAlgorithm. see https://github.com/trusteddomainproject/OpenDKIM/blob/develop/libopendkim/dkim.c#L3839