Added fix for padding being correct on accident

Co-authored-by: Satsuoni <satsuoni@hotmail.com>
This commit is contained in:
NoDRM 2023-06-25 16:27:31 +02:00
parent f86cff285b
commit 133e67fa03
1 changed files with 6 additions and 8 deletions

View 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()