Path: redb-route/redb.Route.As4/Mime/EnvelopeLimits.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.As4/Mime/EnvelopeLimits.cs ---- using redb.Route.Core; namespace redb.Route.As4.Mime; /// /// The structure an AS4 envelope may have, received or answered: tighter than , /// because an eDelivery envelope is shallow and narrow whoever builds it. Measured on 3 000 envelopes of Holodeck B2B /// 8.1, Domibus 5 (Harmony 2.6) and this connector, messages and signals alike: at most 10 levels deep, 8 attributes /// and 8 namespace declarations on an element, 24 namespace declarations in the envelope. The limits keep two to four /// times that; namespace declarations count as attributes, so their own limit sits below the attribute limit. The whole /// envelope may declare far more, for messages with many payloads (each adds its references and encryption elements). /// The size is the endpoint's maxEnvelopeCharacters. /// /// They are the profile's shape, not a deployment setting: an envelope over them is not one any eDelivery access point /// sends, and it is refused before canonicalization or a signature check spends anything on it. /// /// internal static class EnvelopeLimits { /// Nesting depth of the envelope's elements. internal const int MaxDepth = 32; /// Attributes on one element, namespace declarations included. internal const int MaxAttributesPerElement = 32; /// Namespace declarations on one element. internal const int MaxNamespaceDeclarationsPerElement = 16; /// Namespace declarations in the whole envelope. internal const int MaxNamespaceDeclarations = 4096; /// The limits of an envelope of at most characters. internal static XmlLimits For(long maxEnvelopeCharacters) => new() { MaxDepth = MaxDepth, MaxAttributesPerElement = MaxAttributesPerElement, MaxNamespaceDeclarationsPerElement = MaxNamespaceDeclarationsPerElement, MaxNamespaceDeclarations = MaxNamespaceDeclarations, MaxCharacters = maxEnvelopeCharacters, }; }