tonic
tonic copied to clipboard
add support for parsing X509 certs from DER
tls: allow creation of Certificate and Identity from DER
Adds Certificate::from_der and Identity::from_der constructors to allow creation of Certificate and Identity from DER-encoded data.
Fixes: #2343 Fixes: #2344
Motivation
PEM and DER are both very common encoding formats for X509 certificates.
Solution
Convert DER certificates to PEM to prevent changes to the rest of the crate. The conversion is done following RFC 7468, which basically means converting the DER in base64 and adding the proper header and footer.
Thank you for writing patches to address these two issues.