Re: [Curdle] Confirming a change to draft-ietf-curdle-rsa-sha2-12

denis bider <denisbider.ietf@gmail.com> Tue, 13 March 2018 09:07 UTC

Return-Path: <denisbider.ietf@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 5C54F12D7F0 for <curdle@ietfa.amsl.com>; Tue, 13 Mar 2018 02:07:58 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.998
X-Spam-Level:
X-Spam-Status: No, score=-1.998 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, HTML_MESSAGE=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 88v5X7oGHDjR for <curdle@ietfa.amsl.com>; Tue, 13 Mar 2018 02:07:56 -0700 (PDT)
Received: from mail-qt0-x230.google.com (mail-qt0-x230.google.com [IPv6:2607:f8b0:400d:c0d::230]) (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 653D712706D for <curdle@ietf.org>; Tue, 13 Mar 2018 02:07:56 -0700 (PDT)
Received: by mail-qt0-x230.google.com with SMTP id a26so3245883qtj.6 for <curdle@ietf.org>; Tue, 13 Mar 2018 02:07:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ptiSyMzEhGyQb2xYoiLExBzQEVZQHp84+MA4hj+UMHc=; b=P4IzvVtlbgHzId2eQKj92+T/eVZv6ODWU3TX+Wv85dEP2BeavFipPg8ob7Ltsn7Pnq Y3QdkOw7ir7LJWVVCfLH8cE8YpHIepGTpvVgcy+ygr1vWwWYktSn2oKhbqm/E3Tac/u/ BoBgqZCdLXgTx/1w4WCNLRxHW7fygYlAqH+WvIGXibLIwo0iFhxpJ5EyvpfQwmwsiHch JJh8mNkUc6TZQ+jS460Yw1VhfsHFgzG/DQmYulkI+ObaVdPmsrJ7Z6GudMM/9Wi8ccKY Tjji4H7cNDgo4jznP8+wxVQCvOVAwvmrYgvRtTvL++E5Ze0XyuD58wnJtcFkqfZajdhW H9Ew==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ptiSyMzEhGyQb2xYoiLExBzQEVZQHp84+MA4hj+UMHc=; b=bh3YDgoUGH7OnFrme5cALrBQcxUsrVvWonAjm9eVYKUJeJdWhBdRdD+eCuW2U6+7Fj avRpm0dEVZLK9jQl8mgSADDOrrXca6guU/gdo4uzjGp1DkTHZul8Aq9ZxopXgUDkBIwc Yldw7E3WnJPDIXD81wBavsZbIlYqCfsdxmdBwFmZBLclukSyPjTuFbZ/M+91p53LUnHt zqdfx6fSGewTpgfsay9cUPT1T7vhjdU1SeXXgjqedzwIyyg+z/P+dJd4BHnX6IECtKQ1 +TAMddGbuAJurkOV0RzCcQtSIlEXI9zSDklbQZ/3FlpJCoMU+In9RvoCGxVUwHbvhNX/ /Q9A==
X-Gm-Message-State: AElRT7GlMYGaxyL50iaTTROjLKKRhTmNR/t1so1SlBSxwXMHiAj4+6ck B5NqJgaYmC2ck3r/PZ70IT0wRGA/dUKeiLGEBCw=
X-Google-Smtp-Source: AG47ELsmR09mncZ6ImMmpO4+FS3Nz1JSfR5MU4Q2VBpzeXofMYl9g310x4bA9BDZcjdS2nXHuAbvJsLFKDVNL+u7XEw=
X-Received: by 10.237.49.167 with SMTP id 36mr9017579qth.224.1520932075564; Tue, 13 Mar 2018 02:07:55 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.12.225.71 with HTTP; Tue, 13 Mar 2018 02:07:54 -0700 (PDT)
In-Reply-To: <1520930362726.75879@cs.auckland.ac.nz>
References: <4C40F019-21FB-46AC-95D3-CC94BB976AAB@akamai.com> <12087.1520816187@eng-mail01.juniper.net> <CADPMZDCwRN-GHXhAe=-xPFHMnUBN39UWmENGNUeLbFkneEAgcA@mail.gmail.com> <17856.1520829824@eng-mail01.juniper.net> <CADPMZDBnG1hv5D74vLv2bXqxZjceJgHQ9oYrufKHskLdV7nRSQ@mail.gmail.com> <28093.1520848786@eng-mail01.juniper.net> <40465B0B-FED4-4C16-A5C3-7E2C04E1B666@timeheart.net> <CADPMZDDXi_h1uXzWJy37HXMrogQxJ5+Sd-G7ZZzfZJX_s390TA@mail.gmail.com> <1520924499970.11406@cs.auckland.ac.nz> <CADPMZDBF1bZez7aV=rUoUFyW2t_e7jRuKfz1F8P06ajaawpnDQ@mail.gmail.com> <1520927373727.37109@cs.auckland.ac.nz> <CADPMZDBXUjTSDj7V6m0EvAJveEuU_TswPOL0+cuHsQaew9cA6Q@mail.gmail.com> <1520930362726.75879@cs.auckland.ac.nz>
From: denis bider <denisbider.ietf@gmail.com>
Date: Tue, 13 Mar 2018 04:07:54 -0500
Message-ID: <CADPMZDAM-MSZMTHk9j_sqRtC1XJyBMPi7aNZLExqWY2+1ACyFg@mail.gmail.com>
To: Peter Gutmann <pgut001@cs.auckland.ac.nz>
Cc: Ron Frederick <ronf@timeheart.net>, "Salz, Rich" <rsalz@akamai.com>, "curdle@ietf.org" <curdle@ietf.org>, "Mark D. Baushke" <mdb@juniper.net>
Content-Type: multipart/alternative; boundary="94eb2c0d047c1776c1056747988b"
Archived-At: <https://mailarchive.ietf.org/arch/msg/curdle/4ULpWy-WfBTsaSTzWG5d2UNra3Y>
Subject: Re: [Curdle] Confirming a change to draft-ietf-curdle-rsa-sha2-12
X-BeenThere: curdle@ietf.org
X-Mailman-Version: 2.1.22
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: Tue, 13 Mar 2018 09:07:58 -0000

>  Does anything non-ASN.1 do the fixed-length encoding?

Yes, SSH. :)


