struct TicketSwitcher {
    generator: fn() -> Result<Box<dyn ProducesTickets>, GetRandomFailed>,
    lifetime: u32,
    state: Mutex<TicketSwitcherState>,
}
Expand description

A ticketer that has a ‘current’ sub-ticketer and a single ‘previous’ ticketer. It creates a new ticketer every so often, demoting the current ticketer.

Fields§

§generator: fn() -> Result<Box<dyn ProducesTickets>, GetRandomFailed>§lifetime: u32§state: Mutex<TicketSwitcherState>

Implementations§

lifetime is in seconds, and is how long the current ticketer is used to generate new tickets. Tickets are accepted for no longer than twice this duration. generator produces a new ProducesTickets implementation.

If it’s time, demote the current ticketer to previous (so it does no new encryptions but can do decryption) and use next for a new current ticketer.

Calling this regularly will ensure timely key erasure. Otherwise, key erasure will be delayed until the next encrypt/decrypt call.

For efficiency, this is also responsible for locking the state mutex and returning the mutexguard.

Trait Implementations§

Returns the lifetime in seconds of tickets produced now. The lifetime is provided as a hint to clients that the ticket will not be useful after the given time. Read more
Returns true if this implementation will encrypt/decrypt tickets. Should return false if this is a dummy implementation: the server will not send the SessionTicket extension and will not call the other functions.
Encrypt and authenticate plain, returning the resulting ticket. Return None if plain cannot be encrypted for some reason: an empty ticket will be sent and the connection will continue.
Decrypt cipher, validating its authenticity protection and recovering the plaintext. cipher is fully attacker controlled, so this decryption must be side-channel free, panic-proof, and otherwise bullet-proof. If the decryption fails, return None.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The Resulting [TupleList], of an [Prepend::prepend()] call, including the prepended entry.
Prepend a value to this tuple, returning a new tuple with prepended value.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.