Com o certificado carregado, deve ser utilizada para a assinatura a tag InfPedidoCancelamento.
Nessa tag, deverá ser inserido o atributo Id, cujo qual será utilizado para montar a referência
para assinatura.
Um XML de cancelamento de lote RPS assinado deve ter a estrutura abaixo:
<?xml
version="1.0"
encoding="utf-8"?>
<CancelarNfseEnvioxmlns="http://www.abrasf.org.br/nfse.xsd">
<Pedido>
<InfPedidoCancelamento
Id
=
"1999999999999620000000000000001">
<IdentificacaoNfse>
<Numero>3</Numero>
<CpfCnpj>
<Cnpj>915933760000102</Cnpj>
</CpfCnpj>
<InscricaoMunicipal>31001042</InscricaoMunicipal>
<CodigoMunicipio>4302105</CodigoMunicipio>
</IdentificacaoNfse>
<CodigoCancelamento>1</CodigoCancelamento>
<MotivoCancelamento
/>
</InfPedidoCancelamento>
<
Signaturexmlns=
"http://www.w3.org/2000/09/xmldsig#">
<
SignedInfo
>
<
CanonicalizationMethodAlgorithm=
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315">
<
SignatureMethodAlgorithm=
"http://www.w3.org/2000/09/xmldsig#rsa-sha1">
<
ReferenceURI=
"#1999999999999620000000000000001">
<
Transforms
>
<
TransformAlgorithm=
"http://www.w3.org/2000/09/xmldsig#enveloped-signature">
<
TransformAlgorithm=
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315">
</
Transforms
>
<DigestMethodAlgorithm=
"http://www.w3.org/2000/09/xmldsig#sha1">
<DigestValue>9xrGMZkB7HhAiAiBWFOhWe35IB4=</DigestValue>
</
Reference
>
</
SignedInfo
>
<SignatureValue>4jj2fsU6/vAngo502PfehC69wbEAm/Wcj+P3ZfwbNgLmWpcrWGBFN8KiwNmh7SK5kKhF8dCBXJTISCuVCKIfKj
840HNZN/qKfj0nLpa8U/9yQTL81H6/uxQyn6m/FBn0nrJffbFmtnn3YTC7r9ddAzPDM2g9B6FrpEoasRT0ZPA=
</SignatureValue>
<
KeyInfo
>
<
X509Data
>
<X509Certificate>
MIIClDCCAf2gAwIBAgIBZDANBgkqhki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