Skip to main content

ClientSessionStore

Trait ClientSessionStore 

Source
pub trait ClientSessionStore:
    Debug
    + Send
    + Sync {
    // Required methods
    fn set_kx_hint(&self, key: ClientSessionKey<'static>, group: NamedGroup);
    fn kx_hint(&self, key: &ClientSessionKey<'_>) -> Option<NamedGroup>;
    fn set_tls12_session(
        &self,
        key: ClientSessionKey<'static>,
        value: Tls12Session,
    );
    fn tls12_session(&self, key: &ClientSessionKey<'_>) -> Option<Tls12Session>;
    fn remove_tls12_session(&self, key: &ClientSessionKey<'static>);
    fn insert_tls13_ticket(
        &self,
        key: ClientSessionKey<'static>,
        value: Tls13Session,
    );
    fn take_tls13_ticket(
        &self,
        key: &ClientSessionKey<'static>,
    ) -> Option<Tls13Session>;
}
Expand description

Client session data store for possible future resumption.

All data in this interface should be treated as highly sensitive, containing enough key material to break all security of the corresponding session.

set_, insert_, remove_ and take_ operations are mutating; this isn’t expressed in the type system to allow implementations freedom in how to achieve interior mutability. Mutex is a common choice.

Required Methods§

Source

fn set_kx_hint(&self, key: ClientSessionKey<'static>, group: NamedGroup)

Remember what NamedGroup the given server chose.

Source

fn kx_hint(&self, key: &ClientSessionKey<'_>) -> Option<NamedGroup>

Value most recently passed to set_kx_hint for the given key.

If None is returned, the caller chooses the first configured group, and an extra round trip might happen if that choice is unsatisfactory to the server.

Source

fn set_tls12_session(&self, key: ClientSessionKey<'static>, value: Tls12Session)

Remember a TLS1.2 session, allowing resumption of this connection in the future.

At most one of these per session key can be remembered at a time.

Source

fn tls12_session(&self, key: &ClientSessionKey<'_>) -> Option<Tls12Session>

Get the most recently saved TLS1.2 session for key provided to set_tls12_session.

Source

fn remove_tls12_session(&self, key: &ClientSessionKey<'static>)

Remove and forget any saved TLS1.2 session for key.

Source

fn insert_tls13_ticket( &self, key: ClientSessionKey<'static>, value: Tls13Session, )

Remember a TLS1.3 ticket, allowing resumption of this connection in the future.

This can be called multiple times for a given session, allowing multiple independent tickets to be valid at once. The number of times this is called is controlled by the server, so implementations of this trait should apply a reasonable bound of how many items are stored simultaneously.

Source

fn take_tls13_ticket( &self, key: &ClientSessionKey<'static>, ) -> Option<Tls13Session>

Return a TLS1.3 ticket previously provided to insert_tls13_ticket().

Implementations of this trait must return each value provided to insert_tls13_ticket() at most once.

Implementors§