[xmlsec] singning an template
luiz at xharbour.com.br
luiz at xharbour.com.br
Tue Aug 17 08:04:18 PDT 2010
Alex
an you point where to insert on my xml file bellow?
<?xml version="1.0"?>
<ns1:ReqEnvioLoteRPS xmlns:ns1="http://localhost:8080/WsNFe2/lote"
xmlns:tipos="http://localhost:8080/WsNFe2/tp"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://localhost:8080/WsNFe2/lote
http://localhost:8080/WsNFe2/xsd/ReqEnvioLoteRPS.xsd">
<Cabecalho>
<CodCidade>6291</CodCidade>
<CPFCNPJRemetente>55299440002399</CPFCNPJRemetente>
<RazaoSocialRemetente>REDE RECAPEX PNEUS LTDA</RazaoSocialRemetente>
<transacao/>
<dtInicio>2010-08-11</dtInicio>
<dtFim>2010-08-11</dtFim>
<QtdRPS>1</QtdRPS>
<ValorTotalServicos>203.75</ValorTotalServicos>
<ValorTotalDeducoes>0.00</ValorTotalDeducoes>
<Versao>1</Versao>
<MetodoEnvio>WS</MetodoEnvio>
</Cabecalho>
<Lote Id="lote:1174">
<RPS Id="rps:000008">
<Assinatura>85dc70f0c28fd2d6ed45167f3f07fd27d96bf46</Assinatura>
<InscricaoMunicipalPrestador>00001166506</InscricaoMunicipalPrestador>
<RazaoSocialPrestador>REDE RECAPEX PNEUS LTDA</RazaoSocialPrestador>
<TipoRPS>RPS</TipoRPS>
<SerieRPS>NF</SerieRPS>
<NumeroRPS>000008</NumeroRPS>
<DataEmissaoRPS>2010-08-11T00:00:00</DataEmissaoRPS>
<SituacaoRPS>N</SituacaoRPS>
<SerieRPSSubstituido/>
<NumeroRPSSubstituido>0</NumeroRPSSubstituido>
<NumeroNFSeSubstituida>0</NumeroNFSeSubstituida>
<DataEmissaoNFSeSubstituida>1900-01-01</DataEmissaoNFSeSubstituida>
<SeriePrestacao>99</SeriePrestacao>
<InscricaoMunicipalTomador>00000000000</InscricaoMunicipalTomador>
<CPFCNPJTomador>68233436000245</CPFCNPJTomador>
<RazaoSocialTomador>ARIVALDO APARECIDO MORAES E CIA LTDA</RazaoSocialTomador>
<TipoLogradouroTomador>R</TipoLogradouroTomador>
<LogradouroTomador>JOSE ZEFERINO FERREIRA</LogradouroTomador>
<NumeroEnderecoTomador>536</NumeroEnderecoTomador>
<TipoBairroTomador/>
<BairroTomador>PQ BANDEIRANTES</BairroTomador>
<CidadeTomador>6291</CidadeTomador>
<CidadeTomadorDescricao>CAMPINAS (SP)</CidadeTomadorDescricao>
<CEPTomador>13181713</CEPTomador>
<EmailTomador/>
<CodigoAtividade>331399900</CodigoAtividade>
<AliquotaAtividade>5.0000</AliquotaAtividade>
<TipoRecolhimento>A</TipoRecolhimento>
<MunicipioPrestacao>6291</MunicipioPrestacao>
<MunicipioPrestacaoDescricao>CAMPINAS (SP)</MunicipioPrestacaoDescricao>
<Operacao>A</Operacao>
<Tributacao>T</Tributacao>
<ValorPIS> 0.00</ValorPIS>
<ValorCOFINS> 0.00</ValorCOFINS>
<ValorINSS> 0.00</ValorINSS>
<ValorIR> 0.00</ValorIR>
<ValorCSLL> 0.00</ValorCSLL>
<AliquotaPIS>0.0000</AliquotaPIS>
<AliquotaCOFINS>0.0000</AliquotaCOFINS>
<AliquotaINSS>0.0000</AliquotaINSS>
<AliquotaIR>0.0000</AliquotaIR>
<AliquotaCSLL>0.0000</AliquotaCSLL>
<DescricaoRPS/>
<DDDPrestador>19</DDDPrestador>
<TelefonePrestador>32315200</TelefonePrestador>
<DDDTomador>19</DDDTomador>
<TelefoneTomador>38640414</TelefoneTomador>
<MotCancelamento/>
<Deducoes/>
<Itens>
<Item>
<DiscriminacaoServico>ALINHAMENTO (CONV) EIXO TRAS
AUTO/CAMION</DiscriminacaoServico>
<Quantidade> 1.0000</Quantidade>
<ValorUnitario> 48.7500</ValorUnitario>
<ValorTotal> 48.75</ValorTotal>
</Item>
<Item>
<DiscriminacaoServico>CAMBAGEM(COMPLETA)DIANT.DIREITA
AUTO/CAM</DiscriminacaoServico>
<Quantidade> 1.0000</Quantidade>
<ValorUnitario> 80.0000</ValorUnitario>
<ValorTotal> 80.00</ValorTotal>
</Item>
<Item>
<DiscriminacaoServico>CAMBAGEM(COMPLETA)DIANT.ESQUER.AUTO/CAM</DiscriminacaoServico>
<Quantidade> 1.0000</Quantidade>
<ValorUnitario> 75.0000</ValorUnitario>
<ValorTotal> 75.00</ValorTotal>
</Item>
</Itens>
</RPS>
</Lote>
<dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
xmlns:dsig-xpath="http://www.w3.org/2002/06/xmldsig-filter2">
<dsig:SignedInfo>
<dsig:CanonicalizationMethod
Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
<dsig:SignatureMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<dsig:Reference URI="">
<dsig:Transforms>
<dsig:Transform
Algorithm="http://www.w3.org/2002/06/xmldsig-filter2">
<dsig-xpath:XPath Filter="intersect"> //Lote </dsig-xpath:XPath>
<dsig-xpath:XPath Filter="union"> //RPS </dsig-xpath:XPath>
</dsig:Transform>
</dsig:Transforms>
<dsig:DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<dsig:DigestValue />
</dsig:Reference>
<dsig:Reference URI="#signature-value">
<dsig:Transforms>
<dsig:Transform
Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"
/>
<dsig:Transform
Algorithm="http://www.w3.org/2002/06/xmldsig-filter2">
<dsig:Transform
Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
<dsig-xpath:XPath Filter="union"> /</dsig-xpath:XPath>
</dsig:Transform>
</dsig:Transforms>
<dsig:DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<dsig:DigestValue />
</dsig:Reference>
</dsig:SignedInfo>
<dsig:SignatureValue Id="signature-value" />
<dsig:KeyInfo>
<dsig:X509Data>
<dsig:X509Certificate>
</dsig:X509Certificate>
</dsig:X509Data>
</dsig:KeyInfo>
</dsig:Signature>
</ns1:ReqEnvioLoteRPS>
Regards
Luiz
> <dsig:Transform
> Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"
> />
> <dsig:Transform
> Algorithm="http://www.w3.org/2002/06/xmldsig-filter2">
> <dsig:Transform
> Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
> <dsig-xpath:XPath Filter="union"> /</dsig-xpath:XPath>
> </dsig:Transform>
> </dsig:Transforms>
>
>
> Aleksey
>
> On 8/17/2010 7:53 AM, luiz at xharbour.com.br wrote:
>> Hi Alex
>>
>> Thanks for fast response
>>
>> I filled this two tags with values as also dsig:DigestMethod Algorithm
>> tag
>> and the error now is
>>
>> func=xmlSecTransformXPath2NodeRead:file=..\src\xpath.c:line=758:obj=xpath2:subj=Transform:error=27:unexpected
>> node:
>> func=xmlSecTransformNodeRead:file=..\src\transforms.c:line=1571:obj=unknown:subj=id->readNode:error=1:xmlsec
>> library function failed:transform=xpath2
>> func=xmlSecTransformCtxNodesListRead:file=..\src\transforms.c:line=733:obj=unknown:subj=xmlSecTransformNodeRead:error=1:xmlsec
>> library function failed:node=Transform
>> func=xmlSecDSigReferenceCtxProcessNode:file=..\src\xmldsig.c:line=1454:obj=unknown:subj=xmlSecTransformCtxNodesListRead:error=1:xmlsec
>> library function failed:node=Transforms
>> 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:
>>
>>
>> how should be the transform section
>>
>> <dsig:Transform Algorithm="http://www.w3.org/2002/06/xmldsig-filter2">
>> <dsig-xpath:XPath Filter="intersect">
>> //Lote</dsig-xpath:XPath>
>> <dsig-xpath:XPath Filter="union"> //RPS</dsig-xpath:XPath>
>> </dsig:Transform>
>>
>> or i need to add all tags inside<lote></lote> as union?
>>
>> Regards
>> Luiz
>>
>>> This is the problem, I believe the error is pretty clear about this
>>>
>>> <dsig:CanonicalizationMethod Algorithm="" />
>>> <dsig:SignatureMethod Algorithm="" />
>>>
>>>
>>> func=xmlSecTransformNodeRead:file=..\src\transforms.c:line=1533:obj=unknown:subj=xmlSecTransformIdListFindByHref:error=1:xmlsec
>>> library function failed:href=
>>> func=xmlSecTransformCtxNodeRead:file=..\src\transforms.c:line=684:obj=unknown:subj=xmlSecTransformNodeRead:error=1:xmlsec
>>> library function failed:name=CanonicalizationMethod
>>>
>>>
>>> Aleksey
>>>
>>
>>
>
More information about the xmlsec
mailing list