Skip to content

Commit e2e907c

Browse files
authored
Merge pull request #279 from TadaSoftware/fix-signxml
Fix signxml
2 parents 5bf3919 + 4f7464a commit e2e907c

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

pynfe/processamento/assinatura.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# -*- coding: utf-8 -*-
2-
from pynfe.utils import etree, remover_acentos
2+
from pynfe.utils import etree, remover_acentos, CustomXMLSigner
33
from pynfe.utils.flags import NAMESPACE_SIG
44
import subprocess
55
import signxml
6-
from signxml import XMLSigner
76
from pynfe.entidades import CertificadoA1
87

98

@@ -37,7 +36,7 @@ def assinar(self, xml, retorna_string=False):
3736
xml_str = remover_acentos(etree.tostring(xml, encoding="unicode", pretty_print=False))
3837
xml = etree.fromstring(xml_str)
3938

40-
signer = XMLSigner(
39+
signer = CustomXMLSigner(
4140
method=signxml.methods.enveloped, signature_algorithm="rsa-sha1",
4241
digest_algorithm='sha1',
4342
c14n_algorithm='http://www.w3.org/TR/2001/REC-xml-c14n-20010315')

pynfe/utils/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import codecs
44
import os
55
from unicodedata import normalize
6+
from signxml import XMLSigner
67

78
try:
89
from lxml import etree
@@ -155,3 +156,10 @@ def obter_uf_por_codigo(codigo_uf):
155156

156157
def remover_acentos(txt):
157158
return normalize('NFKD', txt).encode('ASCII', 'ignore').decode('ASCII')
159+
160+
class CustomXMLSigner(XMLSigner):
161+
def __init__(self, method, signature_algorithm, digest_algorithm, c14n_algorithm):
162+
super().__init__(method, signature_algorithm, digest_algorithm, c14n_algorithm)
163+
164+
def check_deprecated_methods(self):
165+
pass

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pyopenssl>=23.0.0
33
requests
44
lxml
5-
signxml==2.10.1
5+
signxml
66

77
# Opcional para NFS-e
88
#-r requirements-nfse.txt

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
'pyopenssl>=23.0.0',
3535
'requests',
3636
'lxml',
37-
'signxml==2.10.1',
37+
'signxml',
3838
],
3939
extras_require={
4040
'nfse': [

0 commit comments

Comments
 (0)