Closed bbecker100 closed 6 months ago
By looking at the Call Stack and further debugging, this line of code is returning a Null: (SignedXML.cs)
line 913:
Type type = Type.GetType(signatureDescription.KeyAlgorithm);
Here are the values in the signatureDescription:
signatureDescription.DeformatterAlgorithm = System.Security.Cryptography.RSAPKCS1SignatureDeformatter signatureDescription.DigestAlgorithm = System.Security.Cryptography.SHA1Managed signatureDescription.FormatterAlgorithm = System.Security.Cryptography.RSAPKCS1SignatureFormatter signatureDescription.KeyAlgorithm = System.Security.Cryptography.RSACryptoServiceProvider
Then the 'type' is sent to the IsKeyTheCorrectAlgorithm(), which causes the exception
Not sure why it can't determine the Type at runtime, that Type is referenced earlier in the project...
In the startup of the program, there were 2 Algorithms added as follows:
CryptoConfig.AddAlgorithm(typeof(Sha256SignatureDescription), SignedXml.XmlDsigRSASHA256Url); CryptoConfig.AddAlgorithm(typeof(Sha1SignatureDescription), SignedXml.XmlDsigRSASHA1Url);
We removed the RSASHA1Url (2nd item) and rebuilt and then things started working. We also moved everything to .Net 8.0 Framework along the way.
Hello,
We have a .Net Core on Framework 7.0 using Sustainsys.Saml2.AspNetCore2 version 2.9.2
It is hosted in an Azure Web App and a Azure B2c Tenant is also part of the solution. We have this solution running successfully with older versions of .Net and Sustainsys and are needing to replicate it, so we are trying to match everything as much as possible and don't have a lot of SAML experience.
With V.S. Remote debugging, we can see the Debug window and the following lines are seen. (The same Stack trace appears in Application Insights)
=============================================================== Sustainsys.Saml2.AspNetCore2.Saml2Handler: Information: Created metadata Sustainsys.Saml2.AspNetCore2.Saml2Handler: Information: Created metadata Sustainsys.Saml2.AspNetCore2.Saml2Handler: Information: Created metadata 'w3wp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App\7.0.13\Microsoft.AspNetCore.Diagnostics.Abstractions.dll'. 'w3wp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\7.0.13\System.Diagnostics.StackTrace.dll'. 'w3wp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\7.0.13\System.Reflection.Metadata.dll'. 'w3wp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\7.0.13\System.Collections.Immutable.dll'. Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware: Error: An unhandled exception has occurred while executing the request.
=============================================================
We tried to enable more debugging in the SignedXml library by adding some config items, shown below, but it doesn't seem to enable any additional logging.
=============================================================
=============================================================
Any suggestions on how to get more debugging info or other troubleshooting techniques?