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>
impl<'a> ClientPskContextBuilder<'a>
Sourcepub fn new(psk: PskKey<'a>) -> Self
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.
Sourcepub fn key_provider(
self,
key_provider: impl ClientPskHintKeyProvider<'a> + 'a,
) -> Self
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.
Sourcepub fn build(self) -> ClientPskContext<'a>
pub fn build(self) -> ClientPskContext<'a>
Consumes this builder to construct the resulting PSK context.
Source§impl ClientPskContextBuilder<'_>
impl ClientPskContextBuilder<'_>
Sourcepub fn ec_jpake(self, ec_jpake: bool) -> Self
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.
Sourcepub fn client_sni<T: Into<Vec<u8>>>(
self,
client_sni: T,
) -> Result<Self, NulError>
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.