Fixes Issue #1113: TLS: Ignore certs in pem file when loading private key
This ignores just certs in the file. Options I considered:
-
Ignore all the non-key items. replacing with
_ => {}, -
Ignore explicitly the existing entries in
rustls_pemfile::Item::*that are not a key. replacing withrustls_pemfile::Item::X509Certificate(_) | Crl(_) | Csr(_) => {}, -
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.
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 ]
Any thoughts on merging this?