Re: [openpgp] [PATCH] Updated S2K

Nils Durner <ndurner@googlemail.com> Tue, 09 April 2019 19:27 UTC

Return-Path: <ndurner@googlemail.com>
X-Original-To: openpgp@ietfa.amsl.com
Delivered-To: openpgp@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id A57C312089D for <openpgp@ietfa.amsl.com>; Tue, 9 Apr 2019 12:27:49 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.999
X-Spam-Level:
X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=googlemail.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 2IZaeyoC9Vtg for <openpgp@ietfa.amsl.com>; Tue, 9 Apr 2019 12:27:46 -0700 (PDT)
Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id CC02412040F for <openpgp@ietf.org>; Tue, 9 Apr 2019 12:27:45 -0700 (PDT)
Received: by mail-wr1-x42c.google.com with SMTP id y13so38544wrd.3 for <openpgp@ietf.org>; Tue, 09 Apr 2019 12:27:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:date:references :to:in-reply-to:message-id; bh=u0GxSI//ZzVQKyJ+oosyhZh2PvOlx5MmpgUaXVAqvzw=; b=b2FPcOXosWfdGBH9gRdE9mSld2gCwu8zAxp9J0QQR22cA3rQnYORE+PUrJ5XtTOuKw EnZ3vnrepfwePIe3T/7XEKjOE9ww1fKHpiy7UYep1FVGFy/75hzgxOtY+MwPUUSNfCAZ ehWgPZioRqZ3L9arI2qsbRKt9fRkg9bElTNdNe1+qde3Cd7wjMKeARzHy80b8YONWiqc ZrasPF6sVtCCrT/Jp/2tMFNtqtUrrQszxsZYKnEqJX/6NM7vFdQWR+6NtTvWkd5DxCkM GINVdAalMKCTWPPyTH6s2SsBakiLDkkKpRA7PeChcX3wn9MchQezjA2gfq22Mn18sEM1 OLdQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:date:references:to:in-reply-to:message-id; bh=u0GxSI//ZzVQKyJ+oosyhZh2PvOlx5MmpgUaXVAqvzw=; b=R2073PU9JkftyFP3Uq0Adz0+lRvzLmnekv+XYUJ/QWuQybH/Z/K/PyXC3ImR62h1pm hKmGNGLNMKJfF02n36KAtznSAqglJu1ej69ZvUcbJ+sENAfUnY88LggxjpVv42GLAjiP Mtdmw+GMHLOWVq2+bHUoqOv4pRFgI1MN+qTQvayke1kJMnhyCqv/jhFLR75Li4U/epBq SVpclMHujqtOit1I5YlHOHFXshr8k8PDb5Wg0Ebon5QbuSgZMy3vE6F/ft0FZE/STr5r xxpURryEL67r1+vdsrgZR1PBGl+yQr7HQKP369M7Fp3enG3KoXXuMDmFu1bpNT+VyjVL PR4g==
X-Gm-Message-State: APjAAAX9WsKQXut6ZX4283yHNrAHb1EjkRgi2Yk68taopJdQyxJXcjxC rhPmcRPb/9Zwzhzham/rmIsSJN+P9OU=
X-Google-Smtp-Source: APXvYqwcbcaKUPEGebLclLZ+Lhq1uH82Q2UpOrPP+JfI9q2QG30mlcrfo6zx84I9coF7hP3S7IFpew==
X-Received: by 2002:adf:ff88:: with SMTP id j8mr24135404wrr.1.1554838063628; Tue, 09 Apr 2019 12:27:43 -0700 (PDT)
Received: from nilss-mini-2.fritz.box (x4db6b1cd.dyn.telefonica.de. [77.182.177.205]) by smtp.googlemail.com with ESMTPSA id d3sm36410875wmf.46.2019.04.09.12.27.42 for <openpgp@ietf.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 12:27:42 -0700 (PDT)
From: Nils Durner <ndurner@googlemail.com>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\))
Date: Tue, 09 Apr 2019 21:27:41 +0200
References: <CAOyHO0zz3PdWpsX=7mcT370WSmR_Cn7Er19zQ8P056XFa-3y9Q@mail.gmail.com> <875zrnn23u.fsf@wheatstone.g10code.de>
To: openpgp@ietf.org
In-Reply-To: <875zrnn23u.fsf@wheatstone.g10code.de>
Message-Id: <4A046D7E-5E5D-4817-8AEB-C70FE01B37D8@googlemail.com>
X-Mailer: Apple Mail (2.3445.104.8)
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/Q7jyP9KCmLIc61hNr3G6da4l4Us>
Subject: Re: [openpgp] [PATCH] Updated S2K
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Ongoing discussion of OpenPGP issues." <openpgp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/openpgp>, <mailto:openpgp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/openpgp/>
List-Post: <mailto:openpgp@ietf.org>
List-Help: <mailto:openpgp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/openpgp>, <mailto:openpgp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 09 Apr 2019 19:27:55 -0000

Werner Koch <wk@gnupg.org> writes:

> Right now
> the secure choice you have is to use a full-entropy passphrase and store
> it in a separate symmetric key database.

I agree that this may be the most secure option if it suits your use cases, bank account and exists.

Anecdotally, I personally like to keep keys in my head - and distribute them orally face-to-face, if I need. My use cases include backups (kept on other people’s servers (aka Cloud) and in other people’s homes), proof of prior art (drafts passed on to a lawyer, non-digitally timestamped) and ad-hoc data exchange (data stored on other people’s servers or removable media, key passed on orally and most of the time without even spelling it out). Far more often than I like, this is accomplished with encrypted ZIP files, something I would like to see improved as I believe the ZIP key derivation function is not remotely up to par with the craft & science practiced at PHC. I do not see how storing a full-entropy passphrase in a database for use with an OpenPGP implementation would help with this in a way that would justify its operational and monetary cost.


> I doubt that a Argon2i is in any way helpful here
> because it convoys the message that a low-entropy passphrase along with
> a resource hungry KDF is an alternative for a secure passphrase.

I’ll be happy to extend my patch in way to make this clear(er), recommending that the UI/UX reinforces the notion of strong passwords/-phrases, best to be chosen completely at random.


>> -Implementations SHOULD use salted or iterated-and-salted S2K
>> -specifiers, as simple S2K specifiers are more vulnerable to dictionary
>> -attacks.
>> +Implementations MUST generate S2K specifiers that include salts
>> +(either type 1, 3 or 4), as simple S2K specifiers are more vulnerable to
> 
> The SHOULD is there for a reason: Taking a full-entropy passphrase out
> of a database does not require any salt.  It even demands the fastest
> KDF we can provide.  This has been discussed in the past.

Right, my mistake then. But what’s the sense in hashing it prior to using it as per Type 0 either? I’m currently more inclined to establish another type „5“ to make raw key use explicit, as Peter Gutmann suggested in 2015.

Any other considerations/opinions/… from others?

> 
>> +      <reference anchor='Argon2i'
>> +     target='https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-argon2-04'>
> 
> This is not a useful reference:
> 
>   It is inappropriate to use Internet-Drafts as reference
>   material or to cite them other than as "work in progress.

What do you suggest? Revert back to:
      <reference anchor='Argon2i'
     target='https://www.cryptolux.org/images/0/0d/Argon2.pdf'>
        <front>
        <title>Argon2: the memory-hard function for password hashing and other applications</title>
        <author surname="Biryukov" initials="A." />
        <author surname="Dinu" initials="D." />
        <author surname="Khovratovich" initials="D." />
        <date year='2015' month='October'/>
        </front>
      </reference>
?


Best regards,

Nils