kmvi / bc-xml-security

XML Signature and XML Encryption using Bouncy Castle (C#)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

pdrvaz opened this issue · comments

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

commented

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.

commented

Please check, it should work now

commented

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