raise exception when signature is empty (#1833)

Co-authored-by: Son NK <son@simplelogin.io>
This commit is contained in:
Son Nguyen Kim 2023-08-03 16:59:36 +02:00 committed by GitHub
parent 6c7e9e69dc
commit 06b7e05e61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -543,7 +543,7 @@ def sign_msg(msg: Message) -> Message:
payload = sign_data(message_to_bytes(msg).replace(b"\n", b"\r\n"))
if not payload:
LOG.e(f"Empty payload when signing {msg}")
raise PGPException("Empty signature by gnupg")
signature.set_payload(payload)
except Exception:
@ -551,7 +551,7 @@ def sign_msg(msg: Message) -> Message:
payload = sign_data_with_pgpy(message_to_bytes(msg).replace(b"\n", b"\r\n"))
if not payload:
LOG.e(f"Empty payload when signing with pgpy {msg}")
raise PGPException("Empty signature by pgpy")
signature.set_payload(payload)