]> xmof Git - DeDRM.git/commitdiff
Fix issue with remaining data in encryption.xml
authorNoDRM <no_drm123@protonmail.com>
Fri, 6 Jan 2023 13:29:56 +0000 (14:29 +0100)
committerNoDRM <no_drm123@protonmail.com>
Fri, 6 Jan 2023 13:29:56 +0000 (14:29 +0100)
DeDRM_plugin/ineptepub.py

index 8d112e42aec3a0ca95c2657c3224115e70ff8848..d403dacc1e41c32ef70587952913df66e0dd84cf 100644 (file)
@@ -89,7 +89,7 @@ class Decryptor(object):
     def __init__(self, bookkey, encryption):
         enc = lambda tag: '{%s}%s' % (NSMAP['enc'], tag)
         self._aes = AES.new(bookkey, AES.MODE_CBC, b'\x00'*16)
-        encryption = etree.fromstring(encryption)
+        self._encryption = etree.fromstring(encryption)
         self._encrypted = encrypted = set()
         self._otherData = otherData = set()
 
@@ -97,7 +97,7 @@ class Decryptor(object):
         self._has_remaining_xml = False
         expr = './%s/%s/%s' % (enc('EncryptedData'), enc('CipherData'),
                                enc('CipherReference'))
-        for elem in encryption.findall(expr):
+        for elem in self._encryption.findall(expr):
             path = elem.get('URI', None)
             encryption_type_url = (elem.getparent().getparent().find("./%s" % (enc('EncryptionMethod'))).get('Algorithm', None))
             if path is not None: