Skip to content

Commit

Permalink
ROB: Decrypt returns empty bytestring (#1258)
Browse files Browse the repository at this point in the history
Closes #1245
  • Loading branch information
pubpub-zz authored Aug 21, 2022
1 parent baf0de1 commit cf3aab4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion PyPDF2/_encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ def decrypt(self, data: bytes) -> bytes:
data = data[16:]
aes = AES.new(self.key, AES.MODE_CBC, iv)
d = aes.decrypt(data)
return d[: -d[-1]]
if len(d) == 0:
return d
else:
return d[: -d[-1]]

def RC4_encrypt(key: bytes, data: bytes) -> bytes:
return ARC4.ARC4Cipher(key).encrypt(data)
Expand Down

0 comments on commit cf3aab4

Please sign in to comment.