pub struct ClientSequence<K> { /* private fields */ }
Available on crate feature tsig only.
Expand description

TSIG client sequence state.

This type allows a client to create a signed request and later check a series of answers for being signed accordingly. It is necessary because the signatures in the second and later answers in the sequence are generated in a different way than the first one.

Much like with ClientTransaction, you can sign a request via the request method provding the signing key and receiving the signed version of the message and a client transaction value. You can then use this value to validate a sequence of answers as they are received by giving them to the answer method.

Once you have received the last answer, you call the done method to check whether the sequence was allowed to end. This is necessary because TSIG allows intermediary messages to be unsigned but demands the last message to be signed.

Implementations

Creates a sequence for a request.

The function will sign the message as it has been built so far using the given key and add a corresponding TSIG record to it. If this fails because there wasn’t enough space left in the message builder, returns the builder untouched as the error case. Otherwise, it will freeze the message and return both it and a new value of a client sequence.

Creates a sequence for a request with a specific fudge.

This is almost identical to request but allows you to explicitely specify a value of fudge which describes the number of seconds the recipients clock may differ from this system’s current time when checking the request. The default value used by request is 300 seconds.

Validates an answer.

If the answer contains exactly one TSIG record as its last record, removes this record and checks that it correctly signs this message as part of the sequence.

If it doesn’t or if there had been more than 99 unsigned messages in the sequence since the last signed one, returns an error.

Validates the end of the sequence.

Specifically, this checks that the last message given to answer had been signed.

Returns a reference to the transaction’s key.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. 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

Returns the argument unchanged.

Calls U::from(self).

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

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

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.