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

Add RSA key generation #230

Merged
merged 2 commits into from
Mar 5, 2024
Merged

Add RSA key generation #230

merged 2 commits into from
Mar 5, 2024

Conversation

est31
Copy link
Member

@est31 est31 commented Feb 28, 2024

Uses the recently added RSA key generation support of aws-lc-rs.

Fixes #229

Copy link
Member

@djc djc left a comment

Choose a reason for hiding this comment

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

Nice!

rcgen/src/sign_algo.rs Show resolved Hide resolved
Copy link
Member

@cpu cpu left a comment

Choose a reason for hiding this comment

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

Thanks for picking this up!

I think this should come with at least one unit test to prevent regressions and to demonstrate the feature works as intended.

It also looks like we could probably drop the dev dependency on the rsa crate now? It's only used in the rsa-irc.rs example for key generation and I think it would be better to show Rcgen doing this natively. The rsa crate has an unresolved vulnerability that makes its removal from rcgen particularly tempting IMO.

rcgen/src/key_pair.rs Outdated Show resolved Hide resolved
rcgen/src/key_pair.rs Outdated Show resolved Hide resolved
rcgen/src/key_pair.rs Outdated Show resolved Hide resolved
@cpu
Copy link
Member

cpu commented Feb 28, 2024

One more thought: It would be ideal to also see rustls-cert-gen updated w/ RSA keygen support alongside this work:

/// Supported Keypair Algorithms
#[derive(Clone, Copy, Debug, Default, Bpaf, PartialEq)]
pub enum KeyPairAlgorithm {
Ed25519,
#[default]
EcdsaP256,
EcdsaP384,
}

@est31
Copy link
Member Author

est31 commented Feb 28, 2024

Thanks for the reviews, will look into addressing them tomorrow.

rcgen/src/key_pair.rs Outdated Show resolved Hide resolved
@est31 est31 requested review from djc and cpu March 1, 2024 23:56
Copy link
Member

@cpu cpu left a comment

Choose a reason for hiding this comment

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

Thanks 👍

Did you have thoughts on dropping the rsa dev-dep for the one example? I think it's fine to omit in this branch, just curious if you're interested in the idea generally for potential follow-up.

rcgen/src/key_pair.rs Show resolved Hide resolved
@@ -205,6 +205,7 @@ impl EndEntityBuilder {
/// Supported Keypair Algorithms
#[derive(Clone, Copy, Debug, Default, Bpaf, PartialEq)]
pub enum KeyPairAlgorithm {
Rsa,
Copy link
Member

Choose a reason for hiding this comment

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

Should this enum variant maybe carry RsaKeySize now that the rcgen side supports specifying key size?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe, yeah, happy to see followup PRs for it.

@est31
Copy link
Member Author

est31 commented Mar 3, 2024

Did you have thoughts on dropping the rsa dev-dep for the one example?

Yeah we can drop it I think, but would prefer to do it in a followup.

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum RsaKeySize {
_2048,
Copy link
Member

Choose a reason for hiding this comment

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

Nit: the _ prefix looks unidiomatic to me, but not sure I have a better idea.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, not really perfect. r#2048 doesn't work, but I like _2048 more than Rsa2048.

@est31 est31 added this pull request to the merge queue Mar 4, 2024
Merged via the queue into main with commit e719ec2 Mar 5, 2024
40 of 42 checks passed
@est31 est31 deleted the rsa_key_gen branch March 5, 2024 00:08
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.

Support RSA-based sign algorithms
3 participants