HI
I have a .wvd device file. My pywidevine script can't get a license from the server, but I can capture it via Android browser (same .wvd). The license comes as a base64 string in JSON format.
Can I use this Android-captured license with my .wvd file on PC to extract decryption keys? If yes, what's the proper way to parse it?
What I get from Android: {"license":"MDAwMDAw..."} (base64 string)
What I have: Same .wvd file, correct PSSH
Issue: parse_license() fails with InvalidLicenseMessage
Merci![]()
Support our site by donate $5 directly to us Thanks!!!
Try StreamFab Downloader and download streaming video from Netflix, Amazon!
Try StreamFab Downloader and download streaming video from Netflix, Amazon!
+ Reply to Thread
Results 1 to 7 of 7
-
-
Yes you can, I've hit this problem as well when trying to get around VdoCipher (which is probably what you're trying to do as well). First, make sure that your device doesn't support L1 if the device you dumped is L3 (which it likely is). When I tried this and dumped a WVD I wasn't aware that Chrome on Android and Zen Player were actually using L1 (Firefox doesn't support it, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1988424).
When trying to parse the license, move the last 6 base64 chars to the front of the string (at least on the web player) to make it parsable. If you did everything correctly the script below should be able to recover the keys:
Code:import base64 from Crypto.Cipher import PKCS1_OAEP from Crypto.Hash import HMAC, SHA256 from pywidevine import Cdm, Device, Key from pywidevine.exceptions import SignatureMismatch from pywidevine.license_protocol_pb2 import SignedMessage, License if __name__ == '__main__': device = Device.load("device.wvd") decrypter = PKCS1_OAEP.new(device.private_key) challenge_bytes = base64.b64decode("CAES...") challenge_signed_message = SignedMessage() challenge_signed_message.ParseFromString(challenge_bytes) licence_bytes = base64.b64decode("CAIS...") licence_signed_message = SignedMessage() licence_signed_message.ParseFromString(licence_bytes) context = Cdm.derive_context(challenge_signed_message.msg) enc_key, mac_key_server, _ = Cdm.derive_keys( *context, key=decrypter.decrypt(licence_signed_message.session_key) ) computed_signature = HMAC. \ new(mac_key_server, digestmod=SHA256). \ update(licence_signed_message.oemcrypto_core_message or b""). \ update(licence_signed_message.msg). \ digest() # If this doesn't work you didn't use the same device as your phone if licence_signed_message.signature != computed_signature: raise SignatureMismatch("Signature Mismatch on License Message, rejecting license") licence = License() licence.ParseFromString(licence_signed_message.msg) keys = [ Key.from_key_container(key, enc_key) for key in licence.key ] for key in keys: print(f"[{key.type}] {key.kid.hex}:{key.key.hex()}")Bypass HMACs, One-time-tokens and Lic.Wrapping: https://github.com/DevLARLEY/WidevineProxy2 -
Thank you for your help. I did everything as you said, but I’m getting this error:
key = decrypter.decrypt(licence_signed_message.session_k ey)
File "C:\Users\Administrator\AppData\Local\Programs\Pyt hon\Python39\lib\site-packages\Crypto\Cipher\PKCS1_OAEP.py", line 191, in decrypt
raise ValueError("Incorrect decryption.")
(https://license.vdocipher.com/auth) -
This proves that the challenge was not generated by your widevine device
Bypass HMACs, One-time-tokens and Lic.Wrapping: https://github.com/DevLARLEY/WidevineProxy2 -
"No, it’s the same; I extracted the WVD myself
Does it change if the phone is flashed with another firmware?! Anyway, thank you so much for your help!"
-
-
I think they maybe do for some limited amount of L3 devices, but every L3 I've tried doesn't work
Bypass HMACs, One-time-tokens and Lic.Wrapping: https://github.com/DevLARLEY/WidevineProxy2
Similar Threads
-
HELP: How to create Widevine License Server
By panji in forum Video Streaming DownloadingReplies: 0Last Post: 18th Mar 2025, 20:22 -
get license url widevine
By aletaladro in forum Video Streaming DownloadingReplies: 12Last Post: 14th Nov 2023, 09:39 -
Help with figuring out license in widevine
By venixop in forum Video Streaming DownloadingReplies: 0Last Post: 21st Feb 2023, 15:00 -
WKS-KEY help license/widevine
By ahmedani in forum Video Streaming DownloadingReplies: 3Last Post: 12th Jul 2022, 14:21 -
widevine license token help
By birbal1 in forum Video Streaming DownloadingReplies: 3Last Post: 1st Dec 2021, 23:44


Quote