Struct openssl::ssl::Ssl
[−]
[src]
pub struct Ssl(_);
Methods
impl Ssl
[src]
fn new(ctx: &SslContext) -> Result<Ssl, ErrorStack>
fn connect<S>(self, stream: S) -> Result<SslStream<S>, HandshakeError<S>> where S: Read + Write
Creates an SSL/TLS client operating over the provided stream.
Warning
OpenSSL's default configuration is insecure. It is highly recommended to use
SslConnector
rather than Ssl
directly, as it manages that configuration.
fn accept<S>(self, stream: S) -> Result<SslStream<S>, HandshakeError<S>> where S: Read + Write
Creates an SSL/TLS server operating over the provided stream.
Warning
OpenSSL's default configuration is insecure. It is highly recommended to use
SslAcceptor
rather than Ssl
directly, as it manages that configuration.
Methods from Deref<Target=SslRef>
fn set_verify(&mut self, mode: SslVerifyMode)
Sets the verification mode to be used during the handshake process.
Use set_verify_callback
to additionally add a callback.
fn set_verify_callback<F>(&mut self, mode: SslVerifyMode, verify: F) where F: Fn(bool, &X509StoreContextRef) -> bool + Any + 'static + Sync + Send
Sets the certificate verification callback to be used during the handshake process.
The callback is provided with a boolean indicating if the
preveification process was successful, and an object providing access
to the certificate chain. It should return true
if the certificate
chain is valid and false
otherwise.
fn set_tmp_dh(&mut self, dh: &DhRef) -> Result<(), ErrorStack>
fn set_tmp_dh_callback<F>(&mut self, callback: F) where F: Fn(&mut SslRef, bool, u32) -> Result<Dh, ErrorStack> + Any + 'static + Sync + Send
fn set_tmp_ecdh(&mut self, key: &EcKeyRef) -> Result<(), ErrorStack>
fn current_cipher(&self) -> Option<&SslCipherRef>
fn state_string(&self) -> &'static str
fn state_string_long(&self) -> &'static str
fn set_hostname(&mut self, hostname: &str) -> Result<(), ErrorStack>
Sets the host name to be used with SNI (Server Name Indication).
fn peer_certificate(&self) -> Option<X509>
Returns the certificate of the peer, if present.
fn certificate(&self) -> Option<&X509Ref>
Returns the certificate associated with this Ssl
, if present.
fn private_key(&self) -> Option<&PKeyRef>
Returns the private key associated with this Ssl
, if present.
fn version(&self) -> &'static str
Returns the name of the protocol used for the connection, e.g. "TLSv1.2", "SSLv3", etc.
fn selected_npn_protocol(&self) -> Option<&[u8]>
Returns the protocol selected by performing Next Protocol Negotiation, if any.
The protocol's name is returned is an opaque sequence of bytes. It is up to the client to interpret it.
fn pending(&self) -> usize
Returns the number of bytes remaining in the currently processed TLS record.
fn compression(&self) -> Option<&str>
Returns the compression currently in use.
The result will be either None, indicating no compression is in use, or a string with the compression name.
fn servername(&self) -> Option<&str>
Returns the server's name for the current connection
fn set_ssl_context(&mut self, ctx: &SslContextRef) -> Result<(), ErrorStack>
Changes the context corresponding to the current connection.
fn ssl_context(&self) -> &SslContextRef
Returns the context corresponding to the current connection
fn verify_result(&self) -> Option<X509VerifyError>
Returns the result of X509 certificate verification.
Trait Implementations
impl OpenSslType for Ssl
[src]
type CType = SSL
The raw C type.
type Ref = SslRef
The type representing a reference to this type.
unsafe fn from_ptr(ptr: *mut SSL) -> Ssl
Constructs an instance of this type from its raw type.
impl Drop for Ssl
[src]
impl Deref for Ssl
[src]
type Target = SslRef
The resulting type after dereferencing
fn deref(&self) -> &SslRef
The method called to dereference a value