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

Fixes Issue #1113: TLS: Ignore certs in pem file when loading private key #1114

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

Conversation

jdthomas
Copy link

This ignores just certs in the file. Options I considered:

  1. Ignore all the non-key items. replacing with _ => {},

  2. Ignore explicitly the existing entries in rustls_pemfile::Item::* that are not a key. replacing with rustls_pemfile::Item::X509Certificate(_) | Crl(_) | Csr(_) => {},

  3. Ignore just the certs X509Certificate(_) => {}, _ => return Err(TlsConfigError::UnknownPrivateKeyFormat),

Any of those would resolve my issue of certs + keys in same file, happy to adjust diff as needed.

@jdthomas jdthomas force-pushed the master branch 2 times, most recently from 19bf761 to c794232 Compare January 22, 2025 20:53
@jdthomas
Copy link
Author

jdthomas commented Jan 22, 2025

Looks like rusttls-pemfile also has a private_key fn similar to the certs fn used at the start of the builder. Perhaps that is what should be used instead of the whole loop?

https://docs.rs/rustls-pemfile/latest/rustls_pemfile/fn.private_key.html

[edit: might look something like this: https://github.com/jdthomas/warp/commit/ff9c9a0892e29259dc7a16cc948a9576129e0039 ]

@jdthomas jdthomas changed the title Fixes Issue#1113: TLS: Ignore certs in pem file when loading private key Fixes Issue #1113: TLS: Ignore certs in pem file when loading private key Jan 23, 2025
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.

1 participant