Re: [netconf] crypto-types fallback strategy

Kent Watsen <kent+ietf@watsen.net> Thu, 12 September 2019 16:39 UTC

Return-Path: <0100016d265824b0-313d5248-5aba-4b96-8f21-768be7784568-000000@amazonses.watsen.net>
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 28FD3120142 for <netconf@ietfa.amsl.com>; Thu, 12 Sep 2019 09:39:38 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.896
X-Spam-Level:
X-Spam-Status: No, score=-1.896 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=amazonses.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 6KU4r-NLOJ7I for <netconf@ietfa.amsl.com>; Thu, 12 Sep 2019 09:39:35 -0700 (PDT)
Received: from a8-64.smtp-out.amazonses.com (a8-64.smtp-out.amazonses.com [54.240.8.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5541F120130 for <netconf@ietf.org>; Thu, 12 Sep 2019 09:39:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1568306374; h=From:Message-Id:Content-Type:Mime-Version:Subject:Date:In-Reply-To:Cc:To:References:Feedback-ID; bh=DlbB+R9lHY/byKvpQSuOlagP0vuWeBdXE7ibhsJa7WQ=; b=Ln0bL4biAquSnBpn/PL61o2i96TgQ8D26eG8iqAi/OSVizh5Z5NLU0Zn91VKjQYc VLVhNw0coCt5zFGq6Ef+sq3tBaHbjZ4t+WEbAK1xg9NwErmA79RjRW1UkvKClbLzEm5 HelQTY6N1Kdk6G+6N1Rxo9Uou3OWS3Nl2Bxs2XM4=
From: Kent Watsen <kent+ietf@watsen.net>
Message-ID: <0100016d265824b0-313d5248-5aba-4b96-8f21-768be7784568-000000@email.amazonses.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_CBC41791-CC70-4D83-8A9A-089D5EECF605"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
Date: Thu, 12 Sep 2019 16:39:33 +0000
In-Reply-To: <20190912.111242.323252506550752617.mbj@tail-f.com>
Cc: "netconf@ietf.org" <netconf@ietf.org>, housley@vigilsec.com, rifaat.ietf@gmail.com, sean@sn3rd.com
To: Martin Bjorklund <mbj@tail-f.com>
References: <0100016d21ee2101-fb4f3288-1975-4a7d-a499-cb42ff8d9e14-000000@email.amazonses.com> <20190912.111242.323252506550752617.mbj@tail-f.com>
X-Mailer: Apple Mail (2.3445.104.11)
X-SES-Outgoing: 2019.09.12-54.240.8.64
Feedback-ID: 1.us-east-1.DKmIRZFhhsBhtmFMNikgwZUWVrODEw9qVcPhqJEI2DA=:AmazonSES
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/AtLYoPjxxPIQEm4BOvp4kJE7mm4>
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: Thu, 12 Sep 2019 16:39:38 -0000

Hi Martin,

> I'm not a security expert so I don't have any input on which ASN.1
> structure to support.
> 
> But it seems to me that in both B1 and B2, the "algorithm" leaf isn't
> really necessary in the config, right?  

The "algorithm" leaf is needed, because a "private-key" itself enough.  The RSAPrivateKey and ECPrivateKey ASN.1 structures contain just the raw key fields (e.g., RSA --> [d, p, q, n,e]).  The two structures do not share a common base type that would presumably identify if the payload is an RSAPrivate key or ECPrivateKey, so the the correct parser can be used.  We could argue that private keys should always come with a public key, in which case we could claim that, for B1, the typing of the private key is done via the typing of the public key.  I don't prefer this approach and, as you say, the same algorithm identifier would have to be passed into the generate-asymmetric-key() and generate-symmetric-key() actions, so having the field in the configuration seems right.


> I guess it is still needed
> when a key is generated though.  But then note that "rsaEncryption" is
> not an OID ("1.2.840.113549.1.1.1" is the OID).  If you want to use a
> symbolic name you need something else.

Isn't it?  Check https://tools.ietf.org/html/rfc3279#section-2.3.1 <https://tools.ietf.org/html/rfc3279#section-2.3.1>.



> Is the idea that the module becomes ietf-tls-keystore with top-level
> node tls-keystore?

There is no need to change the "keystore" module's name.  ASN.1 is not TLS-specific, it just so happens to be heavily used by TLS.

Already, and for awhile now, the ietf-crypto-types module has defined the private-key and public-key using type "binary" with a description statement saying that how it is parsed is defined by the "algorithm" field.   The description statements even say that the RSAPublicKey/RSAPrivateKey formats are defined in RFC8017 and the EC public/private key formats are defined in rfc5915.  These unnamed formats are actually the same ASN.1 structures mentioned in my OP.   So this was/is sort of been the plan all along.  



>>    c) figure out a plan for SSH later
> 
> Hmm, what does this mean?  That we won't do ietf-netconf-server now?

More fully, that line says: 

	c) figure out a plan for SSH later (the risk level is pretty low, e.g., I've seen code to key SSH keys from TLS keys)

The intention was to signal that it should be easy to determine how to support SSH, to support the netconf-client-server draft.  Nothing is blocked.  We just need to discuss a plan for what to do.  The easiest thing would be to 1) update the mapping table in the ssh-client-server drafts from mapping SSH-specific algorithm identifiers (e.g., in rfc4253) to OIDs, and 2) this could get moved into a section called "Implementation Considerations" that also notes that is an implementation convert between the ASN.1 structures used by, e.g., keystore, and the local SSH implementation (e.g., OpenSSH).



> Yes, NC/RC are programmatic APIs, but simplicity is always goodness...

ACK, but let's be clear that the "simplicity" is in the ready access to tooling, not from an algorithmic perspective.   

According to [1], the private-key format is identical to OpenSSL's private key format (i.e., it uses RSAPrivateKey/ECPrivateKey, not OneAsymmetricKey or something else).  Thus, the only conversion needed is to/from OpenSSH's public key format.  This does not appear to be hard, e.g., [2] has code showing how to do this using Python.

[1] http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG%2C-OpenSsh-and-OpenSSL <http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG,-OpenSsh-and-OpenSSL>
[2] https://blog.oddbit.com/post/2011-05-08-converting-openssh-public-keys/ <https://blog.oddbit.com/post/2011-05-08-converting-openssh-public-keys/>



Kent // as author