How to use
Closed this issue · 4 comments
Is the Provisioned CDM Path, using same style with others ?
Thank you
You create a Device object, e.g., by doing Device.load(r"C:/Path/To/a/device.wvd")
, this is then passed to the CDM.
The .wvd file can be created from an RSA PEM or DER private key file and Client ID Blob by manually creating the Device object and then using the dump()
method.
from pywidevine.device import Device
from pathlib import Path
# e.g., for an Android L3:
device = Device(
type_=Device.Types.ANDROID,
security_level=3,
flags=None,
private_key=Path(r"C:/Path/To/a/Private-Key-PEM-or-DER-file").read_bytes(),
client_id=Path(r"C:/Path/To/a/Client-ID-Blob-file").read_bytes()
)
# save it to a .wvd file for easier loading next time
device.dump(r"C:/Where/To/save/the/device.wvd")
Note: If you have a VMP blob (a FileHashes blob) and it's not added to the Client ID blob, then the .wvd file will effectively have no VMP or File Hashes verification. The FileHashes is expected to be inside the Client ID blob to reduce possible duplication.
You can add the VMP blob data to the Client ID after creating the Device following above, like so:
device.client_id.vmp_data = Path(r"C:/Path/To/VMP-Blob").read_bytes()
This assumes that the data within the VMP blob is just a FileHashes object, which should be the case.
Take a look at the License command in main.py for an example on how you can import and use pywidevine in your own projects.
Thank you for the explanation Sir. Really appreciate it 😄
I've added a new create-device
command to the CLI which you can use to convert to the .wvd format a bit easier: See 5e93d63