none
XML NF-e "The value of the 'Algorithm' attribute does not equal its fixed value" RRS feed

  • Pergunta

  • Bom dia, 

    Quando valido o schema do XML para manifestação do destinatário estou recebendo o erro:

    'The value of the 'Algorithm' attribute does not equal its fixed value'.

    Segue código que estou utilizando para assinar o XML:

    foreach (XmlNode no in xml.GetElementsByTagName("infEvento"))
                {
                    XmlDocument xmlToSign = new XmlDocument();
                    xmlToSign.LoadXml(no.OuterXml);
    
                    SignedXml docXML = new SignedXml(xmlToSign);
                    docXML.SigningKey = NFe_Rec.ClientCredentials.ClientCertificate.Certificate.PrivateKey;                
                    Reference refer = new Reference();
                    refer.Uri = "#" + no.Attributes["Id"].Value;
                    refer.AddTransform(new XmlDsigEnvelopedSignatureTransform());
                    refer.AddTransform(new XmlDsigC14NTransform());                
                    docXML.AddReference(refer);
    
                    KeyInfo ki = new KeyInfo();                
                    ki.AddClause(new KeyInfoX509Data(NFe_Rec.ClientCredentials.ClientCertificate.Certificate));
                    docXML.KeyInfo = ki;
    
                    docXML.ComputeSignature();
                    i++;                
                    xml.ChildNodes[1].ChildNodes[i].AppendChild(xml.ImportNode(docXML.GetXml(), true));
                }

    Como posso corrigir este problema?

    Grato,

    Renan Paiva


    sábado, 19 de janeiro de 2019 14:21