summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoDRM <[email protected]>2022-03-18 17:26:17 +0100
committerNoDRM <[email protected]>2022-03-18 17:29:19 +0100
commit227bda1ea670d601ce6c115f3eced699bfd4d5bd (patch)
treefb1f4b1c286047b6811897453b1ab5cbdd1fcb23
parent93ff0aac20aea245217c636e157cd6325841d18b (diff)
Try to fix V3 PDF files
-rw-r--r--CHANGELOG.md1
-rwxr-xr-xDeDRM_plugin/ineptpdf.py2
2 files changed, 2 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8d746c1..92d6670 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -61,3 +61,4 @@ List of changes since the fork of Apprentice Harper's repository:
- Add support for books with the new ADE3.0+ DRM by merging #48 by a980e066a01. Thanks a lot!
- Remove OpenSSL support, now the plugin will always use the Python crypto libraries.
- Obok: Fix issues with invalid UTF-8 characters by merging #26 by baby-bell.
+- Try to fix PDF files with V3 key obfuscation algorithm.
diff --git a/DeDRM_plugin/ineptpdf.py b/DeDRM_plugin/ineptpdf.py
index 22cd148..4319997 100755
--- a/DeDRM_plugin/ineptpdf.py
+++ b/DeDRM_plugin/ineptpdf.py
@@ -1720,7 +1720,7 @@ class PDFDocument(object):
objid = struct.pack('<L', objid ^ 0x3569ac)
genno = struct.pack('<L', genno ^ 0xca96)
key = self.decrypt_key
- key += objid[0] + genno[0] + objid[1] + genno[1] + objid[2] + b'sAlT'
+ key += bytes([objid[0], genno[0], objid[1], genno[1], objid[2]]) + b'sAlT'
hash = hashlib.md5(key)
key = hash.digest()[:min(len(self.decrypt_key) + 5, 16)]
return key