DCoding.Xml.Cryptography.Xml
1.0.1
dotnet add package DCoding.Xml.Cryptography.Xml --version 1.0.1
NuGet\Install-Package DCoding.Xml.Cryptography.Xml -Version 1.0.1
<PackageReference Include="DCoding.Xml.Cryptography.Xml" Version="1.0.1" />
<PackageVersion Include="DCoding.Xml.Cryptography.Xml" Version="1.0.1" />
<PackageReference Include="DCoding.Xml.Cryptography.Xml" />
paket add DCoding.Xml.Cryptography.Xml --version 1.0.1
#r "nuget: DCoding.Xml.Cryptography.Xml, 1.0.1"
#:package DCoding.Xml.Cryptography.Xml@1.0.1
#addin nuget:?package=DCoding.Xml.Cryptography.Xml&version=1.0.1
#tool nuget:?package=DCoding.Xml.Cryptography.Xml&version=1.0.1
DCoding.Xml.Cryptography.Xml
V1.0 technical selection: Community, Professional. Declared assets/hosts: net8.0, net10.0, net11.0. See the current edition and API/runtime catalog for mode and host limits. Selection and retained development results do not replace final artifact qualification, the supplied license or human release approval.
DCoding.Xml.Cryptography.Xml is the optional integration package between the
DCoding XML processing stack and the platform System.Security.Cryptography.Xml
implementation. It keeps XML signature and encryption dependencies out of the
independent core packages.
The package declares .NET 8 and .NET 10 assets. It depends on the exact reviewed
System.Security.Cryptography.Xml 10.0.13 package and on the DCoding XPath,
XDM, and XSLT packages. The package contains adapters and policy integration;
it does not ship a second cryptographic implementation or cryptographic keys.
Supported public API
The adapter API contains five sealed types:
DCodingXmlDsigXPathTransformderives from the platformTransformcontract and retains the standard XMLDSIG XPath URI.DCodingXmlDsigXsltTransformderives from the platformTransformcontract and retains the standard XMLDSIG XSLT URI.XmlSecurityCanonicalOctetSignatureexplicitly signs already canonicalized EXI octets and a separately trusted frozen context receipt. The payload has no XML transform. The EXI method must be explicitly allowlisted; SignedInfo and the signed context retain official XML Exclusive C14N with RSA-SHA256 and SHA256 digests. No EXI dependency or algorithm registration is introduced. The receipt identifies parameters and never proves canonicalization or grants schema authority. Use the exact output of a successful canonical operation, verify against the caller's independently expected context, and decrypt sign-then-encrypt payloads to their original bytes before verifying them.XmlSecurityInputcreates immutable, opaque LINQ-to-XML snapshots through overloads forXDocument,XElement,XNode,XAttribute, and exact selected node sets rooted in one LINQ tree. Exact node sets expose aToXmlNodeList()XMLDSIG handoff that directly materializes fresh platform nodes without serialization, reparsing, or descendant expansion. Whole documents and exact node sets exposeCanonicalizeXml10(...),CanonicalizeXml11(...), andCanonicalizeExclusiveXml10(...)as explicit canonicalization operations with the bounded ownership described below.XmlSecurityTransformRegistrationis a caller-owned registration scope withRegisterXPathTransform(),RegisterXsltTransform(),CreateSigner(...),ComputeSignature(...),CreateVerifier(...), andCheckSignature(...), plus direct document/subtreeEncrypt...andDecrypt...methods for encryption alone and both paired signature/encryption orders. Its LINQ entry points consume immutableXmlSecurityInputdocument snapshots, return the exact platformSignedXmlsigner or verifier identity, and materialize a detached caller-ownedXElementsignature or fresh encrypted/decryptedXDocument/XElementresult without serialization or reparsing. Encrypted results use the exact platform AES-CBC URI and requested XML Encryption Element or Content mode; inverse workflows verify at the required stage before returning plaintext.
Each transform instance represents one mutable operation and is not safe for
concurrent use. A registration scope may create and verify independent
platform SignedXml instances concurrently after its first operation freezes
the selected policy. Caller-provided documents, streams, verifiers, and RSA
keys remain caller-owned; the adapter does not dispose them. Methods reject
null or unsupported inputs with the documented argument exceptions and reject
malformed, unsupported, or over-limit XML security work with
CryptographicException.
The NuGet package contains complete English XML documentation for every public
and protected declaration. Its separately reviewed net8.0 and net10.0
binary baselines contain the same 54 declarations and are validated against
the packed assemblies, not inferred from source text. These are historical
baseline checks; the appended net11.0 asset has its own current evidence.
Its internal XML-security handoff keeps raw transform octets byte-exact until an explicit secure document or fragment parse is requested. Caller streams remain open, including forward-only streams, and platform transform output is never implicitly canonicalized or re-encoded by the adapter.
DOM and navigator inputs are checked against their detached XDM projections.
Inherited namespace, base-URI, xml:lang, and xml:space context remains
available to canonicalization adapters even when the adopted input is an
element fragment whose source ancestors are no longer present.
DTD input remains prohibited on the ordinary octet-to-XML path. An internal adapter can opt in only with an explicit bounded DTD policy. That path supports internal defaults, entity-expanded text, and ID metadata while denying external DTD subsets, external parsed entities, ambient resolvers, and quota overruns. Its platform DOM is retained for canonicalization without an XDM serialization round trip.
Canonical XML 1.0 whole-document handoffs delegate byte production to the
platform XmlDsigC14NTransform variants. Exact node sets use a bounded internal
C14N 1.0 writer over the existing immutable XDM to preserve explicit namespace
membership and inherited XML context. Both comment modes are checked against
independent UTF-8 and digest literals; whole-document operations also retain
direct platform baselines. Selecting an element does not select its namespace
axis, attributes or descendants. A physical LINQ namespace declaration selects
its owner's namespace node, not inherited nodes on other elements. Canonical
subset output may therefore be non-well-formed. The public
CanonicalizeXml10(...) operation returns a fresh caller-owned byte array.
The internal path adds no public API or resolver authority and makes no general
NativeAOT or full-conformance claim.
Canonical XML 1.1 is an explicit capability boundary. On the pinned package,
neither C14N 1.1 URI has a public official transform type, a SignedXml
constant, or a CryptoConfig mapping. The production adapter inspects those
paths and fails closed with the exact URI and package version; it never labels
Canonical XML 1.0 output as 1.1 and contains no custom C14N 1.1 serializer.
CanonicalizeXml11(...) exposes that checked boundary and throws
PlatformNotSupportedException before transform execution on the pinned
package.
Exclusive Canonical XML delegates both standard comment modes and inclusive
namespace prefix lists to the platform XmlDsigExcC14NTransform. Whole-
document and exact node-set inputs retain detached XML-security semantics, and
the XPath-to-Exclusive-C14N chain is checked against committed UTF-8 and digest
baselines plus the matching direct platform transform chain.
CanonicalizeExclusiveXml10(...) passes the caller's inclusive-prefix list
directly to that official platform transform.
The canonical byte/digest evidence matrix crosses stream, DOM, navigator, and exact node-set inputs with all four supported canonicalization modes and the standard SHA-256, SHA-384, and SHA-512 digest URIs. Each row retains an exact content identity, algorithm URIs, canonical octets, and digest bytes that are reused directly by SignedXml reference verification tests.
Enveloped XML signatures use platform SignedXml end to end. The internal
adapter signs document or exact Id element targets with the official
enveloped and canonicalization transforms, preserves whitespace across DOM,
stream, and navigator round trips, and requires an unambiguous same-document
reference before accepting the platform cryptographic verification result.
Source, digest, SignedInfo, and SignatureValue tampering are executable
negative cases; verification is never inferred from byte equality.
Detached XML signatures support exact same-document #Id fragments and
caller-authorized external resources. External bytes come only from the
bounded in-memory resource resolver: every receipt binds the requested URI,
trusted base URI, effective URI, resolution depth, byte limit, actual length,
SHA-256 content identity, and media type. The adapter uses the official
canonicalization transforms plus platform hash and RSA operations while
denying ambient current-directory, credential, file, and network resolution.
Unregistered, changed, ambiguous, or structurally substituted references fail
closed.
Multi-reference XML signatures combine ordered same-document and explicitly
resolved external references with one nested XMLDSIG Manifest. Every direct
and Manifest-member digest is recomputed independently, while the signed
SignedInfo preserves reference order. Conventional Id, id, and ID
attributes and xml:id share one global uniqueness check, so duplicate IDs,
wrapping substitutions, one-resource changes, and nested Manifest tampering
fail deterministically. External Manifest members use the same bounded
in-memory resolver and carry the same auditable receipts as detached
references; ambient file and network resolution remains denied.
The bounded SignedXml failure boundary verifies explicit-key, same-document signatures without exposing platform exception messages or partial trusted output. Valid strong-algorithm signatures retain an accepted snapshot; changed source data, digest values, signature values, and wrong keys all map to one non-oracular cryptographic-mismatch diagnostic. Malformed SignedInfo, duplicate references, unknown algorithms or transforms, invalid Base64, ambiguous IDs, wrapping, external/file/network URIs, and structure or size limits have separate stable diagnostics. Any safe platform rejection is reduced to its exception type, and the caller DOM remains unchanged.
The signature/encryption workflow boundary supports both authorized operation
orders over complete-document and exact Id element scopes. Sign-then-encrypt
decrypts before verifying its hidden plaintext signature; encrypt-then-sign
verifies the visible ciphertext signature before decrypting. Both paths use
bounded inline AES content encryption, RSA-SHA256, SHA-256, and official
enveloped plus Exclusive Canonical XML transforms. Wrong ordering and changes
to ciphertext, signed plaintext, signature values, reference digests, or keys
fail without returning plaintext or mutating caller state.
The bounded EncryptedXml failure boundary accepts one strong-algorithm inline
cipher with an explicit operation-scoped AES KeyName. It classifies malformed
structure, parser attacks, limits, duplicate IDs, downgrade algorithms, wrong
modes, invalid or truncated cipher data, key confusion, and denied local,
recursive, file, or network references before platform decryption. Ciphertext
tamper and wrong same-size keys share one stable cryptographic-mismatch
diagnostic; invalid input never exposes plaintext or changes the caller DOM.
The deterministic adversarial corpus replays 20 fixed, uniquely seeded and single-mutation parser, XMLDSIG, and XMLENC cases. It covers structure, namespaces, IDs, URIs, algorithms, lengths, transform chains, XPath, XSLT, cipher values, and encodings without sampling. Hard case, input-byte, total-byte, per-case time, and total-time ceilings cannot be expanded. Every case must reach its exact fail-closed diagnostic without ambient access, trusted verification output, plaintext, a crash, or caller-state mutation.
The public LINQ routes apply the same hostile boundary before platform work.
Conventional Id, id, ID, and xml:id values must be globally unique and
an element cannot expose more than one of them. Malformed signature loading,
SHA-1 downgrade, external references, excessive transforms, over-limit input,
wrong or weak keys, cipher downgrade or key-size confusion, oversized inline
ciphertext, external CipherReference, existing encryption, and wrong workflow
order all fail closed. The isolated package-only consumer executes these LINQ
probes from the packed assets on both .NET 8 and .NET 10.
The machine-validated migration matrix separates no-change platform
SignedXml/EncryptedXml calls, the namespace/import-change XSLT compatibility
facade, explicit XPath/XSLT adapter registration, and framework-source-only
type-identity integration. Call
RegisterXPathTransform() or RegisterXsltTransform() on a new
XmlSecurityTransformRegistration, then create and check the platform
SignedXml signer or verifier through that caller-owned scope. The LINQ
signing and verification overloads require no registration for standard
platform transforms; DCoding XPath or XSLT adapters must be registered before
creating the operation. The earlier DOM verifier overload remains the explicit
registered-adapter route. Registration is idempotent,
freezes on first operation creation, preserves the standard URIs,
and changes neither CryptoConfig nor the process-wide SignedXml transform
allowlist. The
package-only .NET 8/.NET 10 consumer executes every advertised route. A NuGet
reference cannot redirect the framework-internal
System.Xml.Xsl.XslCompiledTransform type identity.
Trimming and NativeAOT
The v1.0 selection admits managed/source use only: this package declares
IsAotCompatible=false. Older development evidence contains a bounded .NET 10
linux-x64 Trim/NativeAOT experiment for selected algorithms; it does not
qualify the package for general native deployment. Public encryption and paired
signature/encryption methods carry RequiresUnreferencedCode: callers must preserve the platform
algorithm implementations selected by their payload. The application supplies
the roots and verifies its actual trimmed/native executable; these methods do
not grant general trimming compatibility to the entire optional package.
That historical bounded profile used
RSA-SHA256, SHA-256, AES-256-CBC, Exclusive Canonical XML, the DCoding XPath
adapter, and in-memory KeyName resolution. Both publish modes were exercised
as package-only consumers and must complete real signature verification and
decryption operations. This is not support for XML-selected platform XSLT:
that platform transform requires dynamic code and is excluded from the
NativeAOT profile.
The DOM CreateVerifier(...) overload and CheckSignature(...) expose the platform
RequiresUnreferencedCode and RequiresDynamicCode boundary to callers. A
trimmed or NativeAOT executable must explicitly preserve
System.Security.Cryptography.Xml and System.Security.Cryptography for the
platform algorithm factories. The reviewed consumer treats warnings as errors,
does not suppress IL warnings through NoWarn, and executes every preserved
algorithm route so a missing member or dynamic-code dependency cannot pass as
an analyzer-only claim. See m21-xml-security-trimming-nativeaot.md in the
repository documentation for the exact gate and support boundary.
The reviewed threat contract covers keys, algorithms, certificates, parsers,
resolvers, transforms, canonicalization, decrypted data, diagnostics, and
reusable state. Certificates provide signature keys only;
certificate-chain trust and revocation are not evaluated. Successful XML
signature verification therefore does not authenticate an identity. Every
package claim and explicit non-guarantee is mapped to production and executable
test locations in m21-xml-security-threat-model.md.
Public v1.0 availability requires its separate artifact and human release gates. See LICENSE.md, NOTICE.md, and THIRD-PARTY-NOTICES.md for the
current legal and provenance boundaries.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
-
net10.0
- DCoding.Xml.Xdm (>= 1.0.1)
- DCoding.Xml.XPath (>= 1.0.1)
- DCoding.Xml.Xslt (>= 1.0.1)
- System.Security.Cryptography.Xml (= 10.0.13)
-
net11.0
- DCoding.Xml.Xdm (>= 1.0.1)
- DCoding.Xml.XPath (>= 1.0.1)
- DCoding.Xml.Xslt (>= 1.0.1)
- System.Security.Cryptography.Xml (= 10.0.13)
-
net8.0
- DCoding.Xml.Xdm (>= 1.0.1)
- DCoding.Xml.XPath (>= 1.0.1)
- DCoding.Xml.Xslt (>= 1.0.1)
- System.Security.Cryptography.Xml (= 10.0.13)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1 | 51 | 11/20/2026 |
Stable 1.0.1: licensing and packaging correction delivery. Public APIs and edition rights are unchanged.