Re: [openpgp] Deriving an OpenPGP secret key from a human readable seed

Phillip Hallam-Baker <phill@hallambaker.com> Fri, 18 October 2019 13:14 UTC

Return-Path: <hallam@gmail.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 366C0120C72 for <openpgp@ietfa.amsl.com>; Fri, 18 Oct 2019 06:14:23 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.473
X-Spam-Level:
X-Spam-Status: No, score=-1.473 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.172, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
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 ml0VZJ2smIaV for <openpgp@ietfa.amsl.com>; Fri, 18 Oct 2019 06:14:21 -0700 (PDT)
Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (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 A12D9120C7A for <openpgp@ietf.org>; Fri, 18 Oct 2019 06:14:21 -0700 (PDT)
Received: by mail-ot1-f49.google.com with SMTP id y39so4897378ota.7 for <openpgp@ietf.org>; Fri, 18 Oct 2019 06:14:21 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LgEedlI76YayV+L5yD3uXnVYBT+0L4kJm3Dz+QPUju0=; b=Fsz2pxfyVgOdJ+XDl4mVwbD7FGl403K33I6JNTOCHwFfy4iJ3liI0kgN4lzKguZRzD Wzy+q5JmEYPn4q4mBqhn/BGqka7zFigo6W3pk6e1LoEThkmLpC4arbxHRIB6kPs6n769 k4QFM4RuRVulCdtVT6NGcEh8cONgBVhtqJcfFS8tXj26xWjqSL5Us3UkrlUmINUuiJp7 cQoAEBE0lueJtnQSWFNYH/nMutDpL0yTEjntxAmQhuSS67GE4yjFJpFqvUVipiH4pmsQ YkjVf+TBuk6Mf65tLA3LcnnXHi1fgeJ+jpjihb/n61KxHtrZeBi6oRwWmAjGIQNE5Rkx 1FGw==
X-Gm-Message-State: APjAAAU1Js85RU7jvq/G4D2GObvDMu8DOqyYL0NwqZAof5iJ9Nji7m3f Wycu1vxeWcgebrUsEUYJrzoPKi65Beam2eBZ6uSKCAbc
X-Google-Smtp-Source: APXvYqz6ztwgm0bKtf/BSsjIWOx1CmR5BSa7WD2WvZ/diCjBJBsujMonzr15/+JA0amfHwHNXalPfF3bGjYDMSDRTWo=
X-Received: by 2002:a05:6830:22d9:: with SMTP id q25mr7288364otc.87.1571404460846; Fri, 18 Oct 2019 06:14:20 -0700 (PDT)
MIME-Version: 1.0
References: <5eb8774d-8d4f-63e3-29bc-53f3c8d21c51@kuix.de> <8736fs7ao8.fsf@fifthhorseman.net> <22567.1571307200@dooku.sandelman.ca> <87r23b5kvt.fsf@fifthhorseman.net> <12393.1571381652@dooku.sandelman.ca>
In-Reply-To: <12393.1571381652@dooku.sandelman.ca>
From: Phillip Hallam-Baker <phill@hallambaker.com>
Date: Fri, 18 Oct 2019 09:14:09 -0400
Message-ID: <CAMm+Lwhv5KbsURonbW=xsuONhmefwf1TYuOSQdoYZnj+GBBOTg@mail.gmail.com>
To: Michael Richardson <mcr@sandelman.ca>
Cc: Daniel Kahn Gillmor <dkg@fifthhorseman.net>, IETF OpenPGP <openpgp@ietf.org>
Content-Type: multipart/alternative; boundary="000000000000aff2eb05952f1c66"
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/qBqSme3pYOGWEaD2UkPqY_SFvjA>
Subject: Re: [openpgp] Deriving an OpenPGP secret key from a human readable seed
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: Fri, 18 Oct 2019 13:14:23 -0000

On Fri, Oct 18, 2019 at 2:53 AM Michael Richardson <mcr@sandelman.ca> wrote:

>
> Daniel Kahn Gillmor <dkg@fifthhorseman.net> wrote:
>     > yep, that's why i'm trying to help think this through, even though
> i'm
>     > not particularly excited about it. :)
>
>     >> {An interesting (mathematical, density of primes) question would be
>     >> whether one would be able to determine from looking at the public
> key
>     >> whether it was recoverable or not.  That is, can one recognize some
>     >> pattern in the expanded DRBG. It might still be statistically
> secure,
>     >> yet since the amount of entropy in the key is less than the entropy
> in
>     >> the input, it might leave a pattern}
>
>     > Can you give an example of this?  I haven't tried to prove this, but
> i
>     > think if the generated public key (whether a curve25519 point or an
> RSA
>     > modulus) is distinguishable from other public keys, there is a strong
>     > argument to be made that either the DRBG or the secret key derivation
>     > mechanism is deeply flawed.
>
> If I could prove such a thing then I'd have a Fields Medal for having
> discovered something new and interesting about the density of primes :-)
>
> If the input to our KDF is 120 bits and the output is 256 bits,
> then there must be a bunch of numbers that we can't derive from the KDF.
> But, as PHB says, 2^120 is a big enough work factor that it's okay.
> (5bits * 5 groups * 4 characters/group = 120)
>
> For ECDSA, any number will do, AFAIK.
> {When producing numbers RSA, I think we have to start with the random
> number
> and then search deterministically for a suitable prime.  I was more
> thinking
> that this process might leave detectable traces}
>

For RSA-2048, it is arguable that 112 bits are enough as that is the work
factor of the key according to the best known attack.

Reuse of KDF in the generation function was chosen since it is already
examined and widely used so if it is hosed, the system is already
compromised. We are not introducing a new vulnerability.

As for the proof part... When I first started thinking about this, it was
because right now my specifications generate new keypairs every time they
are generated and since parts III and IV try to reference the keys
generated in part I... this is confusing. So I began thinking of this as a
hack. But as I have continued, I have started to think that it is actually
a much better way to generate keys.

A big problem testing cryptographic systems is that any system that has a
hidden secret can use it to conceal a side channel attack. (See Moti Yung's
kleptography schemes.) What I really like about these deterministic schemes
is that they allow the random component of the system to be isolated.