forked from NooodyFR/WidevineClient
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCDMApi.cs
More file actions
28 lines (24 loc) · 813 Bytes
/
CDMApi.cs
File metadata and controls
28 lines (24 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Collections.Generic;
namespace WidevineClient.Widevine
{
public class CDMApi
{
string SessionId { get; set; }
public byte[] GetChallenge(string initDataB64, string certDataB64, bool offline = false, bool raw = false)
{
SessionId = CDM.OpenSession(initDataB64, "chrome_1610", offline, raw);
CDM.SetServiceCertificate(SessionId, Convert.FromBase64String(certDataB64));
return CDM.GetLicenseRequest(SessionId);
}
public bool ProvideLicense(string licenseB64)
{
CDM.ProvideLicense(SessionId, Convert.FromBase64String(licenseB64));
return true;
}
public List<ContentKey> GetKeys()
{
return CDM.GetKeys(SessionId);
}
}
}