Could not parse license_message as a SignedMessage, Error parsing message
Closed this issue · 2 comments
I use the latest version of pywidevine: '1.5.3'
The license request requires the server certificate so I run the code as following and both successful return the license as expected compared to the requested with Web-browser on Desktop or on Android App.
session_id = cdm.open()
#First license request to get cert
response = requests.post(lic_url, headers=headers, data=cdm.service_certificate_challenge)
print("First lic content request to get cert", response.content)
service_cert = response.json()['license']
provider_id = cdm.set_service_certificate(session_id, service_cert)
cdm.set_service_certificate(session_id, service_cert)
challenge = cdm.get_license_challenge(session_id, PSSH(pssh_i), privacy_mode=True)
#second request to get actual license to parse license
licence_res = requests.post(lic_url, headers=headers, data=challenge)
print("The lic to parse:", licence_res.json()['license'])
cdm.parse_license(session_id, licence_res.json()['license'])
Here is the result:
First lic content request to get cert b'{"ec":0,"license":"CAUSxwUKwQIIAxIQFwW5F8wSBIaLBjM6L3cqjBiCtIKSBSKOAjCCAQoCggEBAJntWzsyfateJO/DtiqVtZhSCtW8yzdQPgZFuBTYdrjfQFEEQa2M462xG7iMTnJaXkqeB5UpHVhYQCOn4a8OOKkSeTkwCGELbxWMh4x+Ib/7/up34QGeHleB6KRfRiY9FOYOgFioYHrc4E+shFexN6jWfM3rM3BdmDoh+07svUoQykdJDKR+ql1DghjduvHK3jOS8T1v+2RC/THhv0CwxgTRxLpMlSCkv5fuvWCSmvzu9Vu69WTi0Ods18Vcc6CCuZYSC4NZ7c4kcHCCaA1vZ8bYLErF8xNEkKdO7DevSy8BDFnoKEPiWC8La59dsPxebt9k+9MItHEbzxJQAZyfWgkCAwEAAToUbGljZW5zZS53aWRldmluZS5jb20SgAOuNHMUtag1KX8nE4j7e7jLUnfSSYI83dHaMLkzOVEes8y96gS5RLknwSE0bv296snUE5F+bsF2oQQ4RgpQO8GVK5uk5M4PxL/CCpgIqq9L/NGcHc/N9XTMrCjRtBBBbPneiAQwHL2zNMr80NQJeEI6ZC5UYT3wr8+WykqSSdhV5Cs6cD7xdn9qm9Nta/gr52u/DLpP3lnSq8x2/rZCR7hcQx+8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wPFanhi7xoh1uk2Bc7yvYNik+heDJc26DNwkOnuWRoy8iWJYnqxDjhwESXXror+GvcBmWlSn5/13wn7gXKyI0hAViImBHXwoFE3XntEpyt4NoKGoJOR50s6lH5Y2+Vm7AyQZZKJXkoplP7Zi1QlvjpiHnx1LV64P5n5vERlXw3FY0ya2vtKQV2mj4fGDZurJr/NZQpMnnMD/hOjncFJU+CKFYMRJo8cys88S5iiCSEW3FBIc3bEYo42a3uvPgIql3iLNqb22yXWDGnBWlctqoHbNWD9XtCNsdWZtM8EUc9ATzUUI9VxsT1xQAMNvvgNqA+LQJbMNv7t5Jdujg7AkV9rT9SBUROrmDbpp1anqrQP7o=
Here is the result of parsing the license:
File /usr/local/lib/python3.11/site-packages/pywidevine/cdm.py:392, in Cdm.parse_license(self, session_id, license_message)
390 raise DecodeError(license_message)
391 except DecodeError as e:
--> 392 raise InvalidLicenseMessage(f"Could not parse license_message as a SignedMessage, {e}")
393 license_message = signed_message
395 if not isinstance(license_message, SignedMessage):
InvalidLicenseMessage: Could not parse license_message as a SignedMessage, Error parsing message
Could you please check this case and suggest me how to solve this problem? Thank you!
this is not possible to answer without the lic_url
and similar values.
The license value does not seem to be a valid License message. It could be encrypted or XOR'd or something. This is not something I can help with.