mirror of
https://github.com/noDRM/DeDRM_tools.git
synced 2024-12-29 21:07:39 +06:00
Merge pull request #1482 from 2weak2live/master
Fix python3 encoding problem in voucher decryption
This commit is contained in:
commit
8d2d6627cf
@ -815,18 +815,18 @@ class DrmIonVoucher(object):
|
|||||||
addprottable(self.envelope)
|
addprottable(self.envelope)
|
||||||
|
|
||||||
def decryptvoucher(self):
|
def decryptvoucher(self):
|
||||||
shared = "PIDv3" + self.encalgorithm + self.enctransformation + self.hashalgorithm
|
shared = ("PIDv3" + self.encalgorithm + self.enctransformation + self.hashalgorithm).encode('ASCII')
|
||||||
|
|
||||||
self.lockparams.sort()
|
self.lockparams.sort()
|
||||||
for param in self.lockparams:
|
for param in self.lockparams:
|
||||||
if param == "ACCOUNT_SECRET":
|
if param == "ACCOUNT_SECRET":
|
||||||
shared += param + self.secret
|
shared += param.encode('ASCII') + self.secret
|
||||||
elif param == "CLIENT_ID":
|
elif param == "CLIENT_ID":
|
||||||
shared += param + self.dsn
|
shared += param.encode('ASCII') + self.dsn
|
||||||
else:
|
else:
|
||||||
_assert(False, "Unknown lock parameter: %s" % param)
|
_assert(False, "Unknown lock parameter: %s" % param)
|
||||||
|
|
||||||
sharedsecret = obfuscate(shared.encode('ASCII'), self.version)
|
sharedsecret = obfuscate(shared, self.version)
|
||||||
|
|
||||||
key = hmac.new(sharedsecret, b"PIDv3", digestmod=hashlib.sha256).digest()
|
key = hmac.new(sharedsecret, b"PIDv3", digestmod=hashlib.sha256).digest()
|
||||||
aes = AES.new(key[:32], AES.MODE_CBC, self.cipheriv[:16])
|
aes = AES.new(key[:32], AES.MODE_CBC, self.cipheriv[:16])
|
||||||
|
Loading…
Reference in New Issue
Block a user