Closed Echaleon closed 2 years ago
Adding proper support for EC keys should be as simple as adding Some(Item::ECKey(key)) to the match clause of config_from_pem().
This isn't available in rustls-pemfile 0.2
which was the latest release back then.
You can bump up the rustls-pemfile
version and add Some(Item::ECKey(key))
.
All pull requests are welcome.
And the error message is confusing, I totally thought I had a wrong path.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "private key not found" }', sentinel/src/main.rs:414:10
from_pem_file() calls eventually to config_from_pem() which restricts the keys to be of type
Some(Item::RSAKey(key))
orSome(Item::PKCS8Key(key))
and this rejects a lot of EC keys. One either needs to convert it from SEC1 to PKCS8 or directly encode into DER and load the files by hand to callfrom_der()
instead.Adding proper support for EC keys should be as simple as adding
Some(Item::ECKey(key))
to the match clause ofconfig_from_pem()
. I'd be happy to open a pull request for it.