kmvi / bc-xml-security

XML Signature and XML Encryption using Bouncy Castle (C#)
MIT License
13 stars 9 forks source link

Support for "http://www.w3.org/2001/04/xmlenc#sha256" algorithm #1

Closed pdrvaz closed 5 years ago

pdrvaz commented 5 years ago

When I create a new Reference to set in SignedXml.AddReference(...), the default DigestValue of the Reference is SignedXml.XmlDsigSHA256Url that has the value "http://www.w3.org/2001/04/xmlenc#sha256".

Otherwise, the CryptoHelpers does not support this algorithm.

I suggest add this two lines lines to CryptoHelpers.CreateForName switch:

            case "http://www.w3.org/2001/04/xmlenc#sha256":
                return DigestUtilities.GetDigest("SHA-256");

In Brasil this algorithm is choosed for the comunication with the eSocial system (government controll of payment of the enterprises of social assurance of his workers).

Besides, the BouncyCastle 1.8.5 library does not support the GOST3411_2012_256Digest and GOST3411_2012_512Digest classes anymore. I don't khown if its replaced or deprecated.

This library is the best that I found for the job. Congratulations.

Thanks, Pedro Vaz

kmvi commented 5 years ago

http://www.w3.org/2001/04/xmlenc#sha256 means w3c xml encryption, which is not supported yet (only xml signature is supported). I'll see what I can do.

kmvi commented 5 years ago

Please check, it should work now

kmvi commented 5 years ago

I assume the problem is solved, so I close the issue.