Skip to content

Commit

Permalink
Introduce SslRef::set_private_key
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Feb 8, 2024
1 parent 7ead83c commit 8ab1873
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions boring/src/ssl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 8ab1873

Please sign in to comment.