Skip to content

Conversation

@tertsdiepraam
Copy link
Contributor

No description provided.

| SecAlg::ECDSAP256SHA256 => DigestAlg::SHA256,
SecAlg::ECDSAP384SHA384 => DigestAlg::SHA384,
SecAlg::ECC_GOST => DigestAlg::GOST,
_ => DigestAlg::SHA1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is using SHA-1 as the fallback a good idea? If new algorithms were to get introduced and we forget to update the above list, they would fallback to using SHA-1, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the current ldns behaviour: https://github.com/NLnetLabs/ldns/blob/b87b8e1d212b43f225891570ebc5045c6331dd8a/examples/ldns-key2ds.c#L48C1-L48C14

If we want to change it, let's take it to a separate PR, where we can discuss this in depth.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@mozzieongit mozzieongit mentioned this pull request Oct 30, 2024
let sec_alg = sec_alg.to_int();
let filename =
format!("K{owner}+{sec_alg:03}+{key_tag:05}.ds");
let mut out_file = File::create(&filename).map_err(|e| {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to use File::create_new() here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly, but ldns-key2ds doesn't care I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is, if we have consensus that we want to break compat here, I'd be happy to change it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we have different argument parsing for ldns and dnst, and we can use different defaults, we can probably also introduce differences here. Maybe a simple running_as_ldns: bool (clap-hidden) member is enough or should it be an enum like MultiCallMode::{LDNS,DNST}/CompatMode::{None/DNST,LDNS} (or similar)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep!

@tertsdiepraam
Copy link
Contributor Author

Little update: I changed the arguments for the dnst version so that we can use --force/-f for overwriting files and turn the ignoring sep option into the more descriptive --ignore-sep. I also added file opening/creation into Env, which can now be set up with a temp dir. Adds a bit of complexity, but not too much since we already have to use Env everywhere and the tests are quite nice if I do say so myself.

Copy link
Member

@mozzieongit mozzieongit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the minor comments, it looks good to me. Also, very thorough testing.

@tertsdiepraam tertsdiepraam merged commit 511c8f1 into main Nov 19, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants