pub trait MayBeTls: Unpin + AsyncRead + AsyncWrite + Sync + Send {
fn enable_encryption(
&mut self,
upgrade: Box<dyn TlsUpgrade + 'static, Global>,
name: String
);
fn encrypt(self: Pin<&mut Self>);
fn can_encrypt(&self) -> bool;
fn is_encrypted(&self) -> bool;
}
Expand description
A stream implementing this trait may be able to upgrade to TLS But maybe not…
Required methods
fn enable_encryption(
&mut self,
upgrade: Box<dyn TlsUpgrade + 'static, Global>,
name: String
)
Initiates the TLS negotiations. The stream must then block all reads/writes until the underlying TLS handshake is done. If it is not possible to encrypt and subsequent reads/writes must fail.
fn can_encrypt(&self) -> bool
fn can_encrypt(&self) -> bool
Returns true only if calling encrypt would make sense:
- required encryption setup information is available.
- the stream is not encrypted yet.
fn is_encrypted(&self) -> bool
fn is_encrypted(&self) -> bool
Returns true if the stream is already encrypted.