Commit Graph

195 Commits

Author SHA1 Message Date
rlaphoenix 58208ab68f Bump to v1.5.2 2022-11-10 18:19:55 +00:00
rlaphoenix 7996a3d91c Cdm: Add support for Signatures by OEM Crypto API v16
OEM Crypto API v16 changed slightly how the Signature algorithm was calculated. The `oemcrypto_core_message` field is now basically prefixed to the full license message for the signature.

This fixes support for devices like Roku OS 11.5.0, among others.
2022-11-01 11:04:11 +00:00
rlaphoenix 37d466b9a8 Update Changelog for v1.5.1 2022-10-23 15:20:59 +01:00
rlaphoenix 05b6753aa6 Bump to v1.5.1 2022-10-23 15:20:49 +01:00
rlaphoenix ada7cb009e Cdm: Improve reliability of computing some License Signatures 2022-10-23 15:07:15 +01:00
rlaphoenix 7c91f2c59a PSSH: Dump the same version as the loaded data
Currently, even though self.version would be 0, it would dump as a version=1 box with key_IDs set to data (where possible).

This is because pymp4 sets the version to 1 if key_IDs is set with data, as that would make it a v1 PSSH box. So effectively .dump() and .dumps() forces a v1 box as output even if you loaded or created a v0 box.

Fixes #16
2022-10-13 11:21:47 +01:00
rlaphoenix eaa26399e0 Cdm: Reduce maximum concurrent sessions to 16
It seems 16 is the more common limit on moderm OEM Crypto API systems (at least L1). It's also a more reasonable limit.

This also encourages people to .close() their session more. It also makes it quicker to notice if a codebase is forgetting to do a .close() call somewhere as you will reach the limit faster and easier now.

In normal use cases, a limit of 16 sessions will not be a problem as long as the sessions are being closed correctly.
2022-09-28 07:54:09 +01:00
rlaphoenix 74f960aeba Store Service Certificate in session as SignedDrmCertificate
This is for less effort to use the Service Certificate later on. We have no reason to keep the SignedMessage shell as it's just a way to send it as a message from License Acquisition APIs.
2022-09-28 07:46:52 +01:00
rlaphoenix 42b825dcd5 Cdm: Add parsing error handlers to Service Cert DrmCertificates 2022-09-28 07:37:17 +01:00
rlaphoenix fa00bbd8e4 Cdm: Fix acquisition of provider_id when removing a service cert
The logic of parsing the session's stored service cert to get the provider_id was wrong. It assumed it was a SignedDrmCertificate, when in reality it was a SignedMessage containing a SignedDrmCertificate.

It would also panic if you try to remove a certificate when none was set.
2022-09-28 06:49:41 +01:00
rlaphoenix a4c6f98650 Add import path shortcuts for Classes
This is so you don't have to do e.g., `from pywidevine.pssh import PSSH` and instead can do `from  pywidevine import PSSH`. You can still do it the other way, but now you have the choice.
2022-09-28 06:40:52 +01:00
rlaphoenix 24297d577e PSSH: Initialize System IDs via UUIDs hex arg
This is just to lower the overall character count for the same end result.
2022-09-28 06:36:26 +01:00
rlaphoenix e90371922c PSSH: Add support for Key IDs of lengths other than 16 bytes
This is required for cases like Google's testing DASH manifests, e.g., 'tears' MPD. It assumes the Key ID as a number, which can support up to 16 bytes in this fashion (therefore technically 15 in our scenario as 16 byte Key_IDs can load normally).

