Struct embedded_tls::TlsConfig

source ·
pub struct TlsConfig<'a, CipherSuite>
where CipherSuite: TlsCipherSuite,
{ /* private fields */ }

Implementations§

source§

impl<'a, CipherSuite> TlsConfig<'a, CipherSuite>
where CipherSuite: TlsCipherSuite,

source

pub fn new() -> Self

source

pub fn enable_rsa_signatures(self) -> Self

Enable RSA ciphers even if they might not be supported.

source

pub fn with_server_name(self, server_name: &'a str) -> Self

source

pub fn with_max_fragment_length( self, max_fragment_length: MaxFragmentLength ) -> Self

Configures the maximum plaintext fragment size.

This option may help reduce memory size, as smaller fragment lengths require smaller read/write buffers. Note that embedded-tls does not currently use this option to fragment writes. Note that the buffers need to include some overhead over the configured fragment length.

From RFC 6066, Section 4. Maximum Fragment Length Negotiation:

Without this extension, TLS specifies a fixed maximum plaintext fragment length of 2^14 bytes. It may be desirable for constrained clients to negotiate a smaller maximum fragment length due to memory limitations or bandwidth limitations.

For example, if the negotiated length is 2^9=512, then, when using currently defined cipher suites ([…]) and null compression, the record-layer output can be at most 805 bytes: 5 bytes of headers, 512 bytes of application data, 256 bytes of padding, and 32 bytes of MAC.

source

pub fn reset_max_fragment_length(self) -> Self

Resets the max fragment length to 14 bits (16384).

source

pub fn with_ca(self, ca: Certificate<'a>) -> Self

source

pub fn with_cert(self, cert: Certificate<'a>) -> Self

source

pub fn with_psk(self, psk: &'a [u8], identities: &[&'a [u8]]) -> Self

Trait Implementations§

source§

impl<'a, CipherSuite> Debug for TlsConfig<'a, CipherSuite>
where CipherSuite: TlsCipherSuite + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, CipherSuite> Default for TlsConfig<'a, CipherSuite>
where CipherSuite: TlsCipherSuite,

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a, CipherSuite> RefUnwindSafe for TlsConfig<'a, CipherSuite>
where CipherSuite: RefUnwindSafe,

§

impl<'a, CipherSuite> Send for TlsConfig<'a, CipherSuite>
where CipherSuite: Send,

§

impl<'a, CipherSuite> Sync for TlsConfig<'a, CipherSuite>
where CipherSuite: Sync,

§

impl<'a, CipherSuite> Unpin for TlsConfig<'a, CipherSuite>
where CipherSuite: Unpin,

§

impl<'a, CipherSuite> UnwindSafe for TlsConfig<'a, CipherSuite>
where CipherSuite: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.