<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hello,<div><div>I've trying to sign a XML which already has a signed node.</div><div>I've already read the Faq Section and the other emails with the same subject, but this unfortunatelly didn't solve my problem.</div></div><div><br></div><div>The XML (node LoteRps) which I've been trying to sign is this (I'm a Brazilian, so the XML is in my home language):</div><div><br></div><div><div><font size="2"><!DOCTYPE test [<!ATTLIST LoteRps Id ID #IMPLIED>]></font></div><div><font size="2"> <GerarNfseEnvio xmlns="http://www.abrasf.org.br/nfse.xsd"></font></div><div><font size="2"> <LoteRps Id="133" versao="1.00"></font></div><div><font size="2"> <NumeroLote>133</NumeroLote></font></div><div><font size="2"> <Cnpj>04220031000100</Cnpj></font></div><div><font size="2"> <InscricaoMunicipal>25252525</InscricaoMunicipal></font></div><div><font size="2"> <QuantidadeRps>1</QuantidadeRps></font></div><div><font size="2"> <ListaRps></font></div><div><font size="2"> <Rps></font></div><div><font size="2"> <InfRps Id="1332"></font></div><div><font size="2"> <IdentificacaoRps></font></div><div><font size="2"> <Numero>133</Numero></font></div><div><font size="2"> <Serie>2</Serie></font></div><div><font size="2"> <Tipo>1</Tipo></font></div><div><font size="2"> </IdentificacaoRps></font></div><div><font size="2"> <DataEmissao>2015-09-11T00:00:00</DataEmissao></font></div><div><font size="2"> <NaturezaOperacao>1</NaturezaOperacao></font></div><div><font size="2"> <RegimeEspecialTributacao>2</RegimeEspecialTributacao></font></div><div><font size="2"> <OptanteSimplesNacional>2</OptanteSimplesNacional></font></div><div><font size="2"> <IncentivadorCultural>2</IncentivadorCultural></font></div><div><font size="2"> <Status>1</Status></font></div><div><font size="2"> <Servico></font></div><div><font size="2"> <Valores></font></div><div><font size="2"> <ValorServicos>35.00</ValorServicos></font></div><div><font size="2"> <IssRetido>2</IssRetido></font></div><div><font size="2"> <ValorIss>1.75</ValorIss></font></div><div><font size="2"> <BaseCalculo>35.00</BaseCalculo></font></div><div><font size="2"> <Aliquota>5.0000</Aliquota></font></div><div><font size="2"> <ValorLiquidoNfse>35.00</ValorLiquidoNfse></font></div><div><font size="2"> </Valores></font></div><div><font size="2"> <ItemListaServico>11.01</ItemListaServico></font></div><div><font size="2"> <CodigoCnae>5210</CodigoCnae></font></div><div><font size="2"> <CodigoTributacaoMunicipio>11010011</CodigoTributacaoMunicipio></font></div><div><font size="2"> <Discriminacao>ROTATIVS</Discriminacao></font></div><div><font size="2"> <CodigoMunicipio>4314902</CodigoMunicipio></font></div><div><font size="2"> </Servico></font></div><div><font size="2"> <Prestador></font></div><div><font size="2"> <Cnpj></font><span style="font-size: 10pt;">04220031000100</span><font size="2"></Cnpj></font></div><div><font size="2"> <InscricaoMunicipal>25252525</InscricaoMunicipal></font></div><div><font size="2"> </Prestador></font></div><div><font size="2"> <Tomador></font></div><div><font size="2"> <RazaoSocial>NAO INFORMADO</RazaoSocial></font></div><div><font size="2"> <Endereco></font></div><div><font size="2"> <Endereco>-</Endereco></font></div><div><font size="2"> <Numero>-</Numero></font></div><div><font size="2"> <Bairro>-</Bairro></font></div><div><font size="2"> <CodigoMunicipio>4314902</CodigoMunicipio></font></div><div><font size="2"> <Uf>RS</Uf></font></div><div><font size="2"> <Cep>0</Cep></font></div><div><font size="2"> </Endereco></font></div><div><font size="2"> </Tomador></font></div><div><font size="2"> </InfRps></font></div><div><font size="2"> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="Ass_1332"></font></div><div><font size="2"> <SignedInfo></font></div><div><font size="2"> <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/></font></div><div><font size="2"> <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/></font></div><div><font size="2"> <Reference URI="#1332"></font></div><div><font size="2"> <Transforms></font></div><div><font size="2"> <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/></font></div><div><font size="2"> <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/></font></div><div><font size="2"> </Transforms></font></div><div><font size="2"> <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/></font></div><div><font size="2"> <DigestValue>QRTdVOZ2MdM5iTlIpHA13EHtMOQ=</DigestValue></font></div><div><font size="2"> </Reference></font></div><div><font size="2"> </SignedInfo></font></div><div><font size="2"> <SignatureValue>K3YMZ97ZUyaH/LpQI+gUULMc+NB9a+rHoSFZL78OoKLn+fs4l1jqjMsEHXoDuXJE9xcdpaYtuXp9mdPT8u5jwU8wuHSe6am5N9b3AygmW/fQIIvXmnLiUyc/tagmxGnOgjy0fCKA/PdDqT9l0jWBvB1wmhQKUdYljBi+kiH36FVTwXzPaZizdtk40tferleCU/sUZP2MSDPvP2xMPUAKxpXnTBTIUlDB1kzJ0drzBUpRlyAdRvqy7Sk1vxAS4GMtKOgFErQccVualTolUAZ0u/9l8cTvI/n7sUcJaWaZ8R56hWBoSUkDh7wKeIAo6hOHBXP1m9apzIK2I09dWSWrWw==</SignatureValue></font></div><div><font size="2"> <KeyInfo></font></div><div><font size="2"> <X509Data></font></div><div><font size="2"> <X509Certificate>MIIIQjCCBiqgAwIBAgIQc8LDgr+h2WcKZWLYoPCxhjANBgkqhkiG9w0BAQsFADB4MQswCQYDVQQGEwJCUjETMBEGA1UEChMKSUNQLUJyYXNpbDE2MDQGA1UECxMtU2VjcmV0YXJpYSBkYSBSZWNlaXRhIEZlZGVyYWwgZG8gQnJhc2lsIC0gUkZCMRwwGgYDVQQDExNBQyBDZXJ0aXNpZ24gUkZCIEc0MB4XDTE1MDMyNDAwMDAwMFoXDTE2MDMyMjIzNTk1OVowgfIxCzAJBgNVBAYTAkJSMRMwEQYDVQQKFApJQ1AtQnJhc2lsMQswCQYDVQQIEwJTUDESMBAGA1UEBxQJU0FPIFBBVUxPMTYwNAYDVQQLFC1TZWNyZXRhcmlhIGRhIFJlY2VpdGEgRmVkZXJhbCBkbyBCcmFzaWwgLSBS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j1rQBQLwX+mkYUGhVjbC0CoFd/3bE0CZAMYZj33mKS0ct4/OW1MF8VVIVKe+ReNf1jZqCeQWTuaPkWhl7GbV1FsBCUxv2Swq8BYD/igEMERNeKKDLVujVbcl0+e84hOH3hSYOTE8Kq2QAsWW1a6g49J9+XNsBmEKFPl5JwAnIM/fQRJFOaz6oxD3y9LBIb9EJ63cEAr+2fBmCNIxoiMIIiIR18Rg7RpFusKF2a1kYoRqvpOwUyvUAHoNyTqg4GGbbqNMtARP</X509Certificate></font></div><div><font size="2"> </X509Data></font></div><div><font size="2"> </KeyInfo></font></div><div><font size="2"> </Signature></font></div><div><font size="2"> </Rps></font></div><div><font size="2"> </ListaRps></font></div><div><font size="2"> </LoteRps></font></div><div><font size="2"> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="AssLote_133"></font></div><div><font size="2"> <SignedInfo></font></div><div><font size="2"> <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /></font></div><div><font size="2"> <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /></font></div><div><font size="2"> <Reference URI="#133"></font></div><div><font size="2"> <Transforms></font></div><div><font size="2"> <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></font></div><div><font size="2"> <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /></font></div><div><font size="2"> </Transforms></font></div><div><font size="2"> <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /></font></div><div><font size="2"> <DigestValue></DigestValue></font></div><div><font size="2"> </Reference></font></div><div><font size="2"> </SignedInfo></font></div><div><font size="2"> <SignatureValue></SignatureValue></font></div><div><font size="2"> <KeyInfo></font></div><div><font size="2"> <X509Data></font></div><div><font size="2"> <X509Certificate></X509Certificate></font></div><div><font size="2"> </X509Data></font></div><div><font size="2"> </KeyInfo></font></div><div><font size="2"> </Signature></font></div><div><font size="2"> </GerarNfseEnvio></font></div></div><div><br></div><div><br></div><div>The error message that I receive is this:</div><div><br></div><div><div><font size="2">func=xmlSecXPathDataExecute:file=..\src\xpath.c:line=273:obj=unknown:subj=xmlXPtrEval:error=5:libxml2 library function failed:expr=xpointer(id('1332'))</font></div><div><font size="2">func=xmlSecXPathDataListExecute:file=..\src\xpath.c:line=356:obj=unknown:subj=xmlSecXPathDataExecute:error=1:xmlsec library function failed:</font></div><div><font size="2">func=xmlSecTransformXPathExecute:file=..\src\xpath.c:line=466:obj=xpointer:subj=xmlSecXPathDataExecute:error=1:xmlsec library function failed:</font></div><div><font size="2">func=xmlSecTransformDefaultPushXml:file=..\src\transforms.c:line=2371:obj=xpointer:subj=xmlSecTransformExecute:error=1:xmlsec library function failed:</font></div><div><font size="2">func=xmlSecTransformCtxXmlExecute:file=..\src\transforms.c:line=1207:obj=unknown:subj=xmlSecTransformPushXml:error=1:xmlsec library function failed:transform=xpointer</font></div><div><font size="2">func=xmlSecTransformCtxExecute:file=..\src\transforms.c:line=1267:obj=unknown:subj=xmlSecTransformCtxXmlExecute:error=1:xmlsec library function failed:</font></div><div><font size="2">func=xmlSecDSigReferenceCtxProcessNode:file=..\src\xmldsig.c:line=1568:obj=unknown:subj=xmlSecTransformCtxExecute:error=1:xmlsec library function failed:</font></div><div><font size="2">func=xmlSecDSigCtxProcessSignedInfoNode:file=..\src\xmldsig.c:line=804:obj=unknown:subj=xmlSecDSigReferenceCtxProcessNode:error=1:xmlsec library function failed:node=Reference</font></div><div><font size="2">func=xmlSecDSigCtxProcessSignatureNode:file=..\src\xmldsig.c:line=547:obj=unknown:subj=xmlSecDSigCtxProcessSignedInfoNode:error=1:xmlsec library function failed:</font></div><div><font size="2">func=xmlSecDSigCtxSign:file=..\src\xmldsig.c:line=303:obj=unknown:subj=xmlSecDSigCtxSigantureProcessNode:error=1:xmlsec library function failed:</font></div><div><font size="2">Error: signature failed</font></div></div><div><font size="2"><br></font></div><div><font size="3">Thanks in advance for any help</font></div><div><font size="3"><br></font></div><div><font size="3">Joao Henrique</font></div> </div></body>
</html>