Skip to content

Commit

Permalink
doing assertions for now, to please mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
nitneuqr committed Jan 10, 2025
1 parent 794db04 commit 0b84feb
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/cryptography/hazmat/primitives/serialization/pkcs7.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,16 +372,14 @@ def _smime_signed_decode(data: bytes) -> tuple[bytes | None, bytes]:
raise ValueError(
"Malformed multipart/signed message: must be multipart"
)
if not isinstance(payload[0], email.message.Message):
raise ValueError(
"Malformed multipart/signed message: first part (content) "
"must be a MIME message"
)
if not isinstance(payload[1], email.message.Message):
raise ValueError(
"Malformed multipart/signed message: second part (signature) "
"must be a MIME message"
)
assert isinstance(payload[0], email.message.Message), (
"Malformed multipart/signed message: first part (content) "
"must be a MIME message"
)
assert isinstance(payload[1], email.message.Message), (
"Malformed multipart/signed message: second part (signature) "
"must be a MIME message"
)
return (
bytes(payload[0].get_payload(decode=True)),
bytes(payload[1].get_payload(decode=True)),
Expand Down

0 comments on commit 0b84feb

Please sign in to comment.