Fixes #13
2022-09-28 06:21:28 +01:00
rlaphoenix c5c620ea84 Update Changelog for v1.5.0 2022-09-24 12:07:14 +01:00
rlaphoenix d698b1d3c4 Bump to v1.5.0 2022-09-24 12:05:53 +01:00
rlaphoenix e585102798 Update protobuf to v4.21.6 and recompile buffers 2022-09-24 12:05:20 +01:00
rlaphoenix e001ef0291 Add flake8 configuration to ignore compiled protobuffers 2022-09-24 12:03:16 +01:00
rlaphoenix 34eeaf746f Update Changelog for v1.4.4 2022-09-24 07:11:18 +01:00
rlaphoenix 272bb419b1 Bump to v1.4.4 2022-09-24 07:09:44 +01:00
rlaphoenix cef7b7a890
Merge pull request #12 from rlaphoenix/dependabot/pip/protobuf-3.19.5
Bump protobuf from 3.19.3 to 3.19.5
2022-09-24 07:04:39 +01:00
dependabot[bot] 0caccfd014
Bump protobuf from 3.19.3 to 3.19.5
Bumps [protobuf](https://github.com/protocolbuffers/protobuf) from 3.19.3 to 3.19.5.
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf/blob/main/generate_changelog.py)
- [Commits](https://github.com/protocolbuffers/protobuf/compare/v3.19.3...v3.19.5)

---
updated-dependencies:
- dependency-name: protobuf
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-23 22:25:47 +00:00
rlaphoenix 23511f1d85 Update Changelog for v1.4.3 2022-09-10 21:55:20 +01:00
rlaphoenix fe90155a27 Bump to v1.4.3 2022-09-10 21:55:12 +01:00
rlaphoenix cff40142b8 RemoteCdm: Bump minimum server ver. to 1.4.3 2022-09-10 21:53:33 +01:00
rlaphoenix 16fd204743 Serve: Properly enforce privacy mode 2022-09-10 21:53:14 +01:00
rlaphoenix e8226f605c Serve: Use new get_service_certificate() to properly enforce privacy mode 2022-09-10 21:36:21 +01:00
rlaphoenix 768c4e7851 Cdm: Implement get_service_certificate() 2022-09-10 21:36:21 +01:00
rlaphoenix 987eee2b0f Cdm: More clearly represent a DecodeError in set_service_cert 2022-09-10 21:19:27 +01:00
rlaphoenix 8306e092e8 Serve: Add privacy_mode flag for get_license_challenge 2022-09-10 20:43:59 +01:00
rlaphoenix deefb6fbe1 Serve: Don't redefine built-in `open` 2022-09-10 20:39:50 +01:00
rlaphoenix b0453b64ac Remove f-strings without any expressions 2022-09-10 20:38:36 +01:00
rlaphoenix f0df2f4490 PSSH: Merge some collapsible if statements 2022-09-10 20:37:41 +01:00
rlaphoenix 7436c60d00 Replace all lazy log formatting with logging formatting
DeepSource (PYL-W1203)
2022-09-10 20:35:39 +01:00
rlaphoenix 7c826624a2 docs: Add a minimal example 2022-09-10 20:15:24 +01:00
rlaphoenix 3ef69deb29 docs: Remove the Protocol from README
There's no need for it. The image isn't even done particularly well. It's too specific to a browser scenario with some information not properly reflected/explained in the legend.

I have no reason to try make my own or look for an alternative. If someone is particularly interested they can look online for more or less broad explanations as they see fit.
2022-09-10 19:57:03 +01:00
rlaphoenix b766e5e992 docs: Add troubleshooting steps to README 2022-09-10 19:54:32 +01:00
rlaphoenix 3cca1aebcd docs: Add installation instructions to README 2022-09-10 19:53:59 +01:00
rlaphoenix 31d9bfd072 docs: Add list of features to README 2022-09-10 19:32:28 +01:00
rlaphoenix 1156edfef7 deps: Update lxml to >=4.9.1
This is to fix some security vulnerabilities. The main dependency locking this to 4.8.0 for so long was pycaption, which was updated to support 4.9.1 in v2.1.0.
2022-09-07 12:50:03 +01:00
rlaphoenix 24dfd828cb Update Changelog for v1.4.2 2022-09-05 13:03:46 +01:00
rlaphoenix 78986eb245 Bump to v1.4.2 2022-09-05 13:02:41 +01:00
rlaphoenix 362510de68 Device: Re-raise DecodeErrors within some DecodeError handlers 2022-09-05 12:55:06 +01:00
rlaphoenix fa499a6a53 Improve verification of proto parsing across Cdm, RemoteCdm and Device
This ensures that a partially parsing input (because of optional flags in the proto) does not get past any verification checks.

This prevents issues like an invalid License Challenging from getting an exception later down the line, as well as possibility of it also passing that check by pure luck, resulting in hard to debug issues.
2022-09-05 12:49:27 +01:00
rlaphoenix 23c766af71 Cdm: Improve accuracy of OEMCrypto request_id research
The main change is that it isn't stored as 16-bytes. Effectively not stored like it realistically probably meant to be. It's instead stored as a hex string that was then encoded to bytes (32 data is now taken up).

But I've also improved the comments about my research for the first half of the request ID. This research is likely still incomplete as I'm just not fully sure about the randomness of bytes 5-8.
2022-09-03 19:43:31 +01:00
rlaphoenix 2af929a83d Cdm: Use reversed OEMCrypto request id formula for Android devices
It's effectively 8 random bytes with a counter thats right-padded (to 8 bytes). This counter is the Session number.
2022-08-21 22:39:26 +01:00
rlaphoenix 838df7c22b Set a unique number to each Session of each Cdm 2022-08-21 22:37:28 +01:00
rlaphoenix 9191e0258f Update Changelog for v1.4.1 2022-08-17 17:26:57 +01:00
rlaphoenix cabcc1c2c2 Bump to v1.4.1 2022-08-17 17:26:44 +01:00
rlaphoenix 077a3aa6be PSSH: Rework from_playready_pssh class method as normal method 2022-08-06 13:48:39 +01:00
rlaphoenix 0d13d4184b PSSH: Rework get_key_ids as key_ids property 2022-08-06 13:45:30 +01:00