Skip to content

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 force-pushed the master branch 2 times, most recently from c1832bb to 54d7133 Compare January 23, 2025 20:53
@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
@jdthomas
Copy link
Author

Any thoughts on merging this?

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