Struct ClientPskContextBuilder

Source
pub struct ClientPskContextBuilder<'a> { /* private fields */ }
Expand description

Builder for a client-side DTLS encryption context for use with pre-shared keys (PSK).

Implementations§

Source§

impl<'a> ClientPskContextBuilder<'a>

Source

pub fn new(psk: PskKey<'a>) -> Self

Creates a new context builder with the given key as the default key to use.

§Implementation details (informative, not covered by semver guarantees)

Providing a raw public key will set psk_info to the provided key in the underlying [coap_dtls_cpsk_t] structure.

Source

pub fn key_provider( self, key_provider: impl ClientPskHintKeyProvider<'a> + 'a, ) -> Self

Sets the key provider that provides pre-shared keys based on the PSK hint received by the server.

§Implementation details (informative, not covered by semver guarantees)

Setting a key_provider will set the validate_ih_call_back of the underlying [coap_dtls_cpsk_t] to a wrapper function, which will then call the key provider.

Keys returned by the key provider will be stored in the context for at least as long as they are used by the respective session.

Source

pub fn build(self) -> ClientPskContext<'a>

Consumes this builder to construct the resulting PSK context.

Source§

impl ClientPskContextBuilder<'_>

Source

pub fn ec_jpake(self, ec_jpake: bool) -> Self

Enables or disables support for EC JPAKE (RFC 8236) key exchanges in (D)TLS.

Note: At the time of writing (based on libcoap 4.3.5), this is only supported on MbedTLS, enabling EC JPAKE on other DTLS backends has no effect.

§Implementation details (informative, not covered by semver guarantees)

Equivalent to setting ec_jpake in the underlying [coap_dtls_cpsk_t] structure.

Source

pub fn use_cid(self, use_cid: bool) -> Self

Enables or disables use of DTLS connection IDs (RFC 9146).

§Implementation details (informative, not covered by semver guarantees)

Equivalent to setting use_cid in the underlying [coap_dtls_cpsk_t] structure.

Source

pub fn client_sni<T: Into<Vec<u8>>>( self, client_sni: T, ) -> Result<Self, NulError>

Sets the server name indication that should be sent to servers if the built ClientPskContext is used.

client_sni should be convertible into a byte string that does not contain null bytes. Typically, you would provide a &str or String.

§Errors

Will return NulError if the provided byte string contains null bytes.

§Implementation details (informative, not covered by semver guarantees)

Equivalent to setting client_sni in the underlying [coap_dtls_cpsk_t] structure.

The provided client_sni will be converted into a Box<[u8]>, which will be owned and stored by the built context.

Trait Implementations§

Source§

impl<'a> Debug for ClientPskContextBuilder<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T