[netconf] SSH private key format?

Kent Watsen <kent+ietf@watsen.net> Wed, 12 February 2020 12:06 UTC

Return-Path: <01000170394b7ff7-efa3321d-b84c-4945-92d1-c567cf02c7f6-000000@amazonses.watsen.net>
X-Original-To: netconf@ietfa.amsl.com
Delivered-To: netconf@ietfa.amsl.com
Received: from localhost (localhost []) by ietfa.amsl.com (Postfix) with ESMTP id 8C4641208A6 for <netconf@ietfa.amsl.com>; Wed, 12 Feb 2020 04:06:57 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.897
X-Spam-Status: No, score=-1.897 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, RCVD_IN_MSPIKE_H2=-0.001, 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 ([]) by localhost (ietfa.amsl.com []) (amavisd-new, port 10024) with ESMTP id PMM950g1vUVN for <netconf@ietfa.amsl.com>; Wed, 12 Feb 2020 04:06:56 -0800 (PST)
Received: from a48-93.smtp-out.amazonses.com (a48-93.smtp-out.amazonses.com []) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id ED77712008F for <netconf@ietf.org>; Wed, 12 Feb 2020 04:06:55 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1581509214; h=From:Content-Type:Mime-Version:Subject:Message-Id:Date:To:Feedback-ID; bh=DF9l3ZGLRNawbnfiwikAEopejrOV+/mCWZSNzYUb4oA=; b=j8/Ds3/zRE6yZfyQr9mjodF6NFT9ANBFhDxNpzCUKddhhGuzc62jHoNw6cqAzVT8 41GNrqpOs1CGwh2EkTbtSjgycEyg8xFweUrLDyZ7s1qH/tqlLVLVlPEr4CP8JCcxeJE nHtGas0L/xs89T7tM5yFULX0AmFhuzCHgMc47zqE=
From: Kent Watsen <kent+ietf@watsen.net>
Content-Type: multipart/alternative; boundary="Apple-Mail=_C332F41D-1E21-4AAA-95BA-26747E04BD09"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
Message-ID: <01000170394b7ff7-efa3321d-b84c-4945-92d1-c567cf02c7f6-000000@email.amazonses.com>
Date: Wed, 12 Feb 2020 12:06:54 +0000
To: "netconf@ietf.org" <netconf@ietf.org>
X-Mailer: Apple Mail (2.3445.104.11)
X-SES-Outgoing: 2020.02.12-
Feedback-ID: 1.us-east-1.DKmIRZFhhsBhtmFMNikgwZUWVrODEw9qVcPhqJEI2DA=:AmazonSES
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/Dzgd60pyUfm9dmmHkdGMekZByjE>
Subject: [netconf] SSH private key format?
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, 12 Feb 2020 12:06:57 -0000

Related to the crypto-types, keystore, and truststore drafts...

Everyone seems to agree that the *public* key format can be specified as:

	leaf public-key {
	   type binary;
	      "The binary public key data for an SSH key, as
	       specified by RFC 4253, Section 6.6, i.e.:

	         string    certificate or public key format identifier
	         byte[n]   key/certificate data.";
	      "RFC 4253: The Secure Shell (SSH) Transport
	       Layer Protocol”;

	BTW, being “binary”, this produces a block a base64,
	a la https://tools.ietf.org/html/rfc4716#section-3.6 <https://tools.ietf.org/html/rfc4716#section-3.6>, but
	without the headers and footers, or EOL characters.

	Also note that “key data” is underspecified.  “certificate
	data” is better, as PGP/X.509 certs are well-specified,
	though we have to *assume* the encoding is “DER".

But what is the *private* key format?  (i.e., ~/.ssh/id_dsa, ~/.ssh/id_ecdsa, ~/.ssh/id_ed25519 or ~/.ssh/id_rsa).  

SSH-KEYGEN(1) says this:

     -m key_format
             Specify a key format for the -i (import) or -e (export) conversion options.  The supported key formats are:
             ``RFC4716'' (RFC 4716/SSH2 public or private key), ``PKCS8'' (PEM PKCS8 public key) or ``PEM’'
             (PEM public key). The default conversion format is ``RFC4716''.

FWIW, RFC 4716 does NOT define a private key format.  PKCS8 does define a private key format.  PKCS8 was obsoleted by RFC 5958, which defines the “OneAsymmetricKey" format, which is one of the formats used for TLS private keys.

That said, without actually trying to parse these private keys files,I suspect that they are actually raw private keys (e.g., RSAPrivateKey, ECPrivateKey, etc.) and not PKCS8/OneAsymmetricKey because, if they were a OneAsymmetricKey, there would be no need for different filenames...

Can anyone dig into this and confirm what these file formats are?

Kent // contributor