From 133e67fa0314a484e188367410b41975054180d7 Mon Sep 17 00:00:00 2001 From: NoDRM Date: Sun, 25 Jun 2023 16:27:31 +0200 Subject: [PATCH] Added fix for padding being correct on accident Co-authored-by: Satsuoni --- DeDRM_plugin/ion.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/DeDRM_plugin/ion.py b/DeDRM_plugin/ion.py index 7e3c9de..a268c63 100644 --- a/DeDRM_plugin/ion.py +++ b/DeDRM_plugin/ion.py @@ -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()