Re: [netconf] crypto-types fallback strategy

Per Hedeland <per@hedeland.org> Wed, 18 September 2019 21:54 UTC

Return-Path: <per@hedeland.org>
X-Original-To: netconf@ietfa.amsl.com
Delivered-To: netconf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3124D1200FE for <netconf@ietfa.amsl.com>; Wed, 18 Sep 2019 14:54:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.597
X-Spam-Level:
X-Spam-Status: No, score=-2.597 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham 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 BGDx-bdSDmIm for <netconf@ietfa.amsl.com>; Wed, 18 Sep 2019 14:54:49 -0700 (PDT)
Received: from mailout.easydns.com (mailout.easydns.com [64.68.202.10]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 32AB01200F1 for <netconf@ietf.org>; Wed, 18 Sep 2019 14:54:49 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1]) by mailout.easydns.com (Postfix) with ESMTP id 7BA4DA6238; Wed, 18 Sep 2019 21:54:48 +0000 (UTC)
Received: from mailout.easydns.com ([127.0.0.1]) by localhost (emo13-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cFqvgX5f2S9q; Wed, 18 Sep 2019 21:54:48 +0000 (UTC)
Received: from hedeland.org (81-228-157-209-no289.tbcn.telia.com [81.228.157.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailout.easydns.com (Postfix) with ESMTPSA id 248F3A6134; Wed, 18 Sep 2019 21:54:43 +0000 (UTC)
Received: from pluto.hedeland.org (pluto.hedeland.org [10.1.1.5]) by tellus.hedeland.org (8.15.2/8.15.2) with ESMTPS id x8ILsf6g010353 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Wed, 18 Sep 2019 23:54:41 +0200 (CEST) (envelope-from per@hedeland.org)
To: "Schönwälder, Jürgen" <J.Schoenwaelder@jacobs-university.de>
Cc: Martin Bjorklund <mbj@tail-f.com>, "netconf@ietf.org" <netconf@ietf.org>, "rifaat.ietf@gmail.com" <rifaat.ietf@gmail.com>
References: <0100016d44bda220-51590a9a-0a15-4b63-a49d-47efe712e82e-000000@email.amazonses.com> <MN2PR11MB436617082A8308A7A8928DDFB58E0@MN2PR11MB4366.namprd11.prod.outlook.com> <0100016d4553e645-9c5796b8-15da-4a51-b820-5ecef6575eff-000000@email.amazonses.com> <20190918.220638.1382892184185166890.mbj@tail-f.com> <20190918202928.mqxdsuh3by3c4usl@anna.jacobs.jacobs-university.de> <7ec3f404-9070-b0f7-7673-10093437121e@hedeland.org> <20190918211951.eznefdficdfjk6xz@anna.jacobs.jacobs-university.de>
From: Per Hedeland <per@hedeland.org>
Message-ID: <aa7133e9-70f6-d463-61aa-5f81795d44a2@hedeland.org>
Date: Wed, 18 Sep 2019 23:54:41 +0200
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1
MIME-Version: 1.0
In-Reply-To: <20190918211951.eznefdficdfjk6xz@anna.jacobs.jacobs-university.de>
Content-Type: text/plain; charset="windows-1252"; format="flowed"
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/s-UqgOVFPybF67FFNoGRYM0oNpM>
Subject: Re: [netconf] crypto-types fallback strategy
X-BeenThere: netconf@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETCONF WG list <netconf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netconf>, <mailto:netconf-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netconf/>
List-Post: <mailto:netconf@ietf.org>
List-Help: <mailto:netconf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netconf>, <mailto:netconf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 18 Sep 2019 21:54:51 -0000

On 2019-09-18 23:19, Schönwälder, Jürgen wrote:
> On Wed, Sep 18, 2019 at 10:53:09PM +0200, Per Hedeland wrote:
>> On 2019-09-18 22:29, Schönwälder, Jürgen wrote:
>>> On Wed, Sep 18, 2019 at 10:06:38PM +0200, Martin Bjorklund wrote:
>>>> Kent Watsen <kent+ietf@watsen.net> wrote:
>>>>> [moving Russ and Sean to BCC, per Rich's action]
>>>>>
>>>>>
>>>>>
>>>>>> Minor: Does the string in the description above mean ASCII string
>>>>>> or binary string, RFC 4251 seemingly uses both definitions?
>>>>>
>>>>> I don't know, but this is the language found for the "key-data" leaf
>>>>> in RFC 7317 (i.e., we've been living with this definition for awhile)
>>>>
>>>> So the definition is:
>>>>
>>>>                leaf key-data {
>>>>                  type binary;
>>>>                  mandatory true;
>>>>                  description
>>>>                    "The binary public key data for this SSH key, as
>>>>                     specified by RFC 4253, Section 6.6, i.e.:
>>>>
>>>>                       string    certificate or public key format
>>>>                                 identifier
>>>>                       byte[n]   key/certificate data.";
>>>>
>>>> The textual representation of a binary in YANG is base64 encoded.  As
>>>> it happens, this is exactly the same as OpenSSH uses for its keys.  So
>>>> the open ssh key can be copy/pasted into the NC/RC XML/JSON.
>>>>
>>>
>>> My public ssh keys usually start like this:
>>>
>>>     ssh-rsa AAAA...
>>>
>>> Looking at RFC 4251, it seems to me that 'string' is encoded with a
>>> length prefix, followed by n bytes of key data. This means the start
>>> in hex would be something like this:
>>>
>>>     00 00 00 07 73 73 68 2d 72 73 61
>>>
>>> If I base64 encode this, I won't get what I quoted above.
>>
>> Are you sure? I don't have a handy base64 encoder for "space-separated
>> octets represented as hex numbers", but going in the other direction
>> with the initial part of my public ssh key (ssh-rsa), using the Linux
>> 'base64' command and converting the result to "space-separated octets
>> represented as hex numbers" gives:
>>
>> $ echo AAAAB3NzaC1yc2EA | base64 -d | od -t x1
>> 0000000 00 00 00 07 73 73 68 2d 72 73 61 00
>>
>> Seems to agree with what you have.
>>
> 
> Aha. So the 'ssh-rsa ' part in my key file needs to be stripped as it
> is actually redundant (but still its there in my file).

Right, it's in mine too of course - I stripped it without thinking,
but realized after posting that this might be the reason that your
encoding didn't match. (There is also normally a trailing
<user>@<host> after the actual key.)

> In the RFC
> 7317 YANG model, this string seems to go into the 'algorithm'
> leaf. All good and usable.

Yes - and hopefully a server implementing it will reject 'key-data'
input with the leading 'ssh-rsa ' (or any other "key type", which all
seem to include one or more '-') - the '-' is not a valid base64
character (nor is space, but base64 decoders are often "liberal" with
whitespace).

> (I wonder what happens if the two algorithm names do not match, time
>   to run some experiments on my ssh implementation...)

Ditto for a server implementing RFC 7317...

--Per