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

denis bider <> Tue, 13 March 2018 09:07 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 5C54F12D7F0 for <>; Tue, 13 Mar 2018 02:07:58 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -1.998
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: (amavisd-new); dkim=pass (2048-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id 88v5X7oGHDjR for <>; Tue, 13 Mar 2018 02:07:56 -0700 (PDT)
Received: from ( [IPv6:2607:f8b0:400d:c0d::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 653D712706D for <>; Tue, 13 Mar 2018 02:07:56 -0700 (PDT)
Received: by with SMTP id a26so3245883qtj.6 for <>; Tue, 13 Mar 2018 02:07:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; 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;; 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 with SMTP id 36mr9017579qth.224.1520932075564; Tue, 13 Mar 2018 02:07:55 -0700 (PDT)
MIME-Version: 1.0
Received: by with HTTP; Tue, 13 Mar 2018 02:07:54 -0700 (PDT)
In-Reply-To: <>
References: <> <> <> <> <> <> <> <> <> <> <> <> <>
From: denis bider <>
Date: Tue, 13 Mar 2018 04:07:54 -0500
Message-ID: <>
To: Peter Gutmann <>
Cc: Ron Frederick <>, "Salz, Rich" <>, "" <>, "Mark D. Baushke" <>
Content-Type: multipart/alternative; boundary="94eb2c0d047c1776c1056747988b"
Archived-At: <>
Subject: Re: [Curdle] Confirming a change to draft-ietf-curdle-rsa-sha2-12
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: "List for discussion of potential new security area wg." <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-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 <>.  Public Key Algorithms

   Signing and verifying using this key format is performed according to
   the RSASSA-PKCS1-v1_5 scheme in [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 <>

> denis bider <> 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.