Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

StreamSec.Quic.KeyUpdate

Feature notes: Asynchronous QUIC server and HTTP/3 component

Classes, interfaces and records

recordtQuicKeyDirection

Cipher: tQuicPacketCipher; Hash: tHashClass; Secret, NextSecret, HeaderKey: TBytes; Current, Next: tQuicPacketProtection;

classtQuicKeyUpdate

One externally serialized instance serves both 1-RTT directions. It owns independent secrets and a bounded current/next/previous receive-key set. The original header keys survive packet-key updates. Input arrays are shared read-only; successful output arrays are independent.

Times are monotone microseconds. SetContext precedes packet operations. PacketSent is only for successful UDP transmission. AcknowledgmentReceived requires ACK ranges already checked against the complete sent history. The first local update also requires a current-phase ACK. Subsequent local updates wait three PTO after confirmation and previous read-key expiry. Failed authentication never derives keys or promotes a key phase.

Optional limits may only reduce RFC 9001 limits. Zero selects the standard bound; a nonzero bound of at least two leaves one encryption for closing. No TLS KeyUpdate handshake message is generated or consumed here.

constructor Create(aVersion: Cardinal; aConfidentialityLimit: UInt64 = 0; aIntegrityLimit: UInt64 = 0); destructor Destroy; override; procedure Clear;
Permanently discards packet keys while retaining counters for diagnostics. A discarded instance cannot be installed with fresh traffic secrets.
procedure Install(aIncoming: Boolean; aCipher: tQuicPacketCipher; aHash: tHashClass; const aSecret: TBytes); function HasKeys(aIncoming: Boolean): Boolean;
Returns True if fDirections[aIncoming].Current does not equal nil; otherwise False.
procedure SetContext(aNowMicros, aPtoMicros: UInt64; aHandshakeConfirmed: Boolean); procedure Tick(aNowMicros: UInt64); function NextDeadline(out aDeadline: UInt64): Boolean; function Initiate: Boolean; function Seal(const aHeader, aPayload: TBytes; aPacketNumber: UInt64; aPacketNumberOffset: Integer): TBytes; function SealMayUpdate: Boolean;
Whether the next Seal may change the write key phase: the current key is one packet short of its confidentiality limit. PacketSent accepts only packets of the current phase, so a caller that reports several sealed packets later seals no further packet while this holds.
function Open(const aPacket: TBytes; aPacketNumberOffset: Integer; aExpectedPacketNumber: UInt64; out aHeader, aPayload: TBytes; out aPacketNumber: UInt64): Boolean;
Failure explicitly clears both arrays and packet number. Receive keys and sending phase change only after authentication. Frame validation and receive-number/replay bookkeeping remain the transport's work.
procedure PacketSent(aPacketNumber: UInt64; const aPayload: TBytes; aNowMicros: UInt64); procedure AcknowledgmentReceived(const aFrame: tQuicFrame); procedure FailedAuthentication;
The bridge reports failed Initial/Handshake authentication here once per packet actually submitted to AEAD. Failures never reset on update.
property ReadGeneration: UInt64 read fReadGeneration; property WriteGeneration: UInt64 read fWriteGeneration; property AuthenticationFailures: UInt64 read fAuthenticationFailures; property PreviousKeysRetained: Boolean read fHasPreviousDeadline; property IntegrityExhausted: Boolean read fIntegrityExhausted;

Routines