-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Existe um erro ao tentar assinar o xml com o certificado #374
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Precisamos de 2 coisas:
- Testes unitários para validar a alteração.
- Garantir que isso é um bug recorrente: Tenho vários certificados com o header/footer e nunca tive problema com isso, tem certeza que seu problema não era somente os breaklines inseridos?
@@ -37,7 +37,7 @@ def __init__(self, caminho_arquivo=None): | |||
self.caminho_arquivo = caminho_arquivo | |||
self.arquivos_temp = [] | |||
|
|||
def separar_arquivo(self, senha, caminho=False): | |||
def separar_arquivo(self, senha, caminho=False,replace_data=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O parâmetro pode ser um pouco mais descritivo?
Algo como remove_certificate_headers
?
if replace_data: | ||
cert = cert.replace("\n", "") | ||
cert = cert.replace("-----BEGIN CERTIFICATE-----", "") | ||
cert = cert.replace("-----END CERTIFICATE-----", "") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Não são todos os certificados que começam/terminam com esses valores, isso pode até funcionar com o seu, mas não vai funcionar em quem tem outro certificado.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
na verdade o erro ocorre devido a remoção dos headers
Favor visualizar: #373 (comment) |
Exception has occurred: InvalidInput
No PEM-encoded certificates found in string cert input data
File "D:\Projetos\Python\emissao-nfe\main.py", line 148, in
xml = a1.assinar(nfe)
^^^^^^^^^^^^^^^
signxml.exceptions.InvalidInput: No PEM-encoded certificates found in string cert input data