Re: [DNSOP] Specification of DNSKEY "Private-key-format"

Viktor Dukhovni <ietf-dane@dukhovni.org> Thu, 29 August 2019 13:48 UTC

Return-Path: <ietf-dane@dukhovni.org>
X-Original-To: dnsop@ietfa.amsl.com
Delivered-To: dnsop@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 282CF120071 for <dnsop@ietfa.amsl.com>; Thu, 29 Aug 2019 06:48:34 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.2
X-Spam-Level:
X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-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 3JGxrkwHURuH for <dnsop@ietfa.amsl.com>; Thu, 29 Aug 2019 06:48:32 -0700 (PDT)
Received: from straasha.imrryr.org (straasha.imrryr.org [100.2.39.101]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 89F2512004A for <dnsop@ietf.org>; Thu, 29 Aug 2019 06:48:32 -0700 (PDT)
Received: by straasha.imrryr.org (Postfix, from userid 1001) id BAEE94C63B; Thu, 29 Aug 2019 09:48:31 -0400 (EDT)
Date: Thu, 29 Aug 2019 09:48:31 -0400
From: Viktor Dukhovni <ietf-dane@dukhovni.org>
To: dnsop@ietf.org
Message-ID: <20190829134831.GC90696@straasha.imrryr.org>
Reply-To: dnsop@ietf.org
References: <20190829125502.GA2048@jurassic.lan.banu.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <20190829125502.GA2048@jurassic.lan.banu.com>
User-Agent: Mutt/1.12.1 (2019-06-15)
Archived-At: <https://mailarchive.ietf.org/arch/msg/dnsop/qRkdpNefz7cnm-36nPc8re75Ulk>
Subject: Re: [DNSOP] Specification of DNSKEY "Private-key-format"
X-BeenThere: dnsop@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: IETF DNSOP WG mailing list <dnsop.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/dnsop>, <mailto:dnsop-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/dnsop/>
List-Post: <mailto:dnsop@ietf.org>
List-Help: <mailto:dnsop-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/dnsop>, <mailto:dnsop-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 29 Aug 2019 13:48:34 -0000

On Thu, Aug 29, 2019 at 06:25:02PM +0530, Mukund Sivaraman wrote:
> A tool such as BIND's dnssec-keygen generates the following formatted
> private keys:
> 
> [muks@naina ~]$ cat Kexample.org.+008+10638.private
> Private-key-format: v1.3
> Algorithm: 8 (RSASHA256)
> Modulus: [...]
> PublicExponent: [...]
> PrivateExponent: [...]
> Prime1: [...]
> Prime2: [...]
> Exponent1: [...]
> Exponent2: [...]
> Coefficient: [...]

Compare the above with:

    $ openssl genrsa 512 2>/dev/null | openssl rsa -text -noout | egrep -v ':..:'
    RSA Private-Key: (512 bit, 2 primes)
    modulus:
    publicExponent: 65537 (0x10001)
    privateExponent:
    prime1:
    prime2:
    exponent1:
    exponent2:
    coefficient:

And it becomes clear that what you're seeing is a sequence of tagged
base64 encodings of the BIGNUM elements of the CRT form of an RSA
private key.

> Created: [...]
> Publish: 20190829125147
> Activate: 20190829125147

Plus some additional metadata.

> I have looked around for a specification for this format, but I fail to
> find one. Where is this specified? Has it ever been described in some
> document?

This looks like an ad-hoc format, specific to dnssec-keygen and
friends.  In particular "Publish:" and "Activate:" are not part of
the key per-se and are rather related to the DNSSEC key lifecycle.

-- 
	Viktor.