1
I’m having trouble validating the eSocial xml signature. We have already made several attempts, but in all the return of the event processing is the same: "Invalid event subscription. Suggested Actions: Check for event changes after signing. Check for signature validity."
I wonder if anyone had the same problem and how it solved. And if anyone knows of any problem regarding this in the restricted production environment of eSocial.
Below is the signed xml.
<loteEventos>
<eSocial xmlns="http://www.esocial.gov.br/schema/lote/eventos/envio/v1_1_1">
<envioLoteEventos grupo="2">
<ideEmpregador>
<tpInsc>1</tpInsc>
<nrInsc>99999999999999</nrInsc>
</ideEmpregador>
<ideTransmissor>
<tpInsc>1</tpInsc>
<nrInsc>99999999999999</nrInsc>
</ideTransmissor>
<eventos>
<evento Id="ID1999999999999992018011103585700001">
<eSocial xmlns="http://www.esocial.gov.br/schema/evt/evtTabRubrica/v02_04_01">
<evtTabRubrica Id="ID1999999999999992018011103585700001">
<ideEvento>
<tpAmb>3</tpAmb>
<procEmi>1</procEmi>
<verProc>V2.04.01</verProc>
</ideEvento>
<ideEmpregador>
<tpInsc>1</tpInsc>
<nrInsc>99999999999999</nrInsc>
</ideEmpregador>
<infoRubrica>
<inclusao>
<ideRubrica>
<codRubr>SGU-5</codRubr>
<ideTabRubr>1</ideTabRubr>
<iniValid>2018-01</iniValid>
<fimValid>2018-12</fimValid>
</ideRubrica>
<dadosRubrica>
<dscRubr>RUBRICA DESTINADA AO EVENTO 5-PRODUCAO PARA OS COOPERADOS.</dscRubr>
<natRubr>3520</natRubr>
<tpRubr>1</tpRubr>
<codIncCP>15</codIncCP>
<codIncIRRF>31</codIncIRRF>
<codIncFGTS>00</codIncFGTS>
<codIncSIND>00</codIncSIND>
<observacao>RUBRICA DESTINADA AO EVENTO 5-PRODUCAO PARA OS COOPERADOS.</observacao>
<ideProcessoIRRF>
<nrProc>123</nrProc>
<codSusp>0</codSusp>
</ideProcessoIRRF>
</dadosRubrica>
</inclusao>
</infoRubrica>
</evtTabRubrica>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
<Reference URI="">
<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/2001/04/xmlenc#sha256"/>
<DigestValue>LH5RFX3/ftKopeifmwZCQPMx1yOSt7wR0yhxI6KAdgI=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>M5VHtMjVpUWQprqvvVa+FcTUBhGjwunAElleqpIm72PmYnodnXegN7nBrPcTEGVcAdblQr0dJa+CMFssNjDGeWJy0A4VgJzsM/J5Cq3j80KPjLxJX7dK2oiVAeM4l+B/x507kSB7smaP/orPymB4a4NAAsBMPnweqyZYE02ZSJqN87PoBiu+OjFFjIuSE6zxApsceuP72Xpy+LtYKGvpZxRu1H810RzQxGdKA+VZ+22cw2H52W8bvRcXzhLpEoQN5IwNRiFK/R0jRMOQ81Jq/LZKhEqTRzvkdy76u1WoADxtfWcU2fN0iUo3i+H9Rw31ZEBWfb902D1dN07EBBlO5Q==</SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate>MIIIRTCCBi2gAwIBAgIQDgKKPBcCGhj838PCXYRWgDANBgkqhkiG9w0BAQsFADCBgDELMAkGA1UEBhMCQlIxEzARBgNVBAoTCklDUC1CcmFzaWwxNjA0BgNVBAsTLVNlY3JldGFyaWEgZGEgUmVjZWl0YSBGZWRlcmFsIGRvIEJyYXNpbCAtIFJGQjEkMCIGA1UEAxMbQUMgSW5zdGl0dXRvIEZlbmFjb24gUkZCIEczMB4XDTE3MDgwNzIwMDcxNFoXDTE4MDgwNzIwMDcxNFowggEFMQswCQYDVQQGEwJCUjETMBEGA1UECgwKSUNQLUJyYXNpbDELMAkGA1UECAwCU0MxEjAQBgNVBAcMCUpPSU5WSUxMRTE2MDQGA1UECwwt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j/byhuCDZ/SnTKWdp3MHiEx0FEgw6uCIhFCtcH6myrR8StQL/dgSdn9sX1ZRMJwEhC1WAc167rbZTBbf9FsP0qMQR1coMXChtCq0nVEfcDsdflDwiU874eidd1yONKmNpLQLrF2KcokhdSYMpvYmezDiJgsfplVfsX/8FShK2DqcVBWNiJqAObVTtT4iKc95Y8XH7qV+ac+nxXwe2a9sVfKLyFi4gpY0wdI0NraVywTCny6+W0YL+SJrWy/3QQVunurYZOB3e5fxh1mRG2fy8m6lkIc3Zmxwsv1DoNrMd/OD1S</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
</eSocial>
</evento>
</eventos>
</envioLoteEventos>
</eSocial>
</loteEventos>
It would be nice if you included a brief description of how exactly this script solves the question.
– Leandro Angelo