RFC 4253:

6.6 <https://tools.ietf.org/html/rfc4253#section-6.6>.  Public Key Algorithms


   Signing and verifying using this key format is performed according to
   the RSASSA-PKCS1-v1_5 scheme in [RFC3447
<https://tools.ietf.org/html/rfc3447>] using the SHA-1 hash.

   The resulting signature is encoded as follows:

      string    "ssh-rsa"
      string    rsa_signature_blob

   The value for 'rsa_signature_blob' is encoded as a string containing
   s (which is an integer, without lengths or padding, unsigned, and in
   network byte order).



The problem with this phrasing is that it doesn't say:

encode "S" as specified in RSASSA-PKCS1-v1_5

It instead says:

- "according to the RSASSA-PKCS1-v1_5 scheme" (which produces "S" as output)

- "a string containing s (which is an integer, without lengths or padding,
unsigned, and in network byte order)"


... which sure seems to be strongly hinting that we're encoding "S", but it
is *just* shy of saying that. It specifies the exact same encoding as "S" -
but it does not say what to do with the occasional naturally occurring
leading 0.

Because of this ambiguity, the spec for "rsa-sha2-256" and "rsa-sha2-512" -
which is the subject of present discussion - comes out and says explicitly:
though shalt encode "S". Which is fixed-length.

It has been like that since the first version if the draft, in November
2015, which you reviewed. :)




On Tue, Mar 13, 2018 at 3:39 AM, Peter Gutmann <pgut001@cs.auckland.ac.nz>
wrote:

> denis bider <denisbider.ietf@gmail.com> writes:
>
> >S is fixed size. It is exactly the size of the modulus.
>
> Ah, I'd never noticed that (the original PKCS #1 hides that detail a lot
> better).  However for the most common use, certificates and similar, this
> would conflict with the ASN.1 DER requirements, which trump the PKCS #1
> ones.
>
> Does anything non-ASN.1 do the fixed-length encoding?  My test code
> includes
> special-case tests for RSA data blocks shorter than the modulus to make
> sure
> it can handle these cases, I know that there are at least some
> implementations
> out there that do this because when I accidentally broke the
> variable-length
> handling I got complaints and included the self-test checks to make sure it
> wouldn't happen again.
>
> Peter.