Introduce Ssl::set_certificate

This commit is contained in:
Anthony Ramine 2023-10-06 13:05:12 +02:00 committed by Alessandro Ghedini
parent 907eaf079c
commit 273509ccb0
1 changed files with 13 additions and 0 deletions

View File

@ -3258,6 +3258,19 @@ impl SslRef {
pub fn set_mtu(&mut self, mtu: u32) -> Result<(), ErrorStack> { pub fn set_mtu(&mut self, mtu: u32) -> Result<(), ErrorStack> {
unsafe { cvt(ffi::SSL_set_mtu(self.as_ptr(), mtu as c_uint) as c_int).map(|_| ()) } unsafe { cvt(ffi::SSL_set_mtu(self.as_ptr(), mtu as c_uint) as c_int).map(|_| ()) }
} }
/// Sets the certificate.
///
/// This corresponds to [`SSL_use_certificate`].
///
/// [`SSL_use_certificate`]: https://www.openssl.org/docs/man1.1.1/man3/SSL_use_certificate.html
pub fn set_certificate(&mut self, cert: &X509Ref) -> Result<(), ErrorStack> {
unsafe {
cvt(ffi::SSL_use_certificate(self.as_ptr(), cert.as_ptr()))?;
}
Ok(())
}
} }
/// An SSL stream midway through the handshake process. /// An SSL stream midway through the handshake process.