]> xmof Git - DeDRM.git/commitdiff
Added fix for padding being correct on accident
authorNoDRM <no_drm123@protonmail.com>
Sun, 25 Jun 2023 14:27:31 +0000 (16:27 +0200)
committerNoDRM <no_drm123@protonmail.com>
Sun, 25 Jun 2023 14:27:31 +0000 (16:27 +0200)
Co-authored-by: Satsuoni <satsuoni@hotmail.com>
DeDRM_plugin/ion.py

index 7e3c9de937931c81163bcadeafbf2eb29326f568..a268c63c177a17aa32f42648c8d978df741bfe82 100644 (file)
@@ -989,7 +989,13 @@ class DrmIonVoucher(object):
             try:
                 b = aes.decrypt(self.ciphertext)
                 b = pkcs7unpad(b, 16)
+                self.drmkey = BinaryIonParser(BytesIO(b))
+                addprottable(self.drmkey)
+
+                _assert(self.drmkey.hasnext() and self.drmkey.next() == TID_LIST and self.drmkey.gettypename() == "com.amazon.drm.KeySet@1.0",
+                    "Expected KeySet, got %s" % self.drmkey.gettypename())
                 decrypted=True 
+                
                 print("Decryption succeeded")
                 break
             except Exception as ex:
@@ -997,14 +1003,6 @@ class DrmIonVoucher(object):
         if not decrypted:
             raise ex
 
-        sharedsecret = obfuscate(shared, self.version)
-
-        self.drmkey = BinaryIonParser(BytesIO(b))
-        addprottable(self.drmkey)
-
-        _assert(self.drmkey.hasnext() and self.drmkey.next() == TID_LIST and self.drmkey.gettypename() == "com.amazon.drm.KeySet@1.0",
-                "Expected KeySet, got %s" % self.drmkey.gettypename())
-
         self.drmkey.stepin()
         while self.drmkey.hasnext():
             self.drmkey.next()