[xmlsec] Error xpointer(id('XXXXXXX')) again

Aleksey Sanin aleksey at aleksey.com
Mon Sep 14 13:36:33 PDT 2015


<Reference URI="#1332">

<InfRps Id="1332">

<!ATTLIST LoteRps Id ID #IMPLIED>

Aleksey

On 9/14/15 12:57 PM, João Henrique Souza wrote:
> Hello,
> I've trying to sign a XML which already has a signed node.
> I've already read the Faq Section and the other emails with the same
> subject, but this unfortunatelly didn't solve my problem.
> 
> 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):
> 
> <!DOCTYPE test [<!ATTLIST LoteRps Id ID #IMPLIED>]>
>   <GerarNfseEnvio xmlns="http://www.abrasf.org.br/nfse.xsd">
>     <LoteRps Id="133" versao="1.00">
>       <NumeroLote>133</NumeroLote>
>       <Cnpj>04220031000100</Cnpj>
>       <InscricaoMunicipal>25252525</InscricaoMunicipal>
>       <QuantidadeRps>1</QuantidadeRps>
>       <ListaRps>
>         <Rps>
>           <InfRps Id="1332">
>             <IdentificacaoRps>
>               <Numero>133</Numero>
>               <Serie>2</Serie>
>               <Tipo>1</Tipo>
>             </IdentificacaoRps>
>             <DataEmissao>2015-09-11T00:00:00</DataEmissao>
>             <NaturezaOperacao>1</NaturezaOperacao>
>             <RegimeEspecialTributacao>2</RegimeEspecialTributacao>
>             <OptanteSimplesNacional>2</OptanteSimplesNacional>
>             <IncentivadorCultural>2</IncentivadorCultural>
>             <Status>1</Status>
>             <Servico>
>               <Valores>
>                 <ValorServicos>35.00</ValorServicos>
>                 <IssRetido>2</IssRetido>
>                 <ValorIss>1.75</ValorIss>
>                 <BaseCalculo>35.00</BaseCalculo>
>                 <Aliquota>5.0000</Aliquota>
>                 <ValorLiquidoNfse>35.00</ValorLiquidoNfse>
>               </Valores>
>               <ItemListaServico>11.01</ItemListaServico>
>               <CodigoCnae>5210</CodigoCnae>
>              
> <CodigoTributacaoMunicipio>11010011</CodigoTributacaoMunicipio>
>               <Discriminacao>ROTATIVS</Discriminacao>
>               <CodigoMunicipio>4314902</CodigoMunicipio>
>             </Servico>
>             <Prestador>
>               <Cnpj>04220031000100</Cnpj>
>               <InscricaoMunicipal>25252525</InscricaoMunicipal>
>             </Prestador>
>             <Tomador>
>               <RazaoSocial>NAO INFORMADO</RazaoSocial>
>               <Endereco>
>                 <Endereco>-</Endereco>
>                 <Numero>-</Numero>
>                 <Bairro>-</Bairro>
>                 <CodigoMunicipio>4314902</CodigoMunicipio>
>                 <Uf>RS</Uf>
>                 <Cep>0</Cep>
>               </Endereco>
>             </Tomador>
>           </InfRps>
>           <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"
> Id="Ass_1332">
>             <SignedInfo>
>               <CanonicalizationMethod
> Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
>               <SignatureMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
>               <Reference URI="#1332">
>                 <Transforms>
>                   <Transform
> Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
>                   <Transform
> Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
>                 </Transforms>
>                 <DigestMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
>                 <DigestValue>QRTdVOZ2MdM5iTlIpHA13EHtMOQ=</DigestValue>
>               </Reference>
>             </SignedInfo>
>            
> <SignatureValue>K3YMZ97ZUyaH/LpQI+gUULMc+NB9a+rHoSFZL78OoKLn+fs4l1jqjMsEHXoDuXJE9xcdpaYtuXp9mdPT8u5jwU8wuHSe6am5N9b3AygmW/fQIIvXmnLiUyc/tagmxGnOgjy0fCKA/PdDqT9l0jWBvB1wmhQKUdYljBi+kiH36FVTwXzPaZizdtk40tferleCU/sUZP2MSDPvP2xMPUAKxpXnTBTIUlDB1kzJ0drzBUpRlyAdRvqy7Sk1vxAS4GMtKOgFErQccVualTolUAZ0u/9l8cTvI/n7sUcJaWaZ8R56hWBoSUkDh7wKeIAo6hOHBXP1m9apzIK2I09dWSWrWw==</SignatureValue>
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vY3NwLmNlcnRpc2lnbi5jb20uYnIwDQYJKoZIhvcNAQELBQADggIBAIUFeH2VLnG+YBl30qv/aGrsCMSX/1mgaQ6c7iZWjDRCN3mEB5Vc+db2TewjWVe7EU6IyThqSyF2UeUvJqzh+rW9Qwh1rOiD+r+5yE23rn6eAaW/btoRLX1nfuF0AN9g4AymNHTymNmHAHo/8vEqGGcKQ+31ipSa98EN93mmkCzCJ4BhzcXdQ1pblSkuWWj33aRVZ+BOETHD1u9bhFZNnJXRR5Y0GhJ117OtLHT7DBd3yc70O1EPr9ZPhDJfwUvH21pCjrDtEGRh3NviIgNSJ247i2c9SShk2PDtknINvvoUFKqCyCbgi7k0nKc7qGHIAT1+qLaVPB/nemgqvekvuzvq4c4Fuw/z/Aw0kQRI8YGDk7rywIsS+J9SZo2I5fZ6biS2ZQmrWjNdQTOAIpd5mmiYW8LQxVYJqh1Sj1rQBQLwX+mkYUGhVjbC0CoFd/3bE0CZAMYZj33mKS0ct4/OW1MF8VVIVKe+ReNf1jZqCeQWTuaPkWhl7GbV1FsBCUxv2Swq8BYD/igEMERNeKKDLVujVbcl0+e84hOH3hSYOTE8Kq2QAsWW1a6g49J9+XNsBmEKFPl5JwAnIM/fQRJFOaz6oxD3y9LBIb9EJ63cEAr+2fBmCNIxoiMIIiIR18Rg7RpFusKF2a1kYoRqvpOwUyvUAHoNyTqg4GGbbqNMtARP</X509Certificate>
>               </X509Data>
>             </KeyInfo>
>           </Signature>
>         </Rps>
>       </ListaRps>
>     </LoteRps>
>     <Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="AssLote_133">
>       <SignedInfo>
>         <CanonicalizationMethod
> Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
>         <SignatureMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
>         <Reference URI="#133">
>           <Transforms>
>             <Transform
> Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
>             <Transform
> Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
>           </Transforms>
>           <DigestMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
>           <DigestValue></DigestValue>
>         </Reference>
>       </SignedInfo>
>       <SignatureValue></SignatureValue>
>       <KeyInfo>
>         <X509Data>
>           <X509Certificate></X509Certificate>
>         </X509Data>
>       </KeyInfo>
>     </Signature>
>   </GerarNfseEnvio>
> 
> 
> The error message that I receive is this:
> 
> func=xmlSecXPathDataExecute:file=..\src\xpath.c:line=273:obj=unknown:subj=xmlXPtrEval:error=5:libxml2
> library function failed:expr=xpointer(id('1332'))
> func=xmlSecXPathDataListExecute:file=..\src\xpath.c:line=356:obj=unknown:subj=xmlSecXPathDataExecute:error=1:xmlsec
> library function failed:
> func=xmlSecTransformXPathExecute:file=..\src\xpath.c:line=466:obj=xpointer:subj=xmlSecXPathDataExecute:error=1:xmlsec
> library function failed:
> func=xmlSecTransformDefaultPushXml:file=..\src\transforms.c:line=2371:obj=xpointer:subj=xmlSecTransformExecute:error=1:xmlsec
> library function failed:
> func=xmlSecTransformCtxXmlExecute:file=..\src\transforms.c:line=1207:obj=unknown:subj=xmlSecTransformPushXml:error=1:xmlsec
> library function failed:transform=xpointer
> func=xmlSecTransformCtxExecute:file=..\src\transforms.c:line=1267:obj=unknown:subj=xmlSecTransformCtxXmlExecute:error=1:xmlsec
> library function failed:
> func=xmlSecDSigReferenceCtxProcessNode:file=..\src\xmldsig.c:line=1568:obj=unknown:subj=xmlSecTransformCtxExecute:error=1:xmlsec
> library function failed:
> func=xmlSecDSigCtxProcessSignedInfoNode:file=..\src\xmldsig.c:line=804:obj=unknown:subj=xmlSecDSigReferenceCtxProcessNode:error=1:xmlsec
> library function failed:node=Reference
> func=xmlSecDSigCtxProcessSignatureNode:file=..\src\xmldsig.c:line=547:obj=unknown:subj=xmlSecDSigCtxProcessSignedInfoNode:error=1:xmlsec
> library function failed:
> func=xmlSecDSigCtxSign:file=..\src\xmldsig.c:line=303:obj=unknown:subj=xmlSecDSigCtxSigantureProcessNode:error=1:xmlsec
> library function failed:
> Error: signature failed
> 
> Thanks in advance for any help
> 
> Joao Henrique
> 
> 
> _______________________________________________
> xmlsec mailing list
> xmlsec at aleksey.com
> http://www.aleksey.com/mailman/listinfo/xmlsec
> 


More information about the xmlsec mailing list