]> xmof Git - DeDRM.git/commitdiff
Try to fix V3 PDF files
authorNoDRM <no_drm123@protonmail.com>
Fri, 18 Mar 2022 16:26:17 +0000 (17:26 +0100)
committerNoDRM <no_drm123@protonmail.com>
Fri, 18 Mar 2022 16:29:19 +0000 (17:29 +0100)
CHANGELOG.md
DeDRM_plugin/ineptpdf.py

index 8d746c1755af88fa494b898f613c716f11cafcb9..92d667076bf59ae23e46b609e0b1886ce09c4fad 100644 (file)
@@ -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.
index 22cd1489ed9c7bfb0ce9077d31ed060bcdc37e8e..4319997a5f1605de1c30b714d4b481a5198607c3 100755 (executable)
@@ -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