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

*ring* interoperability issues with RSA #697

Closed
djc opened this issue Feb 14, 2025 · 6 comments
Closed

*ring* interoperability issues with RSA #697

djc opened this issue Feb 14, 2025 · 6 comments

Comments

@djc
Copy link
Contributor

djc commented Feb 14, 2025

Problem:

In hickory-dns/hickory-dns#2778 I am preparing to add an aws-lc-rs backend to a pre-existing ring crypto backend for Hickory's DNSSEC implementation. In porting the code, I found one issue where the aws-lc-rs API currently does not seem to offer a capability that ring offers, and there's one piece of API that ring deprecated for which aws-lc-rs does not have the replacement. In order to make this a smooth transition, it would be great if these could be addressed, though I'm also happy to take on some wrapper code to make things fit.

Main issue:

djc-2021 actuallly-aws-lc proto $ cargo c --features dnssec-aws-lc-rs --all-targets
    Checking hickory-proto v0.25.0-alpha.5 (/Users/djc/src/hickory-dns/crates/proto)
error[E0308]: mismatched types
   --> crates/proto/src/dnssec/crypto.rs:453:63
    |
453 |         let components = PublicKeyComponents::<Vec<u8>>::from(self.inner.public_key());
    |                          ------------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^ expected `RsaPublicKeyComponents<Vec<...>>`, found `&RsaSubjectPublicKey`
    |                          |
    |                          arguments to this function are incorrect
    |
    = note: expected struct `PublicKeyComponents<Vec<u8>>`
            found reference `&RsaSubjectPublicKey`

ring's rsa::PublicKeyComponents offers a From<&PublicKey> impl, which we currently use in Hickory to convert the RSA public key to the DNSSEC-specified encoding (see /~https://github.com/hickory-dns/hickory-dns/blob/42d400f/crates/proto/src/dnssec/ring.rs#L453).

Minor issue:

ring deprecated RsaKeyPair::public_modulus_len() in favor of RsaKeyPair::public().modulus_len(). aws-lc-rs has not deprecated public_modulus_len() but also doesn't offer modulus_len() through its public(). For now, I just stuck an #[allow(deprecated)] on it but it might be nice to adopt the new ring API?

Requirements / Acceptance Criteria:

Would like to be able to merge support for aws-lc-rs into Hickory DNS.

@justsmth
Copy link
Contributor

Hello -- Thanks for the PR!

I made a couple of adjustments to your PR. The modulus and exponent are only readily available with the "ring-io" feature enabled. I also added a modulus_len function to the RSA PublicKey.

Let us know if these changes address your needs.

@djc
Copy link
Contributor Author

djc commented Feb 18, 2025

Looks great, thanks! If at all possible, would be nice to get a release containing these changes.

@justsmth
Copy link
Contributor

Sure! There's a couple of other minor fixes that need to go out as well. I'll try to pull together a patch release. Maybe by tomorrow?

@djc
Copy link
Contributor Author

djc commented Feb 18, 2025

Would be awesome!

@justsmth
Copy link
Contributor

Hello! We just released aws-lc-rs v1.12.3. Thanks for the report and PR!

@djc
Copy link
Contributor Author

djc commented Feb 19, 2025

Thanks for the quick response!

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

No branches or pull requests

2 participants