Struct openssl::ssl::SslOptions
source · pub struct SslOptions { /* private fields */ }
Expand description
Options controlling the behavior of an SslContext
.
Implementations§
source§impl SslOptions
impl SslOptions
sourcepub const DONT_INSERT_EMPTY_FRAGMENTS: Self = _
pub const DONT_INSERT_EMPTY_FRAGMENTS: Self = _
Disables a countermeasure against an SSLv3/TLSv1.0 vulnerability affecting CBC ciphers.
sourcepub const ALL: Self = _
pub const ALL: Self = _
A “reasonable default” set of options which enables compatibility flags.
sourcepub const NO_QUERY_MTU: Self = _
pub const NO_QUERY_MTU: Self = _
Do not query the MTU.
Only affects DTLS connections.
sourcepub const COOKIE_EXCHANGE: Self = _
pub const COOKIE_EXCHANGE: Self = _
Enables Cookie Exchange as described in RFC 4347 Section 4.2.1.
Only affects DTLS connections.
sourcepub const NO_SESSION_RESUMPTION_ON_RENEGOTIATION: Self = _
pub const NO_SESSION_RESUMPTION_ON_RENEGOTIATION: Self = _
Always start a new session when performing a renegotiation on the server side.
sourcepub const NO_COMPRESSION: Self = _
pub const NO_COMPRESSION: Self = _
Disables the use of TLS compression.
sourcepub const ALLOW_UNSAFE_LEGACY_RENEGOTIATION: Self = _
pub const ALLOW_UNSAFE_LEGACY_RENEGOTIATION: Self = _
Allow legacy insecure renegotiation with servers or clients that do not support secure renegotiation.
sourcepub const SINGLE_ECDH_USE: Self = _
pub const SINGLE_ECDH_USE: Self = _
Creates a new key for each session when using ECDHE.
This is always enabled in OpenSSL 1.1.0.
sourcepub const SINGLE_DH_USE: Self = _
pub const SINGLE_DH_USE: Self = _
Creates a new key for each session when using DHE.
This is always enabled in OpenSSL 1.1.0.
sourcepub const CIPHER_SERVER_PREFERENCE: Self = _
pub const CIPHER_SERVER_PREFERENCE: Self = _
Use the server’s preferences rather than the client’s when selecting a cipher.
This has no effect on the client side.
sourcepub const TLS_ROLLBACK_BUG: Self = _
pub const TLS_ROLLBACK_BUG: Self = _
Disables version rollback attach detection.
sourcepub const NO_TLSV1_1: Self = _
pub const NO_TLSV1_1: Self = _
Disables the use of TLSv1.1.
sourcepub const NO_TLSV1_2: Self = _
pub const NO_TLSV1_2: Self = _
Disables the use of TLSv1.2.
sourcepub const NO_TLSV1_3: Self = _
pub const NO_TLSV1_3: Self = _
Disables the use of TLSv1.3.
Requires OpenSSL 1.1.1 or LibreSSL 3.4.0 or newer.
sourcepub const NO_DTLSV1: Self = _
pub const NO_DTLSV1: Self = _
Disables the use of DTLSv1.0
Requires OpenSSL 1.0.2 or LibreSSL 3.3.2 or newer.
sourcepub const NO_DTLSV1_2: Self = _
pub const NO_DTLSV1_2: Self = _
Disables the use of DTLSv1.2.
Requires OpenSSL 1.0.2 or LibreSSL 3.3.2 or newer.
sourcepub const NO_SSL_MASK: Self = _
pub const NO_SSL_MASK: Self = _
Disables the use of all (D)TLS protocol versions.
This can be used as a mask when whitelisting protocol versions.
Requires OpenSSL 1.0.2 or newer.
Examples
Only support TLSv1.2:
use openssl::ssl::SslOptions;
let options = SslOptions::NO_SSL_MASK & !SslOptions::NO_TLSV1_2;
sourcepub const NO_RENEGOTIATION: Self = _
pub const NO_RENEGOTIATION: Self = _
Disallow all renegotiation in TLSv1.2 and earlier.
Requires OpenSSL 1.1.0h or newer.
sourcepub const ENABLE_MIDDLEBOX_COMPAT: Self = _
pub const ENABLE_MIDDLEBOX_COMPAT: Self = _
Enable TLSv1.3 Compatibility mode.
Requires OpenSSL 1.1.1 or newer. This is on by default in 1.1.1, but a future version may have this disabled by default.
sourcepub const PRIORITIZE_CHACHA: Self = _
pub const PRIORITIZE_CHACHA: Self = _
Prioritize ChaCha ciphers when preferred by clients.
Temporarily reprioritize ChaCha20-Poly1305 ciphers to the top of the server cipher list if a ChaCha20-Poly1305 cipher is at the top of the client cipher list. This helps those clients (e.g. mobile) use ChaCha20-Poly1305 if that cipher is anywhere in the server cipher list; but still allows other clients to use AES and other ciphers.
Requires enable SslOptions::CIPHER_SERVER_PREFERENCE
.
Requires OpenSSL 1.1.1 or newer.
sourcepub const fn from_bits(bits: u64) -> Option<Self>
pub const fn from_bits(bits: u64) -> Option<Self>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
sourcepub const fn from_bits_truncate(bits: u64) -> Self
pub const fn from_bits_truncate(bits: u64) -> Self
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
sourcepub const unsafe fn from_bits_unchecked(bits: u64) -> Self
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self
Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
Safety
The caller of the bitflags!
macro can chose to allow or
disallow extra bits for their bitflags type.
The caller of from_bits_unchecked()
has to ensure that
all bits correspond to a defined flag or that extra bits
are valid for this bitflags type.
sourcepub const fn intersects(&self, other: Self) -> bool
pub const fn intersects(&self, other: Self) -> bool
Returns true
if there are flags common to both self
and other
.
sourcepub const fn contains(&self, other: Self) -> bool
pub const fn contains(&self, other: Self) -> bool
Returns true
if all of the flags in other
are contained within self
.
sourcepub fn set(&mut self, other: Self, value: bool)
pub fn set(&mut self, other: Self, value: bool)
Inserts or removes the specified flags depending on the passed value.
sourcepub const fn intersection(self, other: Self) -> Self
pub const fn intersection(self, other: Self) -> Self
Returns the intersection between the flags in self
and
other
.
Specifically, the returned set contains only the flags which are
present in both self
and other
.
This is equivalent to using the &
operator (e.g.
ops::BitAnd
), as in flags & other
.
sourcepub const fn union(self, other: Self) -> Self
pub const fn union(self, other: Self) -> Self
Returns the union of between the flags in self
and other
.
Specifically, the returned set contains all flags which are
present in either self
or other
, including any which are
present in both (see Self::symmetric_difference
if that
is undesirable).
This is equivalent to using the |
operator (e.g.
ops::BitOr
), as in flags | other
.
sourcepub const fn difference(self, other: Self) -> Self
pub const fn difference(self, other: Self) -> Self
Returns the difference between the flags in self
and other
.
Specifically, the returned set contains all flags present in
self
, except for the ones present in other
.
It is also conceptually equivalent to the “bit-clear” operation:
flags & !other
(and this syntax is also supported).
This is equivalent to using the -
operator (e.g.
ops::Sub
), as in flags - other
.
sourcepub const fn symmetric_difference(self, other: Self) -> Self
pub const fn symmetric_difference(self, other: Self) -> Self
Returns the symmetric difference between the flags
in self
and other
.
Specifically, the returned set contains the flags present which
are present in self
or other
, but that are not present in
both. Equivalently, it contains the flags present in exactly
one of the sets self
and other
.
This is equivalent to using the ^
operator (e.g.
ops::BitXor
), as in flags ^ other
.
sourcepub const fn complement(self) -> Self
pub const fn complement(self) -> Self
Returns the complement of this set of flags.
Specifically, the returned set contains all the flags which are
not set in self
, but which are allowed for this type.
Alternatively, it can be thought of as the set difference
between Self::all()
and self
(e.g. Self::all() - self
)
This is equivalent to using the !
operator (e.g.
ops::Not
), as in !flags
.
Trait Implementations§
source§impl Binary for SslOptions
impl Binary for SslOptions
source§impl BitAnd<SslOptions> for SslOptions
impl BitAnd<SslOptions> for SslOptions
source§impl BitAndAssign<SslOptions> for SslOptions
impl BitAndAssign<SslOptions> for SslOptions
source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
Disables all flags disabled in the set.
source§impl BitOr<SslOptions> for SslOptions
impl BitOr<SslOptions> for SslOptions
source§fn bitor(self, other: SslOptions) -> Self
fn bitor(self, other: SslOptions) -> Self
Returns the union of the two sets of flags.
§type Output = SslOptions
type Output = SslOptions
|
operator.source§impl BitOrAssign<SslOptions> for SslOptions
impl BitOrAssign<SslOptions> for SslOptions
source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
Adds the set of flags.
source§impl BitXor<SslOptions> for SslOptions
impl BitXor<SslOptions> for SslOptions
source§impl BitXorAssign<SslOptions> for SslOptions
impl BitXorAssign<SslOptions> for SslOptions
source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
Toggles the set of flags.
source§impl Clone for SslOptions
impl Clone for SslOptions
source§fn clone(&self) -> SslOptions
fn clone(&self) -> SslOptions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SslOptions
impl Debug for SslOptions
source§impl Extend<SslOptions> for SslOptions
impl Extend<SslOptions> for SslOptions
source§fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl FromIterator<SslOptions> for SslOptions
impl FromIterator<SslOptions> for SslOptions
source§fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
source§impl Hash for SslOptions
impl Hash for SslOptions
source§impl LowerHex for SslOptions
impl LowerHex for SslOptions
source§impl Not for SslOptions
impl Not for SslOptions
source§impl Octal for SslOptions
impl Octal for SslOptions
source§impl Ord for SslOptions
impl Ord for SslOptions
source§fn cmp(&self, other: &SslOptions) -> Ordering
fn cmp(&self, other: &SslOptions) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<SslOptions> for SslOptions
impl PartialEq<SslOptions> for SslOptions
source§fn eq(&self, other: &SslOptions) -> bool
fn eq(&self, other: &SslOptions) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<SslOptions> for SslOptions
impl PartialOrd<SslOptions> for SslOptions
source§fn partial_cmp(&self, other: &SslOptions) -> Option<Ordering>
fn partial_cmp(&self, other: &SslOptions) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Sub<SslOptions> for SslOptions
impl Sub<SslOptions> for SslOptions
source§impl SubAssign<SslOptions> for SslOptions
impl SubAssign<SslOptions> for SslOptions
source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Disables all flags enabled in the set.