Re: [dmarc-ietf] DKIM

Vsevolod Stakhov <vsevolod@rspamd.com> Wed, 24 April 2019 12:11 UTC

Return-Path: <vsevolod@rspamd.com>
X-Original-To: dmarc@ietfa.amsl.com
Delivered-To: dmarc@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id C1E1C12021F for <dmarc@ietfa.amsl.com>; Wed, 24 Apr 2019 05:11:34 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.001
X-Spam-Level:
X-Spam-Status: No, score=-2.001 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=rspamd.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LcHGWsZILnhD for <dmarc@ietfa.amsl.com>; Wed, 24 Apr 2019 05:11:32 -0700 (PDT)
Received: from mail.highsecure.ru (mail.highsecure.ru [88.99.142.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id CFFC5120047 for <dmarc@ietf.org>; Wed, 24 Apr 2019 05:11:31 -0700 (PDT)
Received: from [192.168.1.185] (cpc92314-cmbg19-2-0-cust390.5-4.cable.virginm.net [82.11.185.135]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vsevolod@highsecure.ru) by mail.highsecure.ru (Postfix) with ESMTPSA id 9CED43000C8; Wed, 24 Apr 2019 14:11:22 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rspamd.com; s=dkim; t=1556107887; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mr5umcSaR2BkgkZyUnlov0ulLyyRmSic023Jby3TzQo=; b=bZgA59VeIW+2UXcGVjHwJ/rHo5oPJ/i81H+KiW5jH/xi7hRBWqbwXV/69dmbv41+81JlSy Jpy/HRSoCpRuQOu4V7s/1CRcWIk0UmMiUgfBP/LSghgrln06HafZ4fqJLL6vYkrQoMHlhM e3PRzzy0M7iBuldgyHCv7PWYem4PW+8=
To: hsantos@isdg.net, dmarc@ietf.org
References: <5CBFC3C6.2000107@isdg.net>
From: Vsevolod Stakhov <vsevolod@rspamd.com>
Openpgp: preference=signencrypt
Message-ID: <5f3c2a68-c562-044b-fa05-4818ecbe2a25@rspamd.com>
Date: Wed, 24 Apr 2019 13:11:17 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.5.3
MIME-Version: 1.0
In-Reply-To: <5CBFC3C6.2000107@isdg.net>
Content-Type: text/plain; charset="utf-8"
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Authentication-Results: mail.highsecure.ru; auth=pass smtp.auth=vsevolod@highsecure.ru smtp.mailfrom=vsevolod@rspamd.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/dmarc/8xttEVcDiPZ9ctgzUB_6hX2Pmuc>
Subject: Re: [dmarc-ietf] DKIM
X-BeenThere: dmarc@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Domain-based Message Authentication, Reporting, and Compliance \(DMARC\)" <dmarc.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/dmarc>, <mailto:dmarc-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/dmarc/>
List-Post: <mailto:dmarc@ietf.org>
List-Help: <mailto:dmarc-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/dmarc>, <mailto:dmarc-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Apr 2019 12:11:35 -0000

On 24/04/2019 03:02, Hector Santos wrote:
> Can anyone provide me some C/C++ or pseudo-code to do DKIM ecdhc
> encryption?... Using OpenSSL API in v1.1 format?
> 
> Thanks
> 
> PS: Not sure where to post this, but it equally applies to OpenSSL at
> GitHub.
> 

Here is my pretty minimalistic (~3k LoC in total) implementation of DKIM
in Rspamd:

https://github.com/rspamd/rspamd/blob/master/src/libserver/dkim.c#L2832

It uses OpenSSL supporting both 1.1+ and previous versions. This
implementation supports both signing, verification, ARC and ed25519 sigs
(via own library but can easily be adopted for libsodium).