Struct network::noise::handshake::AntiReplayTimestamps[][src]

pub struct AntiReplayTimestamps(_);
Expand description

In a mutually authenticated network, a client message is accompanied with a timestamp. This is in order to prevent replay attacks, where the attacker does not know the client’s static key, but can still replay a handshake message in order to force a peer into performing a few Diffie-Hellman key exchange operations.

Thus, to prevent replay attacks a responder will always check if the timestamp is strictly increasing, effectively considering it as a stateful counter.

If the client timestamp has been seen before, or is not strictly increasing, we can abort the handshake early and avoid heavy Diffie-Hellman computations. If the client timestamp is valid, we store it.

Implementations

The timestamp is sent as a payload, so that it is encrypted. Note that a millisecond value is a 16-byte value in rust, but as we use it to store a duration since UNIX_EPOCH we will never use more than 8 bytes.

obtain the current timestamp

Returns true if the timestamp has already been observed for this peer or if it’s an old timestamp

Stores the timestamp

Trait Implementations

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

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

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

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.