From 25e03529f6bbfbf7701fd554f89b873fd398b0ef Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Wed, 6 Dec 2023 16:00:52 +0000 Subject: [PATCH] Simplify verification of parsing in Cdm.set_service_certificate --- pywidevine/cdm.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pywidevine/cdm.py b/pywidevine/cdm.py index 758c459..256cedf 100644 --- a/pywidevine/cdm.py +++ b/pywidevine/cdm.py @@ -222,13 +222,10 @@ class Cdm: try: signed_message.ParseFromString(certificate) - if ( - signed_message.SerializeToString() == certificate or + if all( # See https://github.com/devine-dl/pywidevine/issues/41 - all( - bytes(chunk) == signed_message.SerializeToString() - for chunk in zip(*[iter(certificate)] * len(signed_message.SerializeToString())) - ) + bytes(chunk) == signed_message.SerializeToString() + for chunk in zip(*[iter(certificate)] * len(signed_message.SerializeToString())) ): signed_drm_certificate.ParseFromString(signed_message.msg) else: