mirror of
				https://github.com/devine-dl/pywidevine.git
				synced 2025-11-04 11:54:50 +00:00 
			
		
		
		
	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.
This commit is contained in:
		
							parent
							
								
									a4c6f98650
								
							
						
					
					
						commit
						fa00bbd8e4
					
				@ -185,10 +185,16 @@ class Cdm:
 | 
				
			|||||||
            raise InvalidSession(f"Session identifier {session_id!r} is invalid.")
 | 
					            raise InvalidSession(f"Session identifier {session_id!r} is invalid.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if certificate is None:
 | 
					        if certificate is None:
 | 
				
			||||||
            drm_certificate = DrmCertificate()
 | 
					            if session.service_certificate:
 | 
				
			||||||
            drm_certificate.ParseFromString(session.service_certificate.drm_certificate)
 | 
					                signed_drm_certificate = SignedDrmCertificate()
 | 
				
			||||||
 | 
					                signed_drm_certificate.ParseFromString(session.service_certificate)
 | 
				
			||||||
 | 
					                drm_certificate = DrmCertificate()
 | 
				
			||||||
 | 
					                drm_certificate.ParseFromString(signed_drm_certificate.drm_certificate)
 | 
				
			||||||
 | 
					                provider_id = drm_certificate.provider_id
 | 
				
			||||||
 | 
					            else:
 | 
				
			||||||
 | 
					                provider_id = None
 | 
				
			||||||
            session.service_certificate = None
 | 
					            session.service_certificate = None
 | 
				
			||||||
            return drm_certificate.provider_id
 | 
					            return provider_id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if isinstance(certificate, str):
 | 
					        if isinstance(certificate, str):
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user