Skip to content

MaxReferencesPerSignedInfo hard-coded to 100 in System.Security.Cryptography.Xml #123665

Description

@wikendu-th

We had an issue with XML Signing in a .NET Framework application on Windows (System.Security.Cryptography.CryptographicException:
Malformed element SignedInfo/Reference.
) and successfully used a workaround setting the registry key SignedXmlMaxReferencesPerSignedInfo:

After some setting up and debuging system libraries I found out where it throws the excpetion and apperantly by default it only allow 100 recipients. To change that, I needed to add a new registry key named "SignedXmlMaxReferencesPerSignedInfo" with DWord value to be greater than 145 in my case to "Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\Security" and it started working.

SignedXml.LoadXML((XmlElement)nodeList[0]) throwing "Malformed element SignedInfo/Reference"

We planned on migrating the application to .NET 10. But in we found that in .NET 10 the limit is hard-coded to 100 References, which would make it impossible to migrate while using System.Security.Cryptography.Xml.

Is it possible to make this limit configurable again?

Check located in SignedInfo.cs:
https://github.com/dotnet/runtime/blob/v10.0.2/src/libraries/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/SignedInfo.cs#L260

Limit defined in Utils.cs: https://github.com/dotnet/runtime/blob/v10.0.2/src/libraries/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Utils.cs#L763

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions