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

server: Read PKSC8 private keys #14

Merged
merged 3 commits into from
Feb 28, 2022
Merged

server: Read PKSC8 private keys #14

merged 3 commits into from
Feb 28, 2022

Conversation

olix0r
Copy link
Owner

@olix0r olix0r commented Feb 28, 2022

Currently the server only attempts to parse RSA private keys. This
change updates the server to first attempt to read PKSC8 private keys
before attempting to parse the key file as RSA.

Currently the server only attempts to parse RSA private keys. This
change updates the server to first attempt to read PKSC8 private keys
before attempting to parse the key file as RSA.
Copy link
Collaborator

@hawkw hawkw left a comment

Choose a reason for hiding this comment

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

looks good to me --- one suggestion.

kubert/src/server.rs Outdated Show resolved Hide resolved
kubert/src/server.rs Outdated Show resolved Hide resolved
kubert/src/server.rs Outdated Show resolved Hide resolved

// Load and return a single private key.
let keys = rustls_pemfile::rsa_private_keys(&mut reader)?;
let keys = rustls_pemfile::pkcs8_private_keys(&mut BufReader::new(pem.as_slice()))
.or_else(|_| rustls_pemfile::rsa_private_keys(&mut BufReader::new(pem.as_slice())))?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we want to maybe log something about which format the keys were parsed in?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I could go either way. for now I'll trust that whatever rustls logs is good enough

kubert/src/server.rs Outdated Show resolved Hide resolved
@olix0r olix0r merged commit 26fb467 into main Feb 28, 2022
@olix0r olix0r deleted the ver/load-pkcs8-keys branch February 28, 2022 21:43
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.

3 participants