Skip to content

Existe um erro ao tentar assinar o xml com o certificado#374

Closed
WeslenPy wants to merge 2 commits intoTadaSoftware:mainfrom
WeslenPy:main
Closed

Existe um erro ao tentar assinar o xml com o certificado#374
WeslenPy wants to merge 2 commits intoTadaSoftware:mainfrom
WeslenPy:main

Conversation

@WeslenPy
Copy link
Contributor

@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?

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
Contributor 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