refine tls::ota.into() TrustAnchor

This commit is contained in:
nworbnhoj 2024-02-27 07:21:36 +10:00
parent e608e7bb30
commit 2cc0052d7d

View file

@ -108,13 +108,9 @@ impl<'a> From<&X509Certificate<'a>> for OwnedTrustAnchor {
impl<'a> Into<TrustAnchor<'a>> for OwnedTrustAnchor { impl<'a> Into<TrustAnchor<'a>> for OwnedTrustAnchor {
fn into(self) -> TrustAnchor<'a> { fn into(self) -> TrustAnchor<'a> {
TrustAnchor { TrustAnchor {
subject: Der::from_slice(self.subject.as_slice()), subject: Der::from(self.subject),
subject_public_key_info: Der::from_slice(self.spki.as_slice()), subject_public_key_info: Der::from(self.spki),
name_constraints: if self.name_constraints.is_some() { name_constraints: self.name_constraints.map_or(None, |nc| Some(Der::from(nc))),
Some(Der::from_slice(self.name_constraints.as_deref().unwrap()))
} else {
None
},
} }
.to_owned() .to_owned()
} }