Giter Site home page Giter Site logo

wks-key's People

Contributors

sasuke-duck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wks-key's Issues

Ciphertext with incorrect length

I get this error witch certain PSSH. Example:

License URL: https://lic.drmtoday.com/license-proxy-widevine/cenc/

Input MPD URL: https://dash.hoopladigital.com/via_hdnfy207a/Manifest.mpd

Generating PSSH:.....

PSSH: AAAAVHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAADQIARIQmrqeB0TpzjSbHIDSSLtrehoIY2FzdGxhYnMiEJq6ngdE6c40mxyA0ki7a3oqAlNE
/home/removed/Downloads/wks-keys_v3/pywidevine/L3/cdm/cdm.py:260: RuntimeWarning: Unexpected end-group tag: Not all data was converted
  license.ParseFromString(base64.b64decode(license_b64))
Traceback (most recent call last):
  File "./keys.py", line 46, in <module>
    correct, keys = WV_Function(pssh, lic_url)
  File "./keys.py", line 42, in WV_Function
    wvdecrypt.update_license(license_b64)
  File "/home/removed/Downloads/wks-keys_v3/pywidevine/L3/decrypt/wvdecryptcustom.py", line 58, in update_license
    self.cdm.provide_license(self.session, license_b64)
  File "/home/removed/Downloads/wks-keys_v3/pywidevine/L3/cdm/cdm.py", line 275, in provide_license
    session.session_key = oaep_cipher.decrypt(license.SessionKey)
  File "/home/removed/.local/lib/python3.8/site-packages/Cryptodome/Cipher/PKCS1_OAEP.py", line 167, in decrypt
    raise ValueError("Ciphertext with incorrect length.")
ValueError: Ciphertext with incorrect length.

Suggestion:-

You've taken a decision to parse the MPD to get PSSH with option for a manual input on failing to find it. All sensible stuff.

Why not go the extra mile if PSSH isn't found,? Find and create the PSSH from the Default Kid instead. There are Kid to pssh decoders around since forever. Hee is one.

import base64

def createpsshfromkid(kid_value):
kid_value = kid_value.replace('-', '')
assert len(kid_value) == 32 and not isinstance(kid_value, bytes), "wrong KID length"
array_of_bytes = bytearray(b'\x00\x00\x002pssh\x00\x00\x00\x00')
array_of_bytes.extend(bytes.fromhex("edef8ba979d64acea3c827dcd51d21ed"))
array_of_bytes.extend(b'\x00\x00\x00\x12\x12\x10')
array_of_bytes.extend(bytes.fromhex(kid_value.replace("-", "")))
return base64.b64encode(bytes.fromhex(array_of_bytes.hex())).decode('utf-8')

kid = input("Enter the KID:")

print(createpsshfromkid(kid))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.