Application DRM added
authorsunggun.jung <sunggun.jung@samsung.com>
Mon, 19 Nov 2012 04:43:42 +0000 (13:43 +0900)
committersunggun.jung <sunggun.jung@samsung.com>
Mon, 19 Nov 2012 04:55:02 +0000 (13:55 +0900)
Change-Id: Ia415888bb1b37ec2526cd5a25df67848b42f8f69

CMakeLists.txt
packaging/osp-installer.spec
src/Util/InstallerUtil.cpp

index b4fc021..a9bcbaa 100755 (executable)
@@ -19,6 +19,7 @@ INCLUDE_DIRECTORIES(
        /usr/include/osp/system
        /usr/include/libxml2
        /usr/include/system
+       /usr/include/drm-intel
        inc
        src/Context
        src/Installer
@@ -69,6 +70,7 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
 SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
 
 TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-appfw -lxml2 -lpkgmgr_installer -lpkgmgr_parser -lglib-2.0 -lapp2ext" -Wl,--allow-shlib-undefined)
+TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib -ldrm-service-core-intel")
 
 ADD_SUBDIRECTORY(plugin)
 
index c0c090d..a292eb0 100755 (executable)
@@ -15,6 +15,8 @@ BuildRequires:  pkgconfig(pkgmgr-parser)
 BuildRequires:  pkgconfig(app2sd)
 BuildRequires:  pkgconfig(libwbxml2)
 BuildRequires:  pkgconfig(osp-appfw)
+BuildRequires:  pkgconfig(drm-service-core-intel-plugin)
+
 BuildRequires:  osp-appfw-internal-devel
 BuildRequires: boost-devel
 
index b6f4ed7..6b47f51 100755 (executable)
@@ -33,6 +33,8 @@
 #include "InstallerDefs.h"
 #include "InstallerUtil.h"
 
+#include <drm-oem-intel.h>
+
 using namespace Osp::Base;
 using namespace Osp::Base::Collection;
 using namespace Osp::App;
@@ -332,15 +334,55 @@ InstallerUtil::ChangeDirectoryPermission(const String& filePath, int mode)
 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