Commit Graph

259 Commits

Author SHA1 Message Date
rlaphoenix
2648d1c669 PSSH: Return Base64 representation with __str__ 2022-12-26 23:47:43 +00:00
rlaphoenix
bc2b5beef4 PSSH: Update class doc-string
It's no longer as Widevine-biased as it once was.
2022-12-26 23:46:40 +00:00
rlaphoenix
11284eddfb PSSH: Allow specifying the System ID to use 2022-12-26 23:44:58 +00:00
rlaphoenix
61097ce6de PSSH: Parse PlayReadyObjects efficiently, parse multiple records
The previous method was overall fine, but assumed only one PlayReadyHeader was in the PlayReadyObject. It also incorrectly assumed the start data to be garbage data when it's actually the header for the PlayReadyObject.
2022-12-26 23:35:29 +00:00
rlaphoenix
3a910bd03a PSSH: Fix loading of PlayReadyHeaders
Previously it would load PlayReadyHeader data under Widevine's SystemId breaking all PlayReady checks.

The actual PlayReadyHeader init_data still needs code to parse it into an object.
2022-12-26 23:27:51 +00:00
rlaphoenix
e31ba61302 PSSH: Create a string representation 2022-12-26 22:39:34 +00:00
rlaphoenix
0e4275bd1e Create and use utility to strip namespaces from XML data
Namespaces cause problems with the xpath calls when dealing with PlayReadyHeader's on some versions.
2022-12-26 22:38:02 +00:00
rlaphoenix
e0365ff2bb
Merge pull request #21 from rlaphoenix/dependabot/pip/certifi-2022.12.7
Bump certifi from 2022.6.15 to 2022.12.7
2022-12-09 20:22:23 +00:00
dependabot[bot]
ae95aeec96
Bump certifi from 2022.6.15 to 2022.12.7
Bumps [certifi](https://github.com/certifi/python-certifi) from 2022.6.15 to 2022.12.7.
- [Release notes](https://github.com/certifi/python-certifi/releases)
- [Commits](https://github.com/certifi/python-certifi/compare/2022.06.15...2022.12.07)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-09 07:17:48 +00:00
rlaphoenix
1b40c2b369 PSSH: Set Key IDs more effectively via set_key_ids()
This reduces reading complexity of why and when pssh.set_key_ids() was being run. Generally less code repetition effectively.
2022-11-18 09:40:55 +00:00
rlaphoenix
05b30b3a89 PSSH: Only craft PSSH with key_IDs set if version is 1 2022-11-18 09:18:52 +00:00
rlaphoenix
7a993206a1 PSSH: Ensure key IDs are UUIDs instead of Bytes
This reduces code duplication when actually using those key_ids.
2022-11-18 09:09:01 +00:00
rlaphoenix
2d2359f9a2 PSSH: Fix key_IDs field when creating a new PSSH box 2022-11-18 08:49:33 +00:00
rlaphoenix
8146e055e6 Update Changelog for v1.5.2 2022-11-10 18:20:06 +00:00
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