Skip to content

Commit

Permalink
Fix #771: incorrect printing of DigestInfo length
Browse files Browse the repository at this point in the history
  • Loading branch information
Legrandin committed Oct 7, 2023
1 parent eeffcf5 commit 739558f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Crypto/Signature/pkcs1_15.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def _EMSA_PKCS1_V1_5_ENCODE(msg_hash, emLen, with_hash_parameters=True):
# We need at least 11 bytes for the remaining data: 3 fixed bytes and
# at least 8 bytes of padding).
if emLen<len(digestInfo)+11:
raise TypeError("Selected hash algorithm has a too long digest (%d bytes)." % len(digest))
raise TypeError("DigestInfo is too long for this RSA key (%d bytes)." % len(digestInfo))
PS = b'\xFF' * (emLen - len(digestInfo) - 3)
return b'\x00\x01' + PS + b'\x00' + digestInfo

Expand Down

0 comments on commit 739558f

Please sign in to comment.