From 884c91e770102f83c69467580b69418c94e54897 Mon Sep 17 00:00:00 2001 From: Rushil Mehra Date: Tue, 18 Jun 2024 16:22:07 -0700 Subject: [PATCH] Expose X509_check_host --- boring/src/x509/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/boring/src/x509/mod.rs b/boring/src/x509/mod.rs index 988428f4..eca19db0 100644 --- a/boring/src/x509/mod.rs +++ b/boring/src/x509/mod.rs @@ -592,6 +592,19 @@ impl X509Ref { } } + pub fn check_host(&self, host: &str) -> Result { + unsafe { + cvt_n(ffi::X509_check_host( + self.as_ptr(), + host.as_ptr() as _, + host.len(), + 0, + std::ptr::null_mut(), + )) + .map(|n| n != 0) + } + } + to_pem! { /// Serializes the certificate into a PEM-encoded X509 structure. ///