implement tls RustlsOwnedTrustAnchor to rustls::OwnedTrustAnchor

This commit is contained in:
nworbnhoj 2023-06-24 14:57:16 +10:00
parent 80ff0cb52a
commit 65f92453a2

View file

@ -23,6 +23,15 @@ pub struct RustlsOwnedTrustAnchor {
name_constraints: Option<Vec<u8>>,
}
impl RustlsOwnedTrustAnchor {
pub fn to_owned_trust_anchor(self) -> rustls::OwnedTrustAnchor {
rustls::OwnedTrustAnchor::from_subject_spki_name_constraints(
self.subject,
self.spki,
self.name_constraints,
)
}
}
impl<'a> From<&X509Certificate<'a>> for RustlsOwnedTrustAnchor {
fn from(x509: &X509Certificate) -> Self {
RustlsOwnedTrustAnchor {