Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

WeslenPy
Copy link

@WeslenPy WeslenPy commented Jan 6, 2025

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

Copy link
Collaborator

@felps-dev felps-dev left a 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:

  1. Testes unitários para validar a alteração.
  2. 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):
Copy link
Collaborator

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?

Comment on lines +97 to +101
if replace_data:
cert = cert.replace("\n", "")
cert = cert.replace("-----BEGIN CERTIFICATE-----", "")
cert = cert.replace("-----END CERTIFICATE-----", "")

Copy link
Collaborator

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.

Copy link
Author

@WeslenPy WeslenPy Jan 14, 2025

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

@felps-dev
Copy link
Collaborator

Favor visualizar: #373 (comment)

@felps-dev felps-dev closed this Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants