From 7da42f9f405267ac1674b39eeb25a1659ed9f12d Mon Sep 17 00:00:00 2001 From: leotada Date: Thu, 16 Jul 2015 14:31:32 -0300 Subject: [PATCH] chave_URI --- pynfe/processamento/assinatura.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pynfe/processamento/assinatura.py b/pynfe/processamento/assinatura.py index 1d174ae..1a57df0 100644 --- a/pynfe/processamento/assinatura.py +++ b/pynfe/processamento/assinatura.py @@ -35,10 +35,13 @@ class AssinaturaA1(Assinatura): signer = signxml.xmldsig(root, digest_algorithm="sha1") signer.sign(method=signxml.methods.enveloped, key=chave, cert=cert, algorithm="rsa-sha1", c14n_algorithm='http://www.w3.org/TR/2001/REC-xml-c14n-20010315', - reference_uri='') + reference_uri='#NFe42140903657739000169550020000000011000000011') + # reference_uri nao funciona #verified_data = signer.verify(require_x509=True, ca_pem_file="cert.pem") - - #root = etree.SubElement(signer.data, "{http://www.w3.org/2000/09/xmldsig#}Reference", - # URI='#NFe41150715389524000122651010000000271333611649') - result = etree.tostring(signer.data) + + #chave_id = root.find('.//infNFe[@Id]').attrib['Id'] + root.findall('.//{http://www.w3.org/2000/09/xmldsig#}Reference')[0] \ + .attrib['URI'] = '#chaveteste' + + result = etree.tostring(root) return result