ReadonlychannelReadonlychunkReadonlycipherequal to plainBlockSize for symmetric encryption, larger for RSA
Readonlymaxthe largest body that fits one chunk
ReadonlymaxReadonlymaxReadonlyplain0 when the chunks are not encrypted
ReadonlysecurityReadonlysignatureReadonlytokenthe token of a symmetric writer, 0 for an asymmetric one
Static Readonlydefaultgrowth cap of the encode buffer when no maximum message size is negotiated
Static Readonlymaxthe largest encode buffer kept from one message to the next
Static Readonlyminimumfloor for the encode buffer, so tiny messages do not keep reallocating
encodes message once, writes it as one or more chunks and hands each chunk to send, in order,
before returning. Returns BadTcpMessageTooLarge and sends nothing when the message exceeds
maxMessageSize or maxChunkCount. A writer that signs asynchronously needs writeMessageAsync.
writeMessage for a signature produced asynchronously (a key held by a remote HSM/KMS
provider): the headers and sequence numbers of every chunk are written at once, in order; the
chunks are handed to send, in order, once all of them are signed and encrypted. A signing
failure rejects and sends nothing.
Staticcomputethe body one chunk carries: the formulas of ChunkManager, which the bytes on the wire depend on (with encryption, whole cipher blocks after the headers, less the sequence header, the signature and the padding size bytes)
Staticheaderthe size of the message header and of this security header
Staticsupportswhether a writer can chunk messages in this mode with these functions, the combinations the chunk managers accepted: no security; or a signer (synchronous or asynchronous, never both) with a signature length, or neither; and encryption that does not shrink the data, required by SignAndEncrypt and applied in Sign too when given (OpenSecureChannel is encrypted in both).
Chunks the messages of a secure channel (OPC 10000-6 6.7.2): the symmetric ones (MSG, CLO) of one token, and OpenSecureChannel with its asymmetric security header and RSA encryption. Everything that does not change between messages (chunk size, header layout, keys, block sizes, signature length, limits) is set once, and writing a message is one call, with no event and no per-message object besides the chunks.
The body is encoded once, after room left for the headers. Each chunk then gets its own buffer (the transport keeps it; the encode buffer serves the next message), its headers, its slice of the body, and, as the channel's security requires, its padding, signature and encryption. One chunk is the n = 1 case of the same loop.
A signature produced by a remote (HSM/KMS) provider is asynchronous: writeMessageAsync.