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

from_pem_file() rejects valid EC keys #36

Closed
Echaleon opened this issue Mar 8, 2022 · 2 comments · Fixed by #43
Closed

from_pem_file() rejects valid EC keys #36

Echaleon opened this issue Mar 8, 2022 · 2 comments · Fixed by #43

Comments

@Echaleon
Copy link

Echaleon commented Mar 8, 2022

from_pem_file() calls eventually to config_from_pem() which restricts the keys to be of type Some(Item::RSAKey(key)) or Some(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 call from_der() instead.

Adding proper support for EC keys should be as simple as adding Some(Item::ECKey(key)) to the match clause of config_from_pem(). I'd be happy to open a pull request for it.

@programatik29
Copy link
Owner

programatik29 commented Mar 31, 2022

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.

@Madoshakalaka
Copy link
Contributor

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

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 a pull request may close this issue.

3 participants