Skip to content

Commit adb0c34

Browse files
committed
[LICENSE] The KeyBox is licensed material, it can not be made available publicly.
1 parent 8fb04da commit adb0c34

8 files changed

+52
-495
lines changed

CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ find_package(WideVine REQUIRED)
3333

3434
set(PLUGIN_SOURCES
3535
HostImplementation.cpp
36-
DeviceCertificate.cpp
3736
MediaSession.cpp
3837
MediaSystem.cpp)
3938

DeviceCertificate.cpp

-337
This file was deleted.

DeviceCertificate.h

-29
This file was deleted.

HostImplementation.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*/
1919

2020
#include "HostImplementation.h"
21-
#include "DeviceCertificate.h"
2221

2322
using namespace widevine;
2423
using namespace WPEFramework;

HostImplementation.h

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
#include "cdm.h"
2424
#include "override.h"
2525

26+
extern uint8_t* kDeviceCert;
27+
extern size_t kDeviceCertSize;
28+
2629
#include <core/core.h>
2730

2831
namespace CDMi {

MediaSystem.cpp

+49
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
#include <iostream>
2323
#include <sstream>
2424
#include <sys/utsname.h>
25+
#include <core/core.h>
26+
27+
uint8_t* kDeviceCert = nullptr;
28+
size_t kDeviceCertSize = 0;
29+
30+
using namespace WPEFramework;
2531

2632
namespace CDMi {
2733

@@ -33,6 +39,24 @@ class WideVine : public IMediaKeys, public widevine::Cdm::IEventListener
3339

3440
typedef std::map<std::string, MediaKeySession*> SessionMap;
3541

42+
class Config : public Core::JSON::Container {
43+
public:
44+
Config(const Config&) = delete;
45+
Config& operator=(const Config&) = delete;
46+
Config()
47+
: Core::JSON::Container()
48+
, KeyBox()
49+
{
50+
Add(_T("keybox"), &KeyBox);
51+
}
52+
~Config()
53+
{
54+
}
55+
56+
public:
57+
Core::JSON::String KeyBox;
58+
};
59+
3660
public:
3761
WideVine()
3862
: _adminLock()
@@ -86,6 +110,31 @@ class WideVine : public IMediaKeys, public widevine::Cdm::IEventListener
86110
if (_cdm != nullptr) {
87111
delete _cdm;
88112
}
113+
114+
if (kDeviceCert != nullptr) {
115+
delete [] kDeviceCert;
116+
kDeviceCert = nullptr;
117+
kDeviceCertSize = 0;
118+
}
119+
}
120+
121+
void Initialize(const WPEFramework::PluginHost::IShell * shell, const std::string& configline)
122+
{
123+
Config config;
124+
config.FromString(configline);
125+
126+
if (config.KeyBox.IsSet() == true) {
127+
Core::DataElementFile dataBuffer(config.KeyBox.Value(), Core::File::USER_READ);
128+
129+
if(dataBuffer.IsValid() == false) {
130+
TRACE_L1(_T("Failed to open %s"), config.KeyBox.Value().c_str());
131+
} else {
132+
kDeviceCertSize = dataBuffer.Size();
133+
kDeviceCert = new uint8_t[kDeviceCertSize];
134+
135+
::memcpy(kDeviceCert, dataBuffer.Buffer(), dataBuffer.Size());
136+
}
137+
}
89138
}
90139

91140
virtual CDMi_RESULT CreateMediaKeySession(

tools/keybox/main.c

-127
This file was deleted.

tools/keybox/testkeybox.bin

-256 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)