#include "InstallerDefs.h"
#include "InstallerUtil.h"
+#include <drm-oem-intel.h>
+
using namespace Osp::Base;
using namespace Osp::Base::Collection;
using namespace Osp::App;
bool
InstallerUtil::IsDrmFile(const Osp::Base::String& path)
{
- AppLogTag(OSP_INSTALLER, "+ IsDrmFile() called, path=[%ls]", path.GetPointer());
- return false;
+ bool res = true;
+ char* pFilePath = null;
+ result r = E_SUCCESS;
+ int isDrm = 0;
+
+ pFilePath = _StringConverter::CopyToCharArrayN(path);
+ TryCatch(pFilePath, r = GetLastResult(), "[osp-installer] pFilePath is null");
+
+ isDrm = drm_oem_intel_isDrmFile(pFilePath);
+ if(isDrm == 1)
+ {
+ AppLogTag(OSP_INSTALLER, "IsDrmFile() called, packagePath=%ls is drm file", path.GetPointer());
+ }
+ else
+ {
+ res = false;
+ AppLogTag(OSP_INSTALLER, "IsDrmFile() called, packagePath=%ls isn't drm file", path.GetPointer());
+ }
+
+ CATCH:
+ delete [] pFilePath;
+ return res;
}
bool
InstallerUtil::DecryptPackage(const Osp::Base::String& packagePath)
{
- AppLogTag(OSP_INSTALLER, "+ DecryptPackage() called, packagePath=[%ls]", packagePath.GetPointer());
- return true;
+ bool res = true;
+ char* pFilePath = null;
+ result r = E_SUCCESS;
+ int result = 0;
+
+ pFilePath = _StringConverter::CopyToCharArrayN(packagePath);
+ TryCatch(pFilePath, r = GetLastResult(), "[osp-installer] pFilePath is null");
+
+ result = drm_oem_intel_decrypt_package(pFilePath, pFilePath);
+ if(result == 1)
+ {
+ AppLogTag(OSP_INSTALLER, "DecryptPackage() called, packagePath=%ls, decrpyt success", packagePath.GetPointer());
+ }
+ else
+ {
+ AppLogTag(OSP_INSTALLER, "DecryptPackage() called, packagePath=%ls, decrypt failed", packagePath.GetPointer());
+ res = false;
+ }
+
+CATCH:
+ delete [] pFilePath;
+ return res;
}
String