<html><body>Hello Tony,<div><br></div><div>ok, I did exactly what you adviced.</div><div>Now I´m able to sign my zone. B<span style="background-color:transparent">ut in </span>dsset<span style="background-color:transparent"> file, which should contain the same DS as I already have in the parent zone a have different "</span>keytag"<span style="background-color:transparent"> and different hash. </span></div><div><span style="background-color:transparent">In my case is "keytag" in dsset file is </span><span style="background-color:transparent">43120.</span></div><div><br></div><div>i.e.</div><div><div>example.com. IN DS 43120 13 1 28844871EB1835E6EA3EE5554B5E7BLABLABLA</div><div>example.com. IN DS 43120 13 2 7777AEB8EE54BE246EA6A83637E39EE47AB13EAD8B3E287D3BLABLABLA</div></div><div><br></div><div>I hoped for the same result which I already have in the parent zone.</div><div><br></div><div>Could you please advice me once again?<br>-- <br>Smil Milan Jeskyňka Kazatel<br><br><aside> ---------- Původní e-mail ----------<br>Od: Tony Finch <dot@dotat.at><br>Komu: Milan Jeskynka Kazatel <KazatelM@seznam.cz><br>Datum: 14. 3. 2019 14:56:26<br>Předmět: Re: convert Knot DNS sigantures certs to BIND format.</aside><br><blockquote data-email="dot@dotat.at">Milan Jeskynka Kazatel <KazatelM@seznam.cz> wrote:
<br>>
<br>> When I tried to re-sign my zone in BIND by Webmin, then I get this error
<br>> message below. My original "keytag" is 43121. I don´t understand, where is
<br>> written information like example.com/ECDSAP256SHA256/45623
<br>
<br>BIND often does not refer to key files by filename, so it helps if you
<br>know how the mnemonic description of the key maps to the filenames. In
<br>this case, example.com/ECDSAP256SHA256/45623 corresponds to
<br>Kexample.com+013+45623.key and .private - 13 is the algorithm number for
<br>ecdsa256 and 45623 is the key tag.
<br>
<br>> dnssec-signzone: warning: dns_dnssec_keylistfromrdataset:
<br>> error reading private key file example.com/ECDSAP256SHA256/45623:
<br>> file not found
<br>
<br>I think this means there is a DNSKEY record in the zone with tag 45623, so
<br>dnssec-signzone is looking for the corresponding private key file.
<br>
<br>> dnssec-signzone: warning: dns_dnssec_keylistfromrdataset:
<br>> error reading private key file example.com/ECDSAP256SHA256/43121:
<br>> private key is invalid
<br>
<br>This error happens if there's a cryptographic mismatch between the private
<br>key and the public key.
<br>
<br>The unexpected key tag might be caused by the same mismatch, but I can't
<br>be sure about that.
<br>
<br>It might help if I go through the details of the parts I omitted from the
<br>end of my previous message.
<br>
<br>Remember, I had:
<br>
<br>$ cat /var/lib/knot/keys/zone_example.com.json
<br>{
<br> "policy": "\u0006policy",
<br> "nsec3_salt": null,
<br> "nsec3_salt_created": null,
<br> "keys": [
<br> {
<br> "id": "c3e8539dc582bb2ceeca0ab9fb7b89d521a4f658",
<br> "keytag": 19633,
<br> "algorithm": 13,
<br> "public_key": "h9c2BtzXhjYHSdLC+XstMGQ6HBLgoerczR++pA/owtWv/jBxvhJiYLoH6gcXKJddCM3EVcGIv9u25TQSHQ7SrA==",
<br> "ksk": false,
<br> "created": "2019-03-12T15:44:02+0000"
<br> }
<br> ]
<br>}
<br>
<br>$ openssl ec -outform der </var/lib/knot/keys/keys/c3e8539dc582bb2ceeca0ab9fb7b89d521a4f658.pem |
<br> perl -Mv5.10 -MMIME::Base64 -e '
<br> undef $/; my $k = <STDIN>;
<br> print encode_base64 substr $k, 7, 32;
<br> print encode_base64 substr $k, -64;'
<br>read EC key
<br>writing EC key
<br>9WCSrP5vSTrPMrMWISz3N0aU6wZPcRHxcZKE9g0Wc94=
<br>h9c2BtzXhjYHSdLC+XstMGQ6HBLgoerczR++pA/owtWv/jBxvhJiYLoH6gcXKJddCM3EVcGIv9u2
<br>5TQSHQ7SrA==
<br>
<br>The JSON metadata says "algorithm": 13, "ksk": false, so I run
<br>
<br>$ dnssec-keygen -a 13 example.com
<br>Generating key pair.
<br>Kexample.com.+013+11891
<br>
<br>(If ksk is true then I need to add the -f KSK option.)
<br>
<br>The JSON says "keytag": 19633, so I run
<br>
<br>$ mv Kexample.com.+013+11891.key Kexample.com.+013+19633.key
<br>$ mv Kexample.com.+013+11891.private Kexample.com.+013+19633.private
<br>
<br>Now I need to edit the files.
<br>
<br>In the .key file I change the keyid (aka keytag) and the public key to
<br>match the JSON metadata. Note that the public key is very long, and you
<br>need to avoid unwanted line breaks. (The perl magic ouput has an unwanted
<br>line break so you might prefer to use the blob from the JSON.)
<br>
<br>Before:
<br>
<br>$ cat Kexample.com.+013+19633.key
<br>; This is a zone-signing key, keyid 11891, for example.com.
<br>; Created: 20190314133836 (Thu Mar 14 13:38:36 2019)
<br>; Publish: 20190314133836 (Thu Mar 14 13:38:36 2019)
<br>; Activate: 20190314133836 (Thu Mar 14 13:38:36 2019)
<br>example.com. IN DNSKEY 256 3 13 1cZ3gTd2P3su+pWjBj+wGjGsWt22T/cZmlxrwB1Be91lW0BvrOHN1SDZ togkoCBsdb70zj2//W6QQQcgQudVEQ==
<br>
<br>After:
<br>
<br>$ cat Kexample.com.+013+19633.key
<br>; This is a zone-signing key, keyid 19633, for example.com.
<br>; Created: 20190314133836 (Thu Mar 14 13:38:36 2019)
<br>; Publish: 20190314133836 (Thu Mar 14 13:38:36 2019)
<br>; Activate: 20190314133836 (Thu Mar 14 13:38:36 2019)
<br>example.com. IN DNSKEY 256 3 13 h9c2BtzXhjYHSdLC+XstMGQ6HBLgoerczR++pA/owtWv/jBxvhJiYLoH6gcXKJddCM3EVcGIv9u25TQSHQ7SrA==
<br>
<br>I also need to change the private key to match the output from the perl magic.
<br>
<br>Before:
<br>
<br>$ cat Kexample.com.+013+19633.private
<br>Private-key-format: v1.3
<br>Algorithm: 13 (ECDSAP256SHA256)
<br>PrivateKey: ysGhvWvE6fJcTxC9d9FXPn4qYuVkILE7l3Ei5VS2pMs=
<br>Created: 20190314133836
<br>Publish: 20190314133836
<br>Activate: 20190314133836
<br>
<br>After:
<br>
<br>$ cat Kexample.com.+013+19633.private
<br>Private-key-format: v1.3
<br>Algorithm: 13 (ECDSAP256SHA256)
<br>PrivateKey: 9WCSrP5vSTrPMrMWISz3N0aU6wZPcRHxcZKE9g0Wc94=
<br>Created: 20190314133836
<br>Publish: 20190314133836
<br>Activate: 20190314133836
<br>
<br>Now I should be able to sign the zone. I'm using the -S smart signing
<br>option, and -P to suppress the error that is reported because my zone has
<br>no KSK.
<br>
<br>$ dnssec-signzone -S -P example.com
<br>Fetching ZSK 19633/ECDSAP256SHA256 from key repository.
<br>example.com.signed
<br>
<br>Done.
<br>
<br>Tony.
<br>--
<br>f.anthony.n.finch <dot@dotat.at> http://dotat.at/
<br>Viking: Variable 3 or less, becoming southwest 4 or 5, occasionally 6 later.
<br>Moderate or rough. Showers then rain. Good, occasionally poor.</blockquote></div></body></html>