Introduce SslRef::set_private_key

This commit is contained in:
Anthony Ramine 2024-02-07 12:46:18 +01:00 committed by Anthony Ramine
parent 7ead83cf40
commit 8ab1873d8b
1 changed files with 12 additions and 0 deletions

View File

@ -3563,6 +3563,18 @@ impl SslRef {
Ok(())
}
/// Sets the private key.
///
/// This corresponds to [`SSL_use_PrivateKey`].
///
/// [`SSL_use_PrivateKey`]: https://www.openssl.org/docs/man1.1.1/man3/SSL_use_PrivateKey.html
pub fn set_private_key<T>(&mut self, key: &PKeyRef<T>) -> Result<(), ErrorStack>
where
T: HasPrivate,
{
unsafe { cvt(ffi::SSL_use_PrivateKey(self.as_ptr(), key.as_ptr())).map(|_| ()) }
}
}
/// An SSL stream midway through the handshake process.