# The life-changing magic of DKIM

**URL:** <https://forum.delta.chat/t/the-life-changing-magic-of-dkim/2262>\
**Category:** Uncategorized\
**Created:** [October 8, 2022, 5:05pm UTC](https://forum.delta.chat/t/the-life-changing-magic-of-dkim/2262 "2022-10-08T17:05:23Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sandra](https://forum.delta.chat/user_avatar/forum.delta.chat/sandra/32/1974_2.png) [@Sandra](https://forum.delta.chat/u/Sandra)\
**Post date:** [October 8, 2022, 5:05pm UTC](https://forum.delta.chat/t/the-life-changing-magic-of-dkim/2262/1 "2022-10-08T17:05:23Z")

</div>

IDK if you already do this, but one way to help mitigate the “a MitM messing with the key headers” is if there happens to be DKIM, in which case you can check it 👍🏻

(I guess you can tell that I’m starting to learn a tiny and dangerous amount about email and about security and is being an obnoxious armchair cook but I can’t not send it, juuuuust in case there’s a good idea that you’ve missed.)

---

<div class="post-metadata">

**Author:** ![Simon](https://forum.delta.chat/user_avatar/forum.delta.chat/simon/32/287_2.png) [@Simon](https://forum.delta.chat/u/Simon)\
**Post date:** [October 8, 2022, 8:07pm UTC](https://forum.delta.chat/t/the-life-changing-magic-of-dkim/2262/2 "2022-10-08T20:07:45Z")

</div>

we are already working on it, it’s a problem we identified during our [automated email address porting project](https://delta.chat/en/2022-09-14-aeap), but it is harder than one might think, also because it depends heavily on the providers to implement it (we don’t have the resources to implement it client-side right now and we don’t even know if it’s possible at all client side, because provider could (and do) change their keys regularly).

- [Mitigate From-forgery (impersonation attacks) through DKIM Authentication-Results checking · Issue #3507 · deltachat/deltachat-core-rust · GitHub](https://github.com/deltachat/deltachat-core-rust/issues/3507)
- [Research/Experiment with from-forgery attacks · Issue #3508 · deltachat/deltachat-core-rust · GitHub](https://github.com/deltachat/deltachat-core-rust/issues/3508)
- [[WIP] Check DKIM Authentication-Results by Hocuri · Pull Request #3583 · deltachat/deltachat-core-rust · GitHub](https://github.com/deltachat/deltachat-core-rust/pull/3583)

---

<div class="post-metadata">

**Author:** ![ta.bg](https://forum.delta.chat/user_avatar/forum.delta.chat/ta.bg/32/1623_2.png) [@ta.bg](https://forum.delta.chat/u/ta.bg)\
**Post date:** [November 26, 2022, 10:06am UTC](https://forum.delta.chat/t/the-life-changing-magic-of-dkim/2262/3 "2022-11-26T10:06:41Z")

</div>

I think DKIM is implemented at DNS/SMTP level and there is no need to add something in Delta chat. The message delivery is done by mail servers and they work according to configuration (including DKIM).

---

<div class="post-metadata">

**Author:** ![Sandra](https://forum.delta.chat/user_avatar/forum.delta.chat/sandra/32/1974_2.png) [@Sandra](https://forum.delta.chat/u/Sandra)\
**Post date:** [November 26, 2022, 10:22am UTC](https://forum.delta.chat/t/the-life-changing-magic-of-dkim/2262/4 "2022-11-26T10:22:55Z")

</div>

Someone can MitM between your own server and you, which a Delta Chat–side DKIM-awareness could stop. Not for every message but for situations where they’re like “uh I lost my key this is a new phone please resend”

---

<div class="post-metadata">

**Author:** ![Raiden](https://forum.delta.chat/user_avatar/forum.delta.chat/raiden/32/2544_2.png) [@Raiden](https://forum.delta.chat/u/Raiden)\
**Post date:** [October 4, 2024, 4:25pm UTC](https://forum.delta.chat/t/the-life-changing-magic-of-dkim/2262/6 "2024-10-04T16:25:49Z")

</div>

> [@ell1e](#):
>
> Delta Chat is commonly used with custom e-mail, isn’t it? I assume most custom e-mail servers don’t enforce DKIM, at least not if the _sender_ doesn’t require them to, which may be the case with a lot of senders.

It is best to use DC with a chatmail server. These support DKIM. Many major email providers now do this as well.

---

<div class="post-metadata">

**Author:** ![link2xt](https://forum.delta.chat/letter_avatar_proxy/v4/letter/l/ee7513/32.png) [@link2xt](https://forum.delta.chat/u/link2xt)\
**Post date:** [October 4, 2024, 5:28pm UTC](https://forum.delta.chat/t/the-life-changing-magic-of-dkim/2262/7 "2024-10-04T17:28:50Z")

</div>

Chatmail servers support and require DKIM. See also recent discussion on GitHub:

> <https://github.com/deltachat/chatmail/issues/416>
>
> Messages to nine.testrun.org appear to be rejected even with valid SPF:
> 
> \`\`\`
> …Final-Recipient: rfc822; \[REDACTED@nine.testrun.org\](mailto:REDACTED@nine.testrun.org)
> Original-Recipient: \[rfc822;REDACTED@nine.testrun.org\](mailto:rfc822;REDACTED@nine.testrun.org)
> Action: failed
> Status: 5.7.1
> Remote-MTA: dns; nine.testrun.org
> Diagnostic-Code: smtp; 554 5.7.1 No valid DKIM signature found
> \`\`\`
> 
> This seems like a problem, because from my experience no major provider including even the occasionally picky GMail require DKIM but only \*either\* DKIM or SPF as far as I know. Therefore, people will be unable to use DeltaChat when normally, their e-mail would work fine in that situation. Since SPF seems like it would likely suffice unless there's a man-in-the-middle at the ISP level, at which point PGP seems like the better defense than DKIM, I'm personally also confused why this requirement has much benefit on a technical level (but don't trust me on this, just my two cents).
> 
> \- Operating System (Linux/Mac/Windows/iOS/Android):
> \- Delta Chat Version: Desktop v1.46.8 Core v1.142.12 SQLite 3.45.3 electron 30.3.1 node 20.15.1
> \- Expected behavior: e-mail is accepted when SPF is valid, even when there's no DKIM.
> \- Actual behavior: e-mails are rejected even with valid SPF
> \- Steps to reproduce the problem: use an e-mail server that uses SPF but not DKIM
> \- Screenshots: 
> !\[Screenshot\_20241001\_185610\](https://github.com/user-attachments/assets/45f7a436-f17c-4655-806d-193944c881ed)
> 
> \- Logs:

Delta Chat as an email client does not know anything about DKIM and is not going to check DKIM signatures directly as it requires querying DNS records and we try to avoid any connections other than configured IMAP and SMTP server. DKIM is also not designed for being checked by the client because by the time user comes online DKIM signature of old delivered message may become invalid due to key rotation. RFC 6376 explicitly says that “message archiving is not a design goal”.

Delta Chat however does not depend on the server supporting DKIM. It’s nice to have some authentication for the `From:` field and not allow anyone to put fake messages into your 1:1 chats because this will make the chat unusable, but this is not going to trick you into chatting with someone else, especially if you get a green checkmark on a chat with “setup contact” protocol.

---

<div class="post-metadata">

**Author:** ![ell1e](https://forum.delta.chat/user_avatar/forum.delta.chat/ell1e/32/2308_2.png) [@ell1e](https://forum.delta.chat/u/ell1e)\
**Post date:** [October 7, 2024, 12:37am UTC](https://forum.delta.chat/t/the-life-changing-magic-of-dkim/2262/9 "2024-10-07T00:37:46Z")

</div>

Does Delta Chat check the `Authentication-Results` header of the server and whether that contains an SPF fail or DKIM fail from the SMTP? E.g. it could display a warning if the `Authentication-Results` header doesn’t contain a DKIM pass, or if no DKIM was found at all.

The checkmark verification doesn’t really seem to cover the real world use case of “does this e-mail even come from that account it claims to be from”.

---

<div class="post-metadata">

**Author:** ![link2xt](https://forum.delta.chat/letter_avatar_proxy/v4/letter/l/ee7513/32.png) [@link2xt](https://forum.delta.chat/u/link2xt)\
**Post date:** [October 7, 2024, 1:06am UTC](https://forum.delta.chat/t/the-life-changing-magic-of-dkim/2262/10 "2024-10-07T01:06:31Z")

</div>

We tried to parse `Authentication-Results` in the past, but dropped this idea because it is impossible to know if the server adds `Authentication-Results` or if this header was received together with an incoming message. I think `Authentication-Results` is only useful for passing the results between filters within a single server, e.g. by removing all `Authentication-Results` headers, then adding SPF and DKIM results, then passing them to DMARC filter or something like that.

> [@ell1e](#):
>
> The checkmark verification doesn’t really seem to cover the real world use case of “does this e-mail even come from that account it claims to be from”.

Protecting against `From:` spoofing is what the server should do. If email server does not protect against email address spoofing, the best thing to do is to switch to another server.

---

<div class="post-metadata">

**Author:** ![ell1e](https://forum.delta.chat/user_avatar/forum.delta.chat/ell1e/32/2308_2.png) [@ell1e](https://forum.delta.chat/u/ell1e)\
**Post date:** [October 7, 2024, 1:24am UTC](https://forum.delta.chat/t/the-life-changing-magic-of-dkim/2262/11 "2024-10-07T01:24:44Z")

</div>

Don’t most e-mail servers not protect against that because it breaks mailing lists?

> because it is impossible to know if the server adds `Authentication-Results`

You could make it an option at least, for SMTP servers that always add it.

---

<div class="post-metadata">

**Author:** ![link2xt](https://forum.delta.chat/letter_avatar_proxy/v4/letter/l/ee7513/32.png) [@link2xt](https://forum.delta.chat/u/link2xt)\
**Post date:** [October 7, 2024, 1:58am UTC](https://forum.delta.chat/t/the-life-changing-magic-of-dkim/2262/12 "2024-10-07T01:58:52Z")

</div>

> [@ell1e](#):
>
> Don’t most e-mail servers not protect against that because it breaks mailing lists?

Mailing lists that don’t modify the mails do not break DKIM, so emails authenticate successfully. The other option mailing lists have if they do modify the mails is to rewrite the `From:` header with the mailing list address. In both cases emails will authenticate successfully.

---

<div class="post-metadata">

**Author:** ![link2xt](https://forum.delta.chat/letter_avatar_proxy/v4/letter/l/ee7513/32.png) [@link2xt](https://forum.delta.chat/u/link2xt)\
**Post date:** [October 7, 2024, 3:10am UTC](https://forum.delta.chat/t/the-life-changing-magic-of-dkim/2262/14 "2024-10-07T03:10:23Z")

</div>

If mailing lists don’t rewrite the From: header, they don’t need to add their own DKIM signature. They just need to forward the mail as is, including the original DKIM signature from the sender. If the sender does not sign messages with DKIM, then there is no way to authenticate forwarded message and it should be rejected.

---

<div class="post-metadata">

**Author:** ![ell1e](https://forum.delta.chat/user_avatar/forum.delta.chat/ell1e/32/2308_2.png) [@ell1e](https://forum.delta.chat/u/ell1e)\
**Post date:** [October 7, 2024, 3:16am UTC](https://forum.delta.chat/t/the-life-changing-magic-of-dkim/2262/15 "2024-10-07T03:16:38Z")

</div>

Sadly, this isn’t how mailing lists often behave, so many people will be forced to use hosters allowing invalid DKIM. But there’s usually “Authentication-Results” which Delta Chat could check.

---

<div class="post-metadata">

**Author:** ![ell1e](https://forum.delta.chat/user_avatar/forum.delta.chat/ell1e/32/2308_2.png) [@ell1e](https://forum.delta.chat/u/ell1e)\
**Post date:** [November 1, 2024, 12:03pm UTC](https://forum.delta.chat/t/the-life-changing-magic-of-dkim/2262/16 "2024-11-01T12:03:03Z")

</div>

> > because it is impossible to know if the server adds Authentication-Results
> 
> You could make it an option at least, for SMTP servers that always add it.

Just as an additional note, if you fail on either any “Authentication-Results” header found that isn’t dkim=pass or a missing DKIM signature, I think it would be safe from any outside meddling for most mail servers. And for the remaining ones that never add this header, you wouldn’t degrade security, if I’m not mistaken, since any spoofed e-mail would otherwise have been quietly accepted anyway.

Does that make any sense? Sorry if some of the above is incorrect, I’m not an expert.

---

<div class="post-metadata">

**Author:** ![r10s](https://forum.delta.chat/user_avatar/forum.delta.chat/r10s/32/1513_2.png) [@r10s](https://forum.delta.chat/u/r10s)\
**Post date:** [October 6, 2026, 3:20pm UTC](https://forum.delta.chat/t/the-life-changing-magic-of-dkim/2262/17 "2026-10-06T15:20:39Z")

</div>


