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)?)?; |
|
@SSebo please fix up the formatting, then we can merge it! Thanks! |
Signed-off-by: ssebo <ssebo.zzz@gmail.com>
I found
quinn::Certificatemissing afrom_pemfunction when I use pem format certificates, just add it.