-
-
Notifications
You must be signed in to change notification settings - Fork 423
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
certificate: accept pem format #829
Conversation
Seems okay to me (modulo the formatting nit from CI -- ignore the clippy warning). @Ralith, any thoughts? |
I don't have a great grasp on the pem format itself; are there times when it'd be more appropriate to use this over |
Pem seems easier to handle from an ops point of view as most providers (i know) use this format. This PR simplify user's life by saving them the converting work IMHO. |
Er, sorry, that was a typo. I meant to ask whether there are situations where you can't use |
I found der format in let key = quinn::PrivateKey::from_der(&key)?;
let cert = quinn::Certificate::from_der(&cert)?;
server_config.certificate(quinn::CertificateChain::from_certs(vec![cert]), key)?; I followed the example, think maybe pem format should be this way: let key = quinn::PrivateKey::from_pem(&key)?;
let cert = quinn::Certificate::from_pem(&cert)?;
server_config.certificate(quinn::CertificateChain::from_certs(vec![cert]), key)?; after I read @Ralith 's comment, I found following way is working as well: let key = quinn::PrivateKey::from_pem(&key)?;
server_config.certificate(quinn::CertificateChain::from_pem(&cert.to_vec())?, key)?; In my case, client_config.add_certificate_authority(quinn::Certificate::from_pem(&cert)?)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me.
@SSebo please fix up the formatting, then we can merge it! Thanks! |
Signed-off-by: ssebo <ssebo.zzz@gmail.com>
I found
quinn::Certificate
missing afrom_pem
function when I use pem format certificates, just add it.