sign xml file with FIRMAXADESNET

Carlos Da Luz Paiva Tavares 1 Reputation point
2022-07-12T16:54:28.137+00:00

I AM SIGNING AN XML FILE WITH THE NUGET FIRMAXADESNET PACKAGE, SO WHEN I GO TO VALIDATE THE ERROR OF IT WAS NOT POSSIBLE TO VALIDATE/EXTEND THE SIGNATURE. REFERENCE '#SIGNEDPROPERTIES-SIGNATURE-7DAFA379-4D0D-419E-8E9E-2154627C9BA3' CANNOT BE VALIDATED. my code:
private void Assign(X509Certificate2 cCertUtil, string nomeFileXml, XmlDocument xml)
{
XadesService xadesService = new XadesService(); SignatureParameters parametri = new SignatureParameters(); parametri.SignaturePolicyInfo.PolicyDigestAlgorithm = FirmaXadesNet.Crypto.DigestMethod.SHA256; parametri.SignatureMethod = SignatureMethod.RSAwithSHA256; parametri.DigestMethod = FirmaXadesNet.Crypto.DigestMethod.SHA256; parametri.SigningDate = DateTime.Now; parametri.SignaturePackaging = SignaturePackaging.ENVELOPED; using (parametri.Signer = new Signer(cCertUtil)) { using (FileStream fs = new FileStream(nomeFileXml, FileMode.Open)) { var xml1 = xadesService.Sign(fs, parametri); xml = xml1.Document; } } xml.Save(UID);
}

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,010 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.