mirror of
https://github.com/noDRM/DeDRM_tools
synced 2024-11-16 19:48:10 +01:00
Try to fix V3 PDF files
This commit is contained in:
parent
93ff0aac20
commit
227bda1ea6
2 changed files with 2 additions and 1 deletions
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue