a Secarta project ...

HTTPsec Authentication Protocol


Preamble

4.10. count

The count directive is a sequence counter for continuation messages. This directive allows the detection of message replays and provides partial message sequence integrity. It is also required for the production of unique initialization vectors for message body ciphering.

The value of the count directive is a decimal number. In a request, it MUST be greater than zero and less than (2^128 - 1). In a response, it MUST be greater than one and less than or equal to (2^128 - 1).

The following constraints apply to this directive in continuation messages containing identical token directive values. Messages with identical or out-of-sequence count directive values MUST be rejected by the receiving peer. Peers MUST validate the count directive in each received message to establish uniqueness and correct sequence. Each peer is required to maintain a local record of the value of the count directive employed in the last continuation message that it sent. The validity constraints and logic for setting this directive differ slightly from the perspectives of the two peers:

requester's perspective:
A received response MUST have a count value of N+1, where N is the count value in the associated request.
requester's perspective:
A received request's count value N MUST be strictly greater than the count value that the responder sent in its last response. The response MUST be given a count value of N+1.

If a first request receives no response, the count directive in a second request that immediately follows should increment by (at least) 2, to allow for the fact that the unreceived response was nevertheless sent by the responder. In the case that the first request contained an "Expect: 100-continue" header [HTTP][14.20] the increment should be (at least) 3, as such requests may elicit two distinct responses.