Skip to content

libopendkim: accept UTF-8 in header bodies and DKIM-Signature i= values (RFC 8616)#404

Merged
thegushi merged 6 commits into
trusteddomainproject:developfrom
thegushi:eai-utf8-header-support
Jun 6, 2026
Merged

libopendkim: accept UTF-8 in header bodies and DKIM-Signature i= values (RFC 8616)#404
thegushi merged 6 commits into
trusteddomainproject:developfrom
thegushi:eai-utf8-header-support

Conversation

@thegushi

@thegushi thegushi commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • dkim_header() rejected any byte > 0x7E in a header field body, making it impossible to sign or verify EAI messages (RFC 6532) whose headers contain UTF-8. Relax the check to allow high bytes; canonicalization already handles non-ASCII octets correctly.
  • dkim_process_set() unconditionally rejected non-ASCII bytes, causing a DKIM-Signature with a UTF-8 local-part in i= (permitted by RFC 8616 section 4) to be treated as malformed. Restrict the non-ASCII rejection to tag-name context (states 0-1); allow high bytes through in value context (states 2-3).
  • Add t-test209 and t-test210 to exercise both changes at the library level.

No new dependencies. d= values remain ASCII (A-label), as required by RFC 6376. This change covers the signing/verification path for EAI mail; U-label-to-A-label translation in configuration is out of scope and would require libidn2.

Test plan

  • t-test209 passes: dkim_header() returns DKIM_STAT_OK for a UTF-8 Subject: header
  • t-test210 passes: dkim_eoh() returns DKIM_STAT_OK for a DKIM-Signature with a UTF-8 i= local-part (signature parsed rather than discarded)
  • Full make check passes on Linux CI
  • Full make check passes on FreeBSD (quark)

thegushi added 6 commits June 4, 2026 14:12
…= values (RFC 8616)

dkim_header() rejected any byte > 0x7E in a header field body, making it
impossible to sign or verify EAI messages (RFC 6532) whose headers contain
UTF-8.  Relax the check to allow high bytes; canonicalization already handles
non-ASCII octets correctly.

dkim_process_set() unconditionally rejected non-ASCII bytes, causing a valid
DKIM-Signature with a UTF-8 local-part in i= (permitted by RFC 8616 section 4)
to be treated as malformed.  Restrict the non-ASCII rejection to tag-name
context (states 0-1); allow high bytes through in value context (states 2-3).

Add t-test209 and t-test210 to exercise both changes at the library level.
A U-label domain in SigningTable, KeyTable, or Domain will silently
fail to produce a signature: the SigningTable ASCIIONLY flag returns
not-found without any log output, and DNS lookups for a U-label domain
in KeyTable will fail.  Emit a LOG_WARNING at the two query sites so
operators see actionable guidance rather than unexplained missing
signatures.
@thegushi thegushi merged commit 3191478 into trusteddomainproject:develop Jun 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant