Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set public key from private key in DNSKEY instead of copying it from DNSKEY to private key #1560

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

baest
Copy link

@baest baest commented Apr 26, 2024

Previously when loading a PrivateKey into a DNSKEY we would return the PrivateKey with the PublicKey set from the DNSKEY struct. Now that behaviour is flipped and the PublicKey is taken from the PrivateKey and set in the DNSKEY.

…DNSKEY to private key

Previously when loading a PrivateKey into a DNSKEY we would return the PrivateKey with the PublicKey set from the DNSKEY struct.
Now that behaviour is flipped and the PublicKey is taken from the PrivateKey and set in the DNSKEY.
It will now fail if the algorithm or PublicKey in the DNSKEY doesn't
match what is loaded in the input file
@baest baest force-pushed the set_public_key_from_private_key branch from b680beb to d9e2afe Compare April 28, 2024 19:54
@@ -48,27 +48,29 @@ const (

// Errors defined in this package.
var (
ErrAlg error = &Error{err: "bad algorithm"} // ErrAlg indicates an error with the (DNSSEC) algorithm.
Copy link
Owner

Choose a reason for hiding this comment

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

what happened with this file?

Copy link
Author

Choose a reason for hiding this comment

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

I added a new entry and my editor reformatted the code to align better. I thought it an ok change so I kept it, but I can take this out if needed.

@miekg
Copy link
Owner

miekg commented Jun 13, 2024

what motivates this change?

@baest
Copy link
Author

baest commented Jun 13, 2024

what motivates this change?

I have private keys stored in a database and I need to load those, get the public key from it and also use that to create the DS. The previous version took the public key from the DNSKEY object and then copied it into the private key. To me it makes more sense to just keep the public key stored inside the private key (and it also serves my needs to be fair).
Also this change makes it simpler to load a private key, since an almost empty DNSKEY object can be used to load the private key.

@baest
Copy link
Author

baest commented Oct 5, 2024

Hi, would you consider merging this? It is an implementation of #1558

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.

2 participants