]> xmof Git - DeDRM.git/commitdiff
Fix RSA.import_key (fixes #101)
authorNoDRM <no_drm123@protonmail.com>
Sat, 16 Jul 2022 07:48:27 +0000 (09:48 +0200)
committerNoDRM <no_drm123@protonmail.com>
Sat, 16 Jul 2022 07:54:00 +0000 (09:54 +0200)
Apparently "import_key" only exists in newer versions (as an alias to
"importKey"). "importKey" works in all versions ...

CHANGELOG.md
DeDRM_plugin/ineptepub.py
DeDRM_plugin/ineptpdf.py

index e206d763c929dd9e8a82d28469a958a70c3ea300..8d48de7e50b99c67fdd0dfaa35c948dad69e3cff 100644 (file)
@@ -69,4 +69,4 @@ List of changes since the fork of Apprentice Harper's repository:
 
 ## Fixes on master (not yet released):
 
-- (None)
\ No newline at end of file
+- Fix a bug introduced with #48 that breaks DeDRM'ing on Calibre 4 (fixes #101).
\ No newline at end of file
index b9ec14912674fe399437628c5e981ac7ba6c134a..6b4b67608b1804d7b89671701e3ac7a909ccb42f 100644 (file)
@@ -302,7 +302,7 @@ def decryptBook(userkey, inpath, outpath):
 
             if len(bookkey) != 64:
                 # Normal or "hardened" Adobe ADEPT
-                rsakey = RSA.import_key(userkey) # parses the ASN1 structure
+                rsakey = RSA.importKey(userkey) # parses the ASN1 structure
                 bookkey = base64.b64decode(bookkey)
                 if int(keytype, 10) > 2:
                     bookkey = removeHardening(rights, keytype, bookkey)
index 24fc15082a5aa39095ed47ffdcbed431806f82e2..7a1475052613261ac0dfe6a1c6f303589b016a13 100755 (executable)
@@ -1669,7 +1669,7 @@ class PDFDocument(object):
 
     def initialize_ebx_inept(self, password, docid, param):
         self.is_printable = self.is_modifiable = self.is_extractable = True
-        rsakey = RSA.import_key(password) # parses the ASN1 structure
+        rsakey = RSA.importKey(password) # parses the ASN1 structure
         length = int_value(param.get('Length', 0)) // 8
         rights = codecs.decode(param.get('ADEPT_LICENSE'), 'base64')
         rights = zlib.decompress(rights, -15)