Re: [Curdle] draft-ietf-curdle-pkix and endianess of strings

Jeffrey Walton <noloader@gmail.com> Thu, 20 December 2018 00:37 UTC

Return-Path: <noloader@gmail.com>
X-Original-To: curdle@ietfa.amsl.com
Delivered-To: curdle@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0E0F6130DD3; Wed, 19 Dec 2018 16:37:45 -0800 (PST)
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=gmail.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 kLVG8r-dWEw6; Wed, 19 Dec 2018 16:37:43 -0800 (PST)
Received: from mail-it1-x12f.google.com (mail-it1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) (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 29B3412D7EA; Wed, 19 Dec 2018 16:37:43 -0800 (PST)
Received: by mail-it1-x12f.google.com with SMTP id z7so518773iti.0; Wed, 19 Dec 2018 16:37:43 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=nt/QwKrZhLh2M5njZxY2JSGKpcgLMlEnEgBitamDj1I=; b=kw5vaHslb1vBdLrIuq4pl98tOEGOYc9PkuqqS4pZehCHXiPLtpBtSpGSqDEZLUJ7Zd 4lxisHIo7A/QmjEmZ+ukaFq/jZOnjh+FoC4NQZ8BozT/kX53RcLLNne5/EnekvUDYR1S 0xFoJDvpSiYUb63eYB0OzTI+lZ6u2zeUxNcsYqOs4JZEIv9BGcmHJcrfrIVArziVzvGK eDogbQcRAsU56a0NmDF9N4/13iGMbz+VpwSjwcXyFurg5AAURMdDDCL0/40k9Wq4Y8UT jDe4yOmGvqHG2ri2jLIbE/L8iKZI7EjQysrbk/EvCCqTrxtf+bHzI1QLmmQIb2J2fyjX BZCA==
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:reply-to :from:date:message-id:subject:to:cc; bh=nt/QwKrZhLh2M5njZxY2JSGKpcgLMlEnEgBitamDj1I=; b=cNPQdJv87PQFaFN1cHvzP4YCLSptC/augu/RdOT0aRFAkTl/XOXKTkuqt+Sbng14tM IH+Fsp+GAH76FBis8xXNlHqp1AjgT4/c1u8sjAOdZVko2JrnIupKkVwJH+NLv9CROGwj MiqNsYR+Hgv6qBYnZ7XG/beHSC0a+0NH3aPDWZ5w1w5QIjF850vKZH8t1z97yX63+1RV VjQetk1wsHWuqDTYLlriPXG4fyWHUejszxsuy+FAjfjYANItPDrHSOuDff1GhfSGUK9V rltujLhzaBgDJBB8sROYcxRkz2yMjH1VxT4wlLuhSz70uA2mfJfyWbBbRzyfpKdgCAzM aprg==
X-Gm-Message-State: AA+aEWay0Z0a6CLny1J1kAWz9l1w+k6f41PtRtXvgeoTWnMOww84VfJu 5AhhtgXKyF+p24GDe7W9GwVmkQDAcvygwMPRdJg=
X-Google-Smtp-Source: AFSGD/UNcFUmsotCiQr8NZnY2lyJXG7fQNwTATSKYRoEHzHBhdiXORcmt88LBf9ygio6gWa1m+/kORXUkv0XWaCg2SM=
X-Received: by 2002:a24:c8d7:: with SMTP id w206mr8725951itf.56.1545266262390; Wed, 19 Dec 2018 16:37:42 -0800 (PST)
MIME-Version: 1.0
References: <CAH8yC8nHE_MKrv77Zyki+B4vrnB0N2SAp7kqJmcXKALDne9Nsw@mail.gmail.com> <027c01d4970e$cefd4c70$6cf7e550$@augustcellars.com> <CAH8yC8=T+HSDRW1VaYmwUO1un5U5zLSL9vQTucw+t=ZRG9-c9g@mail.gmail.com> <CAH8yC8nLjEez+EX0ex0Lcw4N_dhovuaZzrfALMO-LoQmHCydpg@mail.gmail.com> <028f01d49713$fd6a4540$f83ecfc0$@augustcellars.com> <CAH8yC8mXRYuyj10tiyYRjKWpJAzo2KHErDKcDqNmBoWsCtgVtg@mail.gmail.com> <1545188081299.7191@cs.auckland.ac.nz> <CAH8yC8kQVKxFP6or+B+qKq=RmE2LCSFRDD0zRFS5EFqf2oUXGg@mail.gmail.com> <BF16F7A0-0CA3-4F99-B402-C21947A8F9E0@vigilsec.com> <CAF8qwaC9y16e4yGooXtNfJJ7k5N5=y1rO0-wuP+oo8eQvw7FzQ@mail.gmail.com>
In-Reply-To: <CAF8qwaC9y16e4yGooXtNfJJ7k5N5=y1rO0-wuP+oo8eQvw7FzQ@mail.gmail.com>
Reply-To: noloader@gmail.com
From: Jeffrey Walton <noloader@gmail.com>
Date: Wed, 19 Dec 2018 19:37:28 -0500
Message-ID: <CAH8yC8=F9fwkTrN_tNuPX+qrB4oey66j3P9SUPKdfb5+r=3ZWQ@mail.gmail.com>
To: David Benjamin <davidben@chromium.org>
Cc: curdle <curdle@ietf.org>, IETF SAAG <saag@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/curdle/BAFiQgi5NcBhb9jxjukuH0RI0Is>
Subject: Re: [Curdle] draft-ietf-curdle-pkix and endianess of strings
X-BeenThere: curdle@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "List for discussion of potential new security area wg." <curdle.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/curdle>, <mailto:curdle-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/curdle/>
List-Post: <mailto:curdle@ietf.org>
List-Help: <mailto:curdle-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/curdle>, <mailto:curdle-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 20 Dec 2018 00:37:45 -0000

On Wed, Dec 19, 2018 at 6:03 PM David Benjamin <davidben@chromium.org> wrote:
> ...
> To that end, the quoted text talks about using curve parameters explicitly rather than a non-named curve. RFC 8410 doesn't specify such a thing. I would have made a lot of noise if it had. :-) Which encoding is this referring to?

Thanks David.

I have this test program handy for interop testing. I believe it is
using the EC key format from RFC 5480. This is what everyone has been
using in the void before the latest IETF deliverables.

In the program below the OID is new, but previous to getting Thawte's
OID we used GNU's old OID for curve25519. In between new (Thawte) and
old (GNU) we could use the OID's draft-josefsson-pkix-newcurves. Many
folks have to support 8 or 10 OIDs for the curves.

EC domain parameters (instead of a named curve) was going to be my
next test case to ensure we interop or work as expected.

I guess the point is, just because the latest RFC does not specify it,
it does not mean it is not going to happen. In fact, it has been
happening for years now because of the information void. RFC 5480
(with a mashup of OIDs) was enough to keep us going.

Jeff

$ cat x25519.c
#include <openssl/evp.h>
#include <openssl/pem.h>

int main (int argc, char* argv)
{
    EVP_PKEY *pkey = NULL;
    EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_X25519, NULL);
    EVP_PKEY_keygen_init(pctx);
    EVP_PKEY_keygen(pctx, &pkey);
    EVP_PKEY_CTX_free(pctx);
    PEM_write_PrivateKey(stdout, pkey, NULL, NULL, 0, NULL, NULL);
    return 0;
}

And then compile it. In the example below, OpenSSL was configured with
--prefix=/opt/openssl-1.1.1.

$ gcc -I /opt/openssl-1.1.1/include/ -L /opt/openssl-1.1.1/lib
x25519.c -o x25519.exe -l:libcrypto.a -lpthread -ldl$

And finally:

$ ./x25519.exe
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VuBCIEIMBio4/nGHPiJzCUDifuMl7zg6Me2XlI5jAKCyPRlW5R
-----END PRIVATE KEY-----

$ echo MC4CAQAwBQYDK2VuBCIEIMBio4/nGHPiJzCUDifuMl7zg6Me2XlI5jAKCyPRlW5R
| base64 -d > x25519.bin

$ dumpasn1 x25519.bin
  0  46: SEQUENCE {
  2   1:   INTEGER 0
  5   5:   SEQUENCE {
  7   3:     OBJECT IDENTIFIER curveX25519 (1 3 101 110)
       :     }
 12  34:   OCTET STRING, encapsulates {
 14  32:     OCTET STRING
       :       C0 62 A3 8F E7 18 73 E2 27 30 94 0E 27 EE 32 5E
       :       F3 83 A3 1E D9 79 48 E6 30 0A 0B 23 D1 95 6E 51
       :     }
       :   }

0 warnings, 0 errors.