SET(ETC_DIR ${PROJECT_SOURCE_DIR}/etc)
INSTALL(PROGRAMS ${ETC_DIR}/wrt_preinstall_widgets.sh DESTINATION /etc/rc.d/init.d)
+
+# Below Code is temporary. When DRM engine is provided it will be removed.
+IF("${ARCH}" MATCHES "arm")
+ INSTALL(FILES ${ETC_DIR}/drm/armv7l/libdrm-service-core-intel.so.0.0.0 DESTINATION lib)
+ELSE("${ARCH}" MATCHES "arm")
+ INSTALL(FILES ${ETC_DIR}/drm/ix86/libdrm-service-core-intel.so.0.0.0 DESTINATION lib)
+ENDIF("${ARCH}" MATCHES "arm")
--- /dev/null
+libdrm-service-core-intel.so.0
\ No newline at end of file
--- /dev/null
+libdrm-service-core-intel.so.0.0.0
\ No newline at end of file
--- /dev/null
+libdrm-service-core-intel.so.0
\ No newline at end of file
--- /dev/null
+libdrm-service-core-intel.so.0.0.0
\ No newline at end of file
BuildRequires: pkgconfig(shortcut)
BuildRequires: pkgconfig(dpl-encryption)
BuildRequires: pkgconfig(capi-appfw-app-manager)
+BuildRequires: pkgconfig(drm-client)
+BuildRequires: pkgconfig(drm-trusted)
Requires: xmlsec1
+Provides: libdrm-service-core-intel.so.0
+
%description
Description: Wrt Installer for Tizen apps and Wac apps
%setup -q
%build
+# for drm temporary code
+%ifarch %{ix86}
+BUILD_ARCH_=x86
+%else
+BUILD_ARCH_=arm
+%endif
+
export LDFLAGS+="-Wl,--rpath=/usr/lib -Wl,--hash-style=both -Wl,--as-needed"
LDFLAGS="$LDFLAGS"
cmake . -DCMAKE_INSTALL_PREFIX=/usr \
-DDPL_LOG=ON \
-DCMAKE_PACKAGE_VERSION=%{version} \
+ -DARCH="$BUILD_ARCH_" \
-DCMAKE_BUILD_TYPE=%{?build_type:%build_type}
make %{?jobs:-j%jobs}
ln -s /etc/rc.d/init.d/wrt_preinstall_widgets.sh /etc/rc.d/rc3.d/S46lwrt_preinstall_widgets.sh
ln -s /etc/rc.d/init.d/wrt_preinstall_widgets.sh /etc/rc.d/rc5.d/S46lwrt_preinstall_widgets.sh
+# for drm temporary code
+mkdir -p /opt/var/drm/inteldrm
+mkdir -p own 0:5000 /opt/var/drm/inteldrm
+chmod 755 /opt/var/drm/inteldrm
+
+ln -s /usr/lib/libdrm-service-core-intel.so.0.0.0 /usr/lib/libdrm-service-core-intel.so.0
+ln -s /usr/lib/libdrm-service-core-intel.so.0 /usr/lib/libdrm-service-core-intel.so
+
%files
%manifest wrt-installer.manifest
%attr(755,root,root) %{_bindir}/wrt-installer
%attr(644,root,root) %{_datadir}/edje/wrt/*
/usr/etc/package-manager/backendlib/libwgt.so
%{_datadir}/license/%{name}
+# for drm temporary code
+/usr/lib/*.so*
${INSTALLER_SRC_DIR}/configuration_parser
${INSTALLER_SRC_DIR}/wrt-installer
${INSTALLER_SRC_DIR}/commons
+ ${INSTALLER_SRC_DIR}/commons/drm #this is temporary code for drm
${INSTALLER_SRC_DIR}/pkg-manager
)
tapi
shortcut
capi-appfw-app-manager
+ drm-client
+ drm-trusted
REQUIRED
)
${INSTALLER_STATIC_DEP_LIBRARIES}
)
+
+# Below Code is temporary. When DRM engine is provided it will be removed.
+MESSAGE("ARCH ${ARCH}")
+IF("${ARCH}" MATCHES "arm")
+ TARGET_LINK_LIBRARIES(${TARGET_INSTALLER_STATIC}
+ "-L${PROJECT_SOURCE_DIR}/etc/drm/armv7l -ldrm-service-core-intel" -Wl,--allow-shlib-undefine)
+ELSE("${ARCH}" MATCHES "arm")
+ TARGET_LINK_LIBRARIES(${TARGET_INSTALLER_STATIC}
+ "-L${PROJECT_SOURCE_DIR}/etc/drm/ix86 -ldrm-service-core-intel" -Wl,--allow-shlib-undefine)
+ENDIF("${ARCH}" MATCHES "arm")
+
SET_TARGET_PROPERTIES(${TARGET_INSTALLER_STATIC} PROPERTIES
COMPILE_FLAGS -fPIC)
--- /dev/null
+\r
+/********************************************************************************\r
+* Copyright ? 2004-2009 by INKA Entworks, Inc (www.inka.co.kr). *\r
+* All rights reserved. * \r
+* * \r
+* No parts of this source code may be in any way copied, reproduced, modified *\r
+* or distributed without the prior written consent of INKA Entworks, Inc. *\r
+* CPointerArray.h: interface for the CPointerArray class. *\r
+*********************************************************************************/ \r
+\r
+#ifndef __CPOINTERARRAY_H__\r
+#define __CPOINTERARRAY_H__\r
+\r
+\r
+#if !defined(AFX_CPOINTERARRAY_H__AB67E4BE_A233_4E3E_B257_9830D90326EE__INCLUDED_)\r
+#define AFX_CPOINTERARRAY_H__AB67E4BE_A233_4E3E_B257_9830D90326EE__INCLUDED_\r
+\r
+#if _MSC_VER > 1000\r
+#pragma once\r
+#endif // _MSC_VER > 1000\r
+\r
+//#include "Shp.h"\r
+#include "InkaTypes.h"\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /* __cplusplus */\r
+\r
+class CPointerArray \r
+{\r
+protected:\r
+ LPVOID* m_ppData;\r
+ int m_nMaxSize;\r
+ int m_nNumOfData;\r
+\r
+public:\r
+ CPointerArray();\r
+ virtual ~CPointerArray();\r
+\r
+ int Add( LPVOID pData );\r
+ int Remove( int nIndex );\r
+ LPVOID Get( int nIndex );\r
+ inline int GetCount() { return m_nNumOfData; }\r
+ inline void RemoveAll() { m_nNumOfData = 0; }\r
+};\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+#endif // !defined(AFX_CPOINTERARRAY_H__AB67E4BE_A233_4E3E_B257_9830D90326EE__INCLUDED_)\r
+#endif /* __CPOINTERARRAY_H__ */\r
--- /dev/null
+\r
+/********************************************************************************\r
+* Copyright ? 2004-2009 by INKA Entworks, Inc (www.inka.co.kr). *\r
+* All rights reserved. * \r
+* * \r
+* No parts of this source code may be in any way copied, reproduced, modified *\r
+* or distributed without the prior written consent of INKA Entworks, Inc. *\r
+* CXMLAttribute.h: interface for the CXMLAttribute class. *\r
+*********************************************************************************/ \r
+//#include "Shp.h"\r
+#include "InkaTypes.h"\r
+\r
+#if !defined(AFX_CXMLATTRIBUTE_H__2B925786_3613_47B0_B85D_CAF2053F46DB__INCLUDED_)\r
+#define AFX_CXMLATTRIBUTE_H__2B925786_3613_47B0_B85D_CAF2053F46DB__INCLUDED_\r
+\r
+#if _MSC_VER > 1000\r
+#pragma once\r
+#endif // _MSC_VER > 1000\r
+\r
+class CXMLAttribute \r
+{\r
+protected:\r
+ LPTSTR m_pszName;\r
+ LPTSTR m_pszValue;\r
+\r
+public:\r
+ CXMLAttribute();\r
+ virtual ~CXMLAttribute();\r
+\r
+ int SetName( LPCTSTR pszName );\r
+ int SetValue( LPCTSTR pszValue );\r
+\r
+ inline LPCTSTR GetName() { return m_pszName; }\r
+ inline LPCTSTR GetValue() { return m_pszValue; }\r
+};\r
+\r
+#endif // !defined(AFX_CXMLATTRIBUTE_H__2B925786_3613_47B0_B85D_CAF2053F46DB__INCLUDED_)\r
--- /dev/null
+\r
+/********************************************************************************\r
+* Copyright ? 2004-2009 by INKA Entworks, Inc (www.inka.co.kr). *\r
+* All rights reserved. * \r
+* * \r
+* No parts of this source code may be in any way copied, reproduced, modified *\r
+* or distributed without the prior written consent of INKA Entworks, Inc. *\r
+* CXMLElement.h: interface for the CXMLElement class. *\r
+*********************************************************************************/ \r
+\r
+#if !defined(AFX_CXMLELEMENT_H__B6A6A39B_1980_4A4F_B68B_E87B53A3EE9B__INCLUDED_)\r
+#define AFX_CXMLELEMENT_H__B6A6A39B_1980_4A4F_B68B_E87B53A3EE9B__INCLUDED_\r
+\r
+//#include "Shp.h"\r
+#include "InkaTypes.h"\r
+#include "CXMLAttribute.h"\r
+#include "CPointerArray.h"\r
+\r
+\r
+#if _MSC_VER > 1000\r
+#pragma once\r
+#endif // _MSC_VER > 1000\r
+\r
+class CXMLElement \r
+{\r
+protected:\r
+ LPTSTR m_pszName;\r
+ LPTSTR m_pszValue;\r
+ \r
+ CPointerArray m_pChilds;\r
+ CPointerArray m_pAttributes;\r
+ \r
+ int _SearchNodes( CPointerArray* ppaChildNodes, CXMLElement* pCurrent, LPCTSTR pszTagName, va_list args );\r
+\r
+public:\r
+ CXMLElement();\r
+ virtual ~CXMLElement();\r
+\r
+ int SetName( LPCTSTR pszName );\r
+ int SetValue( LPCTSTR pszValue );\r
+ int AddAttribute( LPCTSTR pszName, LPCTSTR pszValue );\r
+\r
+ inline LPCTSTR GetName() { return m_pszName; }\r
+ inline LPCTSTR GetValue() { return m_pszValue; }\r
+\r
+ int AddChild( CXMLElement* pChild );\r
+ LPCTSTR GetAttribute( LPCTSTR pszName );\r
+\r
+ inline int GetChildCount() { return m_pChilds.GetCount(); }\r
+ inline int GetAttributeCount() { return m_pAttributes.GetCount(); }\r
+ inline CXMLElement* GetChild( int nIndex ) { return (CXMLElement*)m_pChilds.Get( nIndex ); }\r
+ inline CXMLAttribute* GetAttribute( int nIndex ) { return (CXMLAttribute*)m_pAttributes.Get( nIndex ); }\r
+\r
+ int Find( CPointerArray* pSearchedChild, LPCTSTR pszChildName, ... );\r
+};\r
+\r
+#endif // !defined(AFX_CXMLELEMENT_H__B6A6A39B_1980_4A4F_B68B_E87B53A3EE9B__INCLUDED_)\r
--- /dev/null
+\r
+/********************************************************************************\r
+* Copyright ? 2004-2009 by INKA Entworks, Inc (www.inka.co.kr). *\r
+* All rights reserved. * \r
+* * \r
+* No parts of this source code may be in any way copied, reproduced, modified *\r
+* or distributed without the prior written consent of INKA Entworks, Inc. *\r
+* CXMLFile.h: interface for the CXMLFile class. *\r
+*********************************************************************************/ \r
+\r
+#if !defined(AFX_CXMLFILE_H__21F76587_B9C8_4407_9C16_186F3D47ADE1__INCLUDED_)\r
+#define AFX_CXMLFILE_H__21F76587_B9C8_4407_9C16_186F3D47ADE1__INCLUDED_\r
+\r
+//#include "Shp.h"\r
+#include "InkaTypes.h"\r
+#include "CXMLElement.h"\r
+\r
+#if _MSC_VER > 1000\r
+#pragma once\r
+#endif // _MSC_VER > 1000\r
+\r
+#ifndef IN\r
+ #define IN\r
+#endif\r
+\r
+#ifndef OUT\r
+ #define OUT\r
+#endif\r
+\r
+#define ELEMENT_QUEUE_MAX 2048\r
+class CXMLFile \r
+{\r
+protected:\r
+ LPCTSTR m_pszXML;\r
+ CXMLElement* m_paElementQueue[ ELEMENT_QUEUE_MAX ];\r
+ int m_nQueueIndex;\r
+ CXMLElement* m_pRoot;\r
+ \r
+ int _Parse();\r
+ int _GetElementName( LPTSTR pszElementName );\r
+ CXMLElement* _Pop();\r
+ int _Push( CXMLElement* p );\r
+ int _GetAttributeNameAndValue( LPTSTR pszName, LPTSTR pszValue );\r
+\r
+public:\r
+ CXMLFile();\r
+ virtual ~CXMLFile();\r
+\r
+ int LoadFromStream( LPCTSTR pszXML );\r
+ int LoadFromFile( LPCTSTR pszFileName );\r
+ inline CXMLElement* GetRoot() { return m_pRoot; }\r
+};\r
+\r
+#endif // !defined(AFX_CXMLFILE_H__21F76587_B9C8_4407_9C16_186F3D47ADE1__INCLUDED_)\r
--- /dev/null
+/*\r
+ * SHP\r
+ * Copyright (c) 2000-2007 UMTS Software Lab, Mobile Communication Division,\r
+ * Telecommunication Network Business, Samsung Electronics, Inc.\r
+ * All rights reserved.\r
+ *\r
+ * This software is the confidential and proprietary information\r
+ * of Samsung Electronics, Inc. ("Confidential Information"). You\r
+ * shall not disclose such Confidential Information and shall use\r
+ * it only in accordance with the terms of the license agreement\r
+ * you entered into with Samsung Electronics. \r
+ */\r
+\r
+/** \r
+ * @file InkaTypes.h\r
+ * @brief This file includes definitions of constants, \r
+ * enumerations, and datastructures for the Inka DRM service.\r
+# @author Jihyun Lee(ezhyun.lee@samsung.com)\r
+# @author Donghyun Yoo(marku.yoo@samsung.com)\r
+ * @version 1.0\r
+ */\r
+\r
+#ifndef INKA_DRM_TYPES_H\r
+#define INKA_DRM_TYPES_H\r
+\r
+//#include "shp.h"\r
+//#include "FileMgr.h"\r
+#include <stdio.h>\r
+#include <stdarg.h>\r
+\r
+#define _T\r
+#define IF_ERROR_GOTO( error ) if( FAILED( HRESULT_FROM_WIN32( error ) ) ) { nResult = ERRORMSG( error, NULL ); goto finish; }\r
+#define IF_TRUE_GOTO( cond, error ) if( cond ) { nResult = -1; goto finish; }\r
+\r
+#if defined(_WIN32) || defined(_WIN64) \r
+ #define snprintf _snprintf \r
+ #define vsnprintf _vsnprintf \r
+ #define strcasecmp _stricmp \r
+ #define strncasecmp _strnicmp \r
+#endif\r
+\r
+#ifndef _SHP_SIMUL\r
+typedef void* LPVOID;\r
+typedef const char* LPCTSTR;\r
+typedef unsigned char* LPBYTE;\r
+typedef char TCHAR;\r
+typedef char* LPTSTR;\r
+typedef LPTSTR LPSTR;\r
+typedef LPCTSTR LPCTSTR;\r
+typedef LPCTSTR LPCSTR;\r
+\r
+#define DWORD unsigned long\r
+#define LPBYTE unsigned char*\r
+#define BYTE unsigned char\r
+#define UINT unsigned int\r
+#define ULONG unsigned long\r
+#define INT32 long\r
+#define INT64 long long\r
+#define TRUE 1\r
+#define FALSE 0\r
+\r
+\r
+typedef char CHAR;\r
+typedef bool BOOL;\r
+\r
+\r
+//typedef HFile HANDLE;\r
+#define ERROR_INVALID_DATA 13L\r
+#define ERROR_INSUFFICIENT_BUFFER 122L // dderror\r
+//#define CopyMemory AcMemcpy\r
+#define INVALID_HOBJ NULL\r
+\r
+#endif\r
+\r
+\r
+#endif //INKA_DRM_TYPES_H\r
--- /dev/null
+//typedef char CHAR;\r
+//typedef bool BOOL;\r
+\r
+typedef struct t_cek\r
+{\r
+ char *CID; // Content ID ¹öÆÛ Æ÷ÀÎÅÍ\r
+ char *CEK; // Content Encryption Key ¹öÆÛ Æ÷ÀÎÅÍ\r
+ char *EncryptionMethod; // CEK ¾Ë°í¸®Áò\r
+}T_CEK;\r
+\r
+typedef struct t_dro\r
+{\r
+ char *CID; // Content ID ¹öÆÛ Æ÷ÀÎÅÍ\r
+ char *deviceId; // »ç¿ëÀÚ ½Äº° ¹ÙÀεù. IMEI, MIN °ª ¹ÙÀεù Á¦¾î\r
+ char *digestValue; // »ç¿ëÀÚ ½Äº° ¹ÙÀεù. IMEI, MIN °ª ¹ÙÀεù Á¦¾î\r
+ char *signedValue; // »ç¿ëÀÚ ½Äº° ¹ÙÀεù. IMEI, MIN °ª ¹ÙÀεù Á¦¾î\r
+ char *cert; // »ç¿ëÀÚ ½Äº° ¹ÙÀεù. IMEI, MIN °ª ¹ÙÀεù Á¦¾î\r
+ int Count; // »ç¿ë ȸ¼ö\r
+ char *CreatedTimestamp; // »ç¿ë °¡´É ½ÃÀÛ ÀϽà ¹öÆÛ Æ÷ÀÎÅÍ. GMT Ç¥±â\r
+ char *ExpiredTimeStamp; // »ç¿ë °¡´É ¸¸±â ÀϽà ¹öÆÛ Æ÷ÀÎÅÍ. GMT Ç¥±â\r
+ char *ExpirationDate; // ÃÖÃÊ »ç¿ë ÀÌÈÄ »ç¿ë °¡´É ½Ã°£. ½Ã°£ ´ÜÀ§ \r
+}T_DRO;\r
+\r
+typedef struct t_dcf_file_header\r
+{\r
+ unsigned char Version;\r
+ unsigned char ContentTypeLen;\r
+ unsigned char ContentURILen;\r
+ char *ContentType;\r
+ char *ContentURI;\r
+ unsigned int HeadersLen;\r
+ unsigned int DataLen;\r
+ char *Headers;\r
+ unsigned int DataOffset;\r
+}T_DCF_FILE_HEADER;\r
+\r
+// DRO Value size\r
+#define APPID_SIZE 16\r
+#define CEK_SIZE 512\r
+#define ENCRYPTION_METHOD_SIZE 512\r
+#define DEVICEID_SIZE 256\r
+#define TIMESTAMP_SIZE 256\r
+#define DIGESTVALUE_SIZE 256\r
+#define SIGNATUREVALUE_SIZE 1024\r
+#define CERT_SIZE 1024 * 4\r
+#define AES_BLOCK_SIZE 16\r
--- /dev/null
+#include "InkaTypes.h"\r
+//#include "IntelDrm_Core.h"\r
+\r
+#include "stdlib.h"\r
+#include "string.h"\r
+#include "stdio.h"\r
+\r
+#define AES_BLOCK_SIZE 16\r
+\r
+LPSTR Base64Encode(LPBYTE pbData, int nLength);\r
+LPBYTE Base64Decode(LPCSTR pszString, int* pnLength);\r
+\r
+int decrypt_block(unsigned char *iv, unsigned char *cipherText, int cipherTextLen, unsigned char *cek, int cekLen, unsigned char *plainText);\r
--- /dev/null
+#include "CPointerArray.h"\r
+#include "CXMLAttribute.h"\r
+#include "CXMLElement.h"\r
+#include "CXMLFile.h"\r
+#include "InkaTypes.h"\r
+#include "IntelDrm_Core.h"\r
+#include "drm-intel-crypto-util.h"\r
+\r
+#include "stdlib.h"\r
+#include "string.h"\r
+#include "stdio.h"\r
+\r
+/** \r
+ * An application can parse CEK XML Foramt.\r
+ * \r
+ * @param[in] pszXML Data String of the CEK information\r
+ * @param[out] t_cek parsing result to be saved\r
+ * @return This function returns 1 on success or 0 on failure.\r
+ * @remarks \r
+ * @see \r
+ * @since \r
+ */\r
+int parse_intel_cek(const char* pszXML, T_CEK* t_cek);\r
+\r
+/** \r
+ * An application can parse DRO XML Foramt.\r
+ * \r
+ * @param[in] pszXML Data String of the DRO information\r
+ * @param[out] t_cek parsing result to be saved\r
+ * @return This function returns 1 on success or 0 on failure.\r
+ * @remarks \r
+ * @see \r
+ * @since \r
+ */\r
+int parse_intel_dro(const char* pszXML, T_DRO* t_RO);\r
+\r
+int parse_intel_dro2(const char* pszXML, T_DRO* t_RO);\r
+\r
+/** \r
+ * An application can parse stored dro.\r
+ * \r
+ * @param[in] pFilepath file path of the internal dro\r
+ * @param[out] t_ro parsing result to be saved\r
+ * @return This function returns 1 on success or 0 on failure.\r
+ * @remarks \r
+ * @see \r
+ * @since \r
+ */\r
+int get_internal_dro(char *pFilepath, T_DRO* t_ro);\r
+\r
+/** \r
+ * An application can parse stored cek.\r
+ * \r
+ * @param[in] pFilepath file path of the internal cek\r
+ * @param[out] t_cek parsing result to be saved\r
+ * @return This function returns 1 on success or 0 on failure.\r
+ * @remarks \r
+ * @see \r
+ * @since \r
+ */\r
+int get_internal_cek(char *pFilepath, T_CEK* t_cek);\r
+\r
+int delete_internal_cek(char *pAppId);\r
+\r
+int get_dcf_header_info(char *pFilePath, T_DCF_FILE_HEADER *pTdcfHeader);\r
+\r
+bool get_Uintvar(unsigned int *nValue, FILE *pFile);\r
+\r
+int decrypt_package(char *pDcfPath, char *pDecryptedFilePath, unsigned char *pCEK, int cekLen, T_DCF_FILE_HEADER *t_dcf_header);\r
--- /dev/null
+/*\r
+ * drm-intel\r
+ *\r
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Sunggun Jung <sunggun.jung@samsung.com>\r
+ * \r
+ * This library is free software; you can redistribute it and/or modify it under\r
+ * the terms of the GNU Lesser General Public License as published by the\r
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)\r
+ * any later version.\r
+ * \r
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
+ * License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51\r
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\r
+ *\r
+ */\r
+\r
+/**\r
+* @internal\r
+* @defgroup DRM-INTEL drm-intel\r
+* @{ \r
+*/\r
+#include "drm-intel-util.h"\r
+//#include "drm-intel-crypto-util.h"\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+\r
+/** \r
+ * An application can install Intel DRM license(DRO).\r
+ * \r
+ * @param[in] pDroXML Data String of the Rights Request\r
+ * @param[in] droBufLen pDroXML Length\r
+ * @return This function returns 1 on success or 0 on failure.\r
+ * @remarks \r
+ * @see \r
+ * @since \r
+ */\r
+int drm_oem_intel_install_license(char *pDroXML, int droBufLen);\r
+\r
+/** \r
+ * An application can uninstall Intel DRM license(DRO).\r
+ * \r
+ * @param[in] pAppId App-id of the rigths which want to un-install\r
+ * @return This function returns 1 on success or 0 on failure.\r
+ * @remarks \r
+ * @see \r
+ * @since \r
+ */\r
+int drm_oem_intel_uninstall_license(char *pAppId);\r
+\r
+/** \r
+ * An application can install CEK(Contents Encryption Key).\r
+ * \r
+ * @param[in] pCekXML Data String of the Rights Request\r
+ * @param[in] cekBufLen pDroXML Length\r
+ * @return This function returns 1 on success or 0 on failure.\r
+ * @remarks \r
+ * @see \r
+ * @since \r
+ */\r
+int drm_oem_intel_install_cek(char *pCekXML, int cekBufLen);\r
+\r
+/** \r
+ * An application can get decrypted contents(Apps) which is encrypted\r
+ * \r
+ * @param[in] pDcfPath Intel DRM Package File Path \r
+ * @param[in] pDecryptedFile Decrypted File Path\r
+ * @return This function returns 1 on success or 0 on failure.\r
+ * @remarks \r
+ * @see\r
+ * @since\r
+ */\r
+int drm_oem_intel_decrypt_package(char *pDcfPath, char *pDecryptedFile);\r
+\r
+/** \r
+ * An application can get informations of rights (DRO).\r
+ * \r
+ * @param[in] pAppId App-id of the rights which want to know\r
+ * @param[out] pDro The rights information about the app-id\r
+ * @return This function can return any of the following codes\r
+ * DRM_INTEL_SUCCESS = 0 <success \r
+ * DRM_INTEL_LIC_VALID = 1 <License is valid \r
+ * DRM_INTEL_LIC_SUSPEND = 2 <License is valid but for future use \r
+ * DRM_INTEL_INVALID_ARG = -1000 <invalid argument\r
+ * DRM_INTEL_PARSING_ERROR = -999 <parsing contents or rights error\r
+ * DRM_INTEL_DB_ERROR = -998 <data base error \r
+ * DRM_INTEL_INSUFFICIENT_MEMORY = -997 <memory error \r
+ * DRM_INTEL_INTERNAL_ERROR = -996 <processing error\r
+ * DRM_INTEL_FILE_ERROR = -995 <file error\r
+ * DRM_INTEL_LIC_EXPIRED_DATETIME = -994 <Datetime License is expired\r
+ * DRM_INTEL_LIC_EXPIRED_COUNT = -993 <Count License is expired \r
+ * DRM_INTEL_LIC_NO_LICENCE = -992 <No License\r
+ * DRM_INTEL_LIC_IMEI_MISMATCH = -991 <IMEI is mismatching \r
+ * DRM_INTEL_LIC_PNUM_MISMATCH = -990 <PNUM is mismatching \r
+ * DRM_INTEL_UNKNOWN_ERROR = -1 <dummy error value\r
+ * @remarks \r
+ * @see \r
+ * @since \r
+ */\r
+int drm_oem_intel_getLicenseInfo(char *pAppId, T_DRO *pDro);\r
+\r
+/** \r
+ * An application can get informations of rights (DRO).\r
+ * \r
+ * @param[in] pAppId App-id of the rights which want to know\r
+ * @return This function can return any of the following codes\r
+ * DRM_INTEL_SUCCESS = 0 <success \r
+ * DRM_INTEL_LIC_VALID = 1 <License is valid \r
+ * DRM_INTEL_LIC_SUSPEND = 2 <License is valid but for future use \r
+ * DRM_INTEL_INVALID_ARG = -1000 <invalid argument\r
+ * DRM_INTEL_PARSING_ERROR = -999 <parsing contents or rights error\r
+ * DRM_INTEL_DB_ERROR = -998 <data base error \r
+ * DRM_INTEL_INSUFFICIENT_MEMORY = -997 <memory error \r
+ * DRM_INTEL_INTERNAL_ERROR = -996 <processing error\r
+ * DRM_INTEL_FILE_ERROR = -995 <file error\r
+ * DRM_INTEL_LIC_EXPIRED_DATETIME = -994 <Datetime License is expired\r
+ * DRM_INTEL_LIC_EXPIRED_COUNT = -993 <Count License is expired \r
+ * DRM_INTEL_LIC_NO_LICENCE = -992 <No License\r
+ * DRM_INTEL_LIC_IMEI_MISMATCH = -991 <IMEI is mismatching \r
+ * DRM_INTEL_LIC_PNUM_MISMATCH = -990 <PNUM is mismatching \r
+ * DRM_INTEL_UNKNOWN_ERROR = -1 <dummy error value \r
+ * @remarks \r
+ * @see \r
+ * @since \r
+ */\r
+int drm_oem_intel_consume_license(char *pAppID);\r
+\r
+/** \r
+ * An application can veify the app's rights.\r
+ * \r
+ * @param[in] pAppId App-id of the rights which want to know\r
+ * @return This function can return any of the following codes\r
+ * DRM_INTEL_SUCCESS = 0 <success \r
+ * DRM_INTEL_LIC_VALID = 1 <License is valid \r
+ * DRM_INTEL_LIC_SUSPEND = 2 <License is valid but for future use \r
+ * DRM_INTEL_INVALID_ARG = -1000 <invalid argument\r
+ * DRM_INTEL_PARSING_ERROR = -999 <parsing contents or rights error\r
+ * DRM_INTEL_DB_ERROR = -998 <data base error \r
+ * DRM_INTEL_INSUFFICIENT_MEMORY = -997 <memory error \r
+ * DRM_INTEL_INTERNAL_ERROR = -996 <processing error\r
+ * DRM_INTEL_FILE_ERROR = -995 <file error\r
+ * DRM_INTEL_LIC_EXPIRED_DATETIME = -994 <Datetime License is expired\r
+ * DRM_INTEL_LIC_EXPIRED_COUNT = -993 <Count License is expired \r
+ * DRM_INTEL_LIC_NO_LICENCE = -992 <No License\r
+ * DRM_INTEL_LIC_IMEI_MISMATCH = -991 <IMEI is mismatching \r
+ * DRM_INTEL_LIC_PNUM_MISMATCH = -990 <PNUM is mismatching \r
+ * DRM_INTEL_UNKNOWN_ERROR = -1 <dummy error value \r
+\r
+ * @remarks \r
+ * @see \r
+ * @since \r
+ */\r
+int drm_oem_intel_has_valid_license(char *pAppID);\r
+\r
+/** \r
+ * An application can check the file is drm enabled or not\r
+ * \r
+ * @param[in] pDcfPath The file path which want to check \r
+ * @return This function returns 1 on success or 0 on failure.\r
+ * @remarks \r
+ * @see\r
+ * @since\r
+ */\r
+int drm_oem_intel_isDrmFile(char *pDcfPath);\r
#include <dpl/assert.h>
#include <dpl/sstream.h>
#include <dpl/wrt-dao-ro/common_dao_types.h>
+#include <dpl/file_input.h>
+#include <dpl/utils/wrt_utility.h>
#include "root_parser.h"
#include "widget_parser.h"
#include "parser_runner.h"
#include <widget_install/job_widget_install.h>
-#include <widget_install/task_unzip.h>
#include <widget_install/task_certify.h>
#include <widget_install/task_widget_config.h>
#include <widget_install/task_file_manipulation.h>
#include <widget_install/task_remove_backup.h>
#include <widget_install/task_encrypt_resource.h>
#include <widget_install/task_certificates.h>
+#include <widget_install/task_unzip.h>
+#include <widget_install/task_commons.h>
#include <widget_install/task_plugins_copy.h>
#include <widget_install/widget_install_errors.h>
#include <libiriwrapper.h>
#include <pkg-manager/pkgmgr_signal.h>
#include <app_manager.h>
+#include <drm_client.h>
+#include <drm_trusted_client.h>
+#include <drm-oem-intel.h> //temporary code
using namespace WrtDB;
JobContextBase<WidgetInstallationStruct>(installerStruct),
m_exceptionCaught(Exceptions::Success)
{
- // Check installation type (config.xml or widget.wgt)
- bool browserRequest = hasExtension(widgetPath, XML_EXTENSION);
-
- LogInfo("Hosted app installation: " << browserRequest);
-
struct timeval tv;
gettimeofday(&tv, NULL);
srand(time(NULL) + tv.tv_usec);
m_installerContext.m_quiet = m_jobStruct.m_quiet;
- if(!browserRequest)
- {
- m_installerContext.widgetConfig.pType = checkPackageType(widgetPath);
- }
- else
- {
- m_installerContext.widgetConfig.pType = WrtDB::PKG_TYPE_TIZEN_WEBAPP;
- }
- LogDebug("widgetPath:" << widgetPath);
-
- ConfigParserData configData = getWidgetDataFromXML(widgetPath, browserRequest,
- m_installerContext.widgetConfig.pType);
- WidgetUpdateInfo update = detectWidgetUpdate(configData);
- bool needEncryption = detectResourceEncryption(configData);
-
- // Configure installation
- ConfigureResult result = ConfigureInstallation(widgetPath, configData,
- update, browserRequest);
+ ConfigureResult result = PrePareInstallation(widgetPath);
if (result == ConfigureResult::Ok) {
LogInfo("Configure installation succeeded");
AddTask(new TaskRecovery(m_installerContext));
// Create installation tasks
- if (!m_installerContext.locations->browserRequest()) {
+ if (m_installerContext.widgetConfig.packagingType !=
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP || !m_isDRM) {
AddTask(new TaskUnzip(m_installerContext));
}
+
AddTask(new TaskWidgetConfig(m_installerContext));
- if (m_installerContext.locations->browserRequest()) {
+ if (m_installerContext.widgetConfig.packagingType ==
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP ) {
AddTask(new TaskPrepareFiles(m_installerContext));
}
AddTask(new TaskCertify(m_installerContext));
- if (needEncryption) {
+ if (m_needEncryption) {
AddTask(new TaskEncryptResource(m_installerContext));
}
AddTask(new TaskFileManipulation(m_installerContext));
AddTask(new TaskManifestFile(m_installerContext));
AddTask(new TaskCertificates(m_installerContext));
- if (m_installerContext.widgetConfig.pType ==
- PKG_TYPE_TIZEN_WITHSVCAPP) {
+ if (m_installerContext.widgetConfig.packagingType ==
+ PKG_TYPE_HYBRID_WEB_APP) {
AddTask(new TaskInstallOspsvc(m_installerContext));
}
AddTask(new TaskPluginsCopy(m_installerContext));
} else if (result == ConfigureResult::Updated) {
LogInfo("Configure installation updated");
LogInfo("Widget Update");
-
- if (!m_installerContext.locations->browserRequest()) {
+ if (m_installerContext.widgetConfig.packagingType !=
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP || !m_isDRM) {
AddTask(new TaskUnzip(m_installerContext));
}
+
AddTask(new TaskWidgetConfig(m_installerContext));
- if (m_installerContext.locations->browserRequest()) {
+
+ if (m_installerContext.widgetConfig.packagingType ==
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP ) {
AddTask(new TaskPrepareFiles(m_installerContext));
}
AddTask(new TaskSmack(m_installerContext));
AddTask(new TaskManifestFile(m_installerContext));
- if (m_installerContext.widgetConfig.pType ==
- PKG_TYPE_TIZEN_WITHSVCAPP) {
+ if (m_installerContext.widgetConfig.packagingType ==
+ PKG_TYPE_HYBRID_WEB_APP) {
AddTask(new TaskInstallOspsvc(m_installerContext));
}
AddTask(new TaskRemoveBackupFiles(m_installerContext));
}
}
+JobWidgetInstall::ConfigureResult JobWidgetInstall::PrePareInstallation(
+ const std::string &widgetPath)
+{
+ ConfigureResult result;
+ m_needEncryption = false;
+
+ Try
+ {
+ std::string tempDir = Jobs::WidgetInstall::createTempPath();
+
+ bool m_isDRM = isDRMWidget(widgetPath);
+ if (true == m_isDRM) {
+ LogDebug("decrypt DRM widget");
+ if(DecryptDRMWidget(widgetPath, tempDir)) {
+ LogDebug("Failed decrypt DRM widget");
+ return ConfigureResult::Failed;
+ }
+ }
+
+ LogDebug("widgetPath:" << widgetPath);
+
+ m_installerContext.widgetConfig.packagingType =
+ checkPackageType(widgetPath, tempDir);
+ ConfigParserData configData = getWidgetDataFromXML(widgetPath, tempDir,
+ m_installerContext.widgetConfig.packagingType, m_isDRM);
+ LogDebug("widget packaging type : " <<
+ m_installerContext.widgetConfig.packagingType.pkgType);
+ WidgetUpdateInfo update = detectWidgetUpdate(configData);
+ m_needEncryption = detectResourceEncryption(configData);
+
+ // Configure installation
+ result = ConfigureInstallation(widgetPath, configData, update, tempDir);
+ }
+ Catch(Exceptions::ExtractFileFailed)
+ {
+ LogError("Failed to create temporary path for widget");
+ result = ConfigureResult::Failed;
+ }
+
+ return result;
+}
+
std::string JobWidgetInstall::generateTizenId() {
std::string allowed("0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
return m_installerContext.widgetConfig.pkgname;
}
-void JobWidgetInstall::configureWidgetLocation(const std::string & widgetPath, bool browserRequest)
+void JobWidgetInstall::configureWidgetLocation(const std::string & widgetPath,
+ const std::string& tempPath)
{
- m_installerContext.locations = WidgetLocation(DPL::ToUTF8String(*m_installerContext.widgetConfig.pkgname),
- widgetPath, browserRequest, m_installerContext.widgetConfig.pType);
+ m_installerContext.locations =
+ WidgetLocation(DPL::ToUTF8String(*m_installerContext.widgetConfig.pkgname),
+ widgetPath, tempPath,
+ m_installerContext.widgetConfig.packagingType);
LogInfo("widgetSource " << widgetPath);
}
const std::string &widgetSource,
const WrtDB::ConfigParserData &configData,
const WidgetUpdateInfo &update,
- bool browserRequest)
+ const std::string &tempPath)
{
LogInfo(
"Widget install/update: incoming guid = '" <<
using namespace PackageManager;
LogInfo("Tizen Id: " << m_installerContext.widgetConfig.pkgname);
- configureWidgetLocation(widgetSource, browserRequest);
+ configureWidgetLocation(widgetSource, tempPath);
// send start signal of pkgmgr
PkgmgrSignalSingleton::Instance().setPkgname(
ConfigParserData JobWidgetInstall::getWidgetDataFromXML(
const std::string &widgetSource,
- bool fromBrowser, WrtDB::PkgType isOspsvc)
+ const std::string &tempPath,
+ WrtDB::PackagingType pkgType,
+ bool isDRM)
{
+ // Parse config
+ ParserRunner parser;
+ ConfigParserData configInfo;
+
Try
{
- // Parse config
- ParserRunner parser;
- ConfigParserData configInfo;
-
- if (fromBrowser) {
+ if (pkgType == PKG_TYPE_HOSTED_WEB_APP) {
parser.Parse(widgetSource,
- ElementParserPtr(
- new RootParser<WidgetParser>(configInfo,
- DPL::FromUTF32String(
- L"widget"))));
- }
- else {
- // Open zip file
- std::unique_ptr<DPL::ZipInput> zipFile(
- new DPL::ZipInput(widgetSource));
+ ElementParserPtr(
+ new RootParser<WidgetParser>(configInfo,
+ DPL::FromUTF32String(
+ L"widget"))));
+ } else {
+ if (!isDRM) {
+ std::unique_ptr<DPL::ZipInput> zipFile(
+ new DPL::ZipInput(widgetSource));
- std::unique_ptr<DPL::ZipInput::File> configFile;
+ std::unique_ptr<DPL::ZipInput::File> configFile;
- // Open config.xml file
- if (isOspsvc == PKG_TYPE_TIZEN_WITHSVCAPP) {
- configFile.reset(zipFile->OpenFile(WITH_OSP_XML));
+ // Open config.xml file
+ if (pkgType == PKG_TYPE_HYBRID_WEB_APP) {
+ configFile.reset(zipFile->OpenFile(WITH_OSP_XML));
+ } else {
+ configFile.reset(zipFile->OpenFile(CONFIG_XML));
+ }
+
+ // Extract config
+ DPL::BinaryQueue buffer;
+ DPL::AbstractWaitableInputAdapter inputAdapter(configFile.get());
+ DPL::AbstractWaitableOutputAdapter outputAdapter(&buffer);
+ DPL::Copy(&inputAdapter, &outputAdapter);
+ parser.Parse(&buffer,
+ ElementParserPtr(
+ new RootParser<WidgetParser>(configInfo,
+ DPL::FromUTF32String(
+ L"widget"))));
} else {
- configFile.reset(zipFile->OpenFile(CONFIG_XML));
- }
+ // DRM widget
+ std::string configFile;
+ if (pkgType == PKG_TYPE_HYBRID_WEB_APP) {
+ configFile = tempPath + "/" + WITH_OSP_XML;
+ } else {
+ configFile = tempPath + "/" + CONFIG_XML;
+ }
- // Extract config
- DPL::BinaryQueue buffer;
- DPL::AbstractWaitableInputAdapter inputAdapter(configFile.get());
- DPL::AbstractWaitableOutputAdapter outputAdapter(&buffer);
- DPL::Copy(&inputAdapter, &outputAdapter);
- parser.Parse(&buffer,
- ElementParserPtr(
- new RootParser<WidgetParser>(configInfo,
- DPL::FromUTF32String(
- L"widget"))));
+ parser.Parse(configFile,
+ ElementParserPtr(
+ new RootParser<WidgetParser>(configInfo,
+ DPL::FromUTF32String(
+ L"widget"))));
+ }
}
-
- return configInfo;
}
Catch(DPL::ZipInput::Exception::OpenFailed)
{
LogError("Failed to extract config.xml file");
return ConfigParserData();
}
+ Catch(DPL::FileInput::Exception::OpenFailed)
+ {
+ LogError("Failed to open config.xml file");
+ return ConfigParserData();
+ }
Catch(ElementParser::Exception::ParseError)
{
LogError("Failed to parse config.xml file");
return ConfigParserData();
}
+ return configInfo;
}
WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate(
}
WrtDB::PackagingType JobWidgetInstall::checkPackageType(
- const std::string &widgetSource)
+ const std::string &widgetSource,
+ const std::string &tempPath)
{
- using namespace WrtDB;
-
- PackagingType pType = PKG_TYPE_UNKNOWN;
- std::unique_ptr<DPL::ZipInput> zipFile;
+ // Check installation type (config.xml or widget.wgt)
+ if (hasExtension(widgetSource, XML_EXTENSION)) {
+ LogInfo("Hosted app installation");
+ return PKG_TYPE_HOSTED_WEB_APP;
+ }
- Try
- {
- // Open zip file
- zipFile.reset(new DPL::ZipInput(widgetSource));
+ if (m_isDRM) {
+ std::string configFile = tempPath + "/" + CONFIG_XML;
+ if (WrtUtilFileExists(configFile)) {
+ return PKG_TYPE_NOMAL_WEB_APP;
+ }
- }
- Catch(DPL::ZipInput::Exception::OpenFailed)
- {
- LogError("Failed to open widget package");
- return PKG_TYPE_UNKNOWN;
- }
+ configFile = tempPath + "/" + WITH_OSP_XML;
+ if (WrtUtilFileExists(configFile)) {
+ return PKG_TYPE_HYBRID_WEB_APP;
+ }
+ } else {
+ std::unique_ptr<DPL::ZipInput> zipFile;
- Try
- {
- // Open config.xml file in package root
- std::unique_ptr<DPL::ZipInput::File> configFile(
- zipFile->OpenFile(CONFIG_XML));
- pType = PKG_TYPE_TIZEN_WEBAPP;
- }
- Catch(DPL::ZipInput::Exception::OpenFileFailed)
- {
- LogWarning("Could not find ./config.xml");
- }
+ Try
+ {
+ // Open zip file
+ zipFile.reset(new DPL::ZipInput(widgetSource));
- Try
- {
- // Open config.xml file in package root
- std::unique_ptr<DPL::ZipInput::File> configFile(
- zipFile->OpenFile(WITH_OSP_XML));
- if (pType == PKG_TYPE_TIZEN_WEBAPP) {
- LogWarning("Two config.xml's found. Application type is unknown.");
+ }
+ Catch(DPL::ZipInput::Exception::OpenFailed)
+ {
+ LogDebug("Failed to open widget package");
return PKG_TYPE_UNKNOWN;
}
- pType = PKG_TYPE_TIZEN_WITHSVCAPP;
- }
- Catch(DPL::ZipInput::Exception::OpenFileFailed)
- {
- LogWarning("Could not find ./res/wgt/config.xml");
- }
+ Try
+ {
+ // Open config.xml file in package root
+ std::unique_ptr<DPL::ZipInput::File> configFile(
+ zipFile->OpenFile(CONFIG_XML));
+ return PKG_TYPE_NOMAL_WEB_APP;
+ }
+ Catch(DPL::ZipInput::Exception::OpenFileFailed)
+ {
+ LogDebug("Could not find config.xml");
+ }
+
+ Try
+ {
+ // Open config.xml file in package root
+ std::unique_ptr<DPL::ZipInput::File> configFile(
+ zipFile->OpenFile(WITH_OSP_XML));
- if (pType == PKG_TYPE_UNKNOWN) {
- LogWarning("config.xml not found. Application type is unknown.");
+ return PKG_TYPE_HYBRID_WEB_APP;
+ }
+ Catch(DPL::ZipInput::Exception::OpenFileFailed)
+ {
+ LogDebug("Could not find wgt/config.xml");
+ return PKG_TYPE_UNKNOWN;
+ }
}
- return pType;
+
+ return PKG_TYPE_UNKNOWN;
}
bool JobWidgetInstall::detectResourceEncryption(const WrtDB::ConfigParserData &configData)
return false;
}
+bool JobWidgetInstall::isDRMWidget(std::string widgetPath)
+{
+ drm_bool_type_e is_drm_file = DRM_UNKNOWN;
+ int ret = -1;
+
+ /* TODO :
+ ret = drm_is_drm_file(widgetPath.c_str(), &is_drm_file);
+ if(DRM_RETURN_SUCCESS == ret && DRM_TRUE == is_drm_file) {
+ */
+
+ /* blow code temporary code for drm. */
+ ret = drm_oem_intel_isDrmFile(const_cast<char*>(widgetPath.c_str()));
+ if ( 1 == ret) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+bool JobWidgetInstall::DecryptDRMWidget(std::string widgetPath,
+ std::string destPath)
+{
+ /* TODO :
+ drm_trusted_sapps_decrypt_package_info_s package_info;
+
+ strncpy(package_info.sadcf_filepath, widgetPath.c_str(),
+ sizeof(package_info.sadcf_filepath));
+ strncpy(package_info.decrypt_filepath, destPath.c_str(),
+ sizeof(package_info.decrypt_filepath));
+
+ drm_trusted_request_type_e requestType =
+ DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE;
+
+ int ret = drm_trusted_handle_request(requestType,
+ (void *)&package_info, NULL);
+ if (DRM_TRUSTED_RETURN_SUCCESS == ret) {
+ return true;
+ } else {
+ return false;
+ }
+ */
+ if (drm_oem_intel_decrypt_package(const_cast<char*>(widgetPath.c_str()),
+ const_cast<char*>(destPath.c_str())) != 0) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
} //namespace WidgetInstall
} //namespace Jobs
Exceptions::Type m_exceptionCaught;
std::string m_exceptionMessage;
WidgetUpdateInfo m_widgetUpdateInfo;
+ bool m_needEncryption;
+ bool m_isDRM;
enum class ConfigureResult
{
const WrtDB::ConfigParserData
&configData,
const WidgetUpdateInfo &update,
- bool browserRequest);
+ const std::string &tempPath);
static WrtDB::ConfigParserData getWidgetDataFromXML(
const std::string &widgetSource,
- bool fromBrowser, WrtDB::PkgType isOspsvc);
+ const std::string &tempPath,
+ WrtDB::PackagingType pkgType,
+ bool isDRM);
static WidgetUpdateInfo detectWidgetUpdate(
const WrtDB::ConfigParserData &configInfo);
WidgetUpdateMode::Type CalcWidgetUpdatePolicy(
bool setTizenId(const WrtDB::ConfigParserData &configInfo,
ConfigureResult result);
void displayWidgetInfo();
- void configureWidgetLocation(const std::string & widgetPath, bool browserRequest);
+ void configureWidgetLocation(const std::string & widgetPath,
+ const std::string &tempPath);
WrtDB::PackagingType checkPackageType(
- const std::string &widgetSorce);
+ const std::string &widgetSource,
+ const std::string &tempPath);
bool detectResourceEncryption(const WrtDB::ConfigParserData &configData);
std::string generateTizenId();
+ bool isDRMWidget(std::string widgetPath);
+ bool DecryptDRMWidget(std::string widgetPath, std::string destPath);
+ ConfigureResult PrePareInstallation(const std::string &widgetPath);
public:
/**
void TaskAceCheck::StepProcessAceResponse()
{
WrtDB::WidgetDAO dao(m_context.locations->getPkgname());
- if (m_context.locations->browserRequest()) {
+ if (m_context.widgetConfig.packagingType ==
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP) {
return;
}
bool TaskCertify::isTizenWebApp() const
{
bool ret = FALSE;
- if (m_installContext.widgetConfig.type.appType
+ if (m_installContext.widgetConfig.webAppType.appType
== WrtDB::AppType::APP_TYPE_TIZENWEBAPP)
ret = TRUE;
*/
#include "task_encrypt_resource.h"
+#undef __USE_FILE_OFFSET64
+
#include <unistd.h>
#include <string>
#include <sys/stat.h>
// If package type is widget with osp service, we don't need to make bin
// and src directory
- if (m_context.widgetConfig.pType == PKG_TYPE_TIZEN_WITHSVCAPP) {
+ if (m_context.widgetConfig.packagingType == PKG_TYPE_HYBRID_WEB_APP) {
LogDebug("Doesn't need to create resource directory");
} else {
LogDebug("Create resource directory");
ThrowMsg(Exceptions::InternalError, "No Package name exists.");
}
- if (m_context.widgetConfig.pType == PKG_TYPE_TIZEN_WITHSVCAPP) {
+ if (m_context.widgetConfig.packagingType == PKG_TYPE_HYBRID_WEB_APP) {
instDir = m_context.locations->getPackageInstallationDir();
} else {
instDir = m_context.locations->getSourceDir();
{
LogDebug("[Rename Widget Path] Aborting.... (Rename path)");
std::string widgetPath;
- if (m_context.widgetConfig.pType == PKG_TYPE_TIZEN_WITHSVCAPP) {
+ if (m_context.widgetConfig.packagingType == PKG_TYPE_HYBRID_WEB_APP) {
widgetPath = m_context.locations->getPackageInstallationDir();
} else {
widgetPath = m_context.locations->getSourceDir();
targetFile << GlobalConfig::GetUserWidgetDesktopIconPath() << "/";
targetFile << getIconTargetFilename(*locale);
- if (m_context.locations->browserRequest())
- {
+
+ if (m_context.widgetConfig.packagingType ==
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP) {
m_context.locations->setIconTargetFilenameForLocale(targetFile.str());
}
} else {
// set property data for hosted start url
// Hosted start url only support TIZEN WebApp
- if (m_installContext.widgetConfig.type ==
+ if (m_installContext.widgetConfig.webAppType ==
APP_TYPE_TIZENWEBAPP)
{
const char *startPath =
void TaskWidgetConfig::StepCheckMinVersionInfo()
{
if (!isMinVersionCompatible(
- m_installContext.widgetConfig.type.appType,
+ m_installContext.widgetConfig.webAppType.appType,
m_installContext.widgetConfig.minVersion)) {
std::string label = WIDGET_NOT_COMPATIBLE + QUESTION;
createInstallPopup(PopupType::WIDGET_MIN_VERSION, label);
// check feature vender for permission
// WAC, TIZEN WebApp cannot use other feature
- if (!isFeatureAllowed(m_installContext.widgetConfig.type.appType,
+ if (!isFeatureAllowed(m_installContext.widgetConfig.webAppType.appType,
it->name))
{
LogInfo("This application type not allowed to use this feature");
ThrowMsg(
Exceptions::WidgetConfigFileInvalid,
"This app type [" <<
- m_installContext.widgetConfig.type.getApptypeToString() <<
+ m_installContext.widgetConfig.webAppType.getApptypeToString() <<
"] cannot be allowed to use [" <<
DPL::ToUTF8String(it->name) + "] feature");
}
currentAppType = APP_TYPE_TIZENWEBAPP;
}
- if (widgetInfo->type == APP_TYPE_UNKNOWN) {
- widgetInfo->type = currentAppType;
- } else if (widgetInfo->type == currentAppType) {
+ if (widgetInfo->webAppType == APP_TYPE_UNKNOWN) {
+ widgetInfo->webAppType = currentAppType;
+ } else if (widgetInfo->webAppType == currentAppType) {
continue;
} else {
ThrowMsg(Exceptions::WidgetConfigFileInvalid,
}
// If there is no define, type set to WAC 2.0
- if (widgetInfo->type == APP_TYPE_UNKNOWN) {
- widgetInfo->type = APP_TYPE_WAC20;
+ if (widgetInfo->webAppType == APP_TYPE_UNKNOWN) {
+ widgetInfo->webAppType = APP_TYPE_WAC20;
}
- LogInfo("type = [" << widgetInfo->type.getApptypeToString() << "]");
+ LogInfo("type = [" << widgetInfo->webAppType.getApptypeToString() << "]");
}
bool TaskWidgetConfig::isFeatureAllowed(WrtDB::AppType appType,
bool TaskWidgetConfig::isTizenWebApp() const
{
bool ret = FALSE;
- if (m_installContext.widgetConfig.type.appType
+ if (m_installContext.widgetConfig.webAppType.appType
== WrtDB::AppType::APP_TYPE_TIZENWEBAPP)
ret = TRUE;
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file widget_unzip.cpp
+ * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
+ * @version 1.0
+ * @brief Implementation file for installer task unzip
+ */
+#include <widget_install/widget_unzip.h>
+#include <widget_install/widget_install_errors.h>
+#include <widget_install/widget_install_context.h>
+#include <widget_install/job_widget_install.h>
+#include <dpl/log/log.h>
+#include <dpl/copy.h>
+#include <dpl/file_output.h>
+#include <dpl/abstract_waitable_input_adapter.h>
+#include <dpl/wrt-dao-ro/global_config.h>
+#include <task_commons.h>
+#include <sys/stat.h>
+#include <drm_trusted_client.h>
+
+using namespace WrtDB;
+
+namespace {
+struct PathAndFilePair
+{
+ std::string path;
+ std::string file;
+
+ PathAndFilePair(const std::string &p,
+ const std::string &f) :
+ path(p),
+ file(f)
+ {
+ }
+};
+
+PathAndFilePair SplitFileAndPath(const std::string &filePath)
+{
+ std::string::size_type position = filePath.rfind('/');
+
+ // Is this only a file without a path ?
+ if (position == std::string::npos) {
+ return PathAndFilePair(std::string(), filePath);
+ }
+
+ // This is full file-path pair
+ return PathAndFilePair(filePath.substr(0,
+ position),
+ filePath.substr(position + 1));
+}
+}
+
+namespace Jobs {
+namespace WidgetInstall {
+WidgetUnzip::WidgetUnzip(std::string source, std::string path) :
+ m_source(source),
+ m_destPath(path)
+{
+ LogDebug("WidgetUnzip");
+}
+
+void WidgetUnzip::ExtractFile(DPL::ZipInput::File *input,
+ const std::string &destFileName)
+{
+ Try
+ {
+ DPL::AbstractWaitableInputAdapter inputAdapter(input);
+ DPL::FileOutput output(destFileName);
+
+ DPL::Copy(&inputAdapter, &output);
+ }
+ Catch(DPL::FileOutput::Exception::OpenFailed)
+ {
+ ReThrowMsg(Exceptions::ExtractFileFailed, destFileName);
+ }
+ Catch(DPL::CopyFailed)
+ {
+ ReThrowMsg(Exceptions::ExtractFileFailed, destFileName);
+ }
+}
+
+void WidgetUnzip::UnzipWidget()
+{
+ UnzipPrepare();
+ UnzipProgress();
+}
+
+void WidgetUnzip::UnzipPrepare()
+{
+ LogInfo("Prepare to unzip...");
+
+ Try
+ {
+ m_zip.reset(new DPL::ZipInput(m_source));
+ LogInfo("Widget package comment: " << m_zip->GetGlobalComment());
+
+ // Widget package must not be empty
+ if (m_zip->empty()) {
+ ThrowMsg(Exceptions::ZipEmpty, m_source);
+ }
+
+ // Set iterator to first file
+ m_zipIterator = m_zip->begin();
+ }
+ Catch(DPL::ZipInput::Exception::OpenFailed)
+ {
+ ReThrowMsg(Exceptions::OpenZipFailed, m_source);
+ }
+}
+
+void WidgetUnzip::UnzipProgress()
+{
+
+ // Show file info
+ LogInfo("Unzipping: '" << m_zipIterator->name <<
+ "', Comment: '" << m_zipIterator->comment <<
+ "', Compressed size: " << m_zipIterator->compressedSize <<
+ ", Uncompressed size: " << m_zipIterator->uncompressedSize);
+
+
+ // Normalize file paths
+ // FIXME: Implement checking for invalid characters
+
+ // Extract file or path
+ std::string fileName = m_zipIterator->name;
+
+ if (fileName[fileName.size() - 1] == '/') {
+ // This is path
+ std::string newPath = m_destPath + "/" +
+ fileName.substr(0, fileName.size() - 1);
+ LogPedantic("Path to extract: " << newPath);
+
+ // Create path in case of it is empty
+ createTempPath(newPath);
+ } else {
+ // This is regular file
+ std::string fileExtractPath = m_destPath + "/" + fileName;
+
+ LogPedantic("File to extract: " << fileExtractPath);
+
+ // Split into pat & file pair
+ PathAndFilePair pathAndFile = SplitFileAndPath(fileExtractPath);
+
+ LogPedantic("Path and file: " <<
+ pathAndFile.path <<
+ " : " << pathAndFile.file);
+
+ // First, ensure that path exists
+ createTempPath(pathAndFile.path);
+
+ Try
+ {
+ // Open file
+ std::unique_ptr<DPL::ZipInput::File> file(
+ m_zip->OpenFile(fileName));
+
+ // Extract single file
+ ExtractFile(file.get(), fileExtractPath);
+ }
+ Catch(DPL::ZipInput::Exception::OpenFileFailed)
+ {
+ ThrowMsg(Exceptions::ExtractFileFailed, fileName);
+ }
+ }
+
+ // Check whether there are more files to extract
+ if (++m_zipIterator == m_zip->end()) {
+ LogInfo("Unzip progress finished successfuly");
+ m_zip.reset();
+ } else {
+ UnzipProgress();
+ }
+}
+
+void WidgetUnzip::UnzipDRMWidget()
+{
+ LogDebug("Decrypt drm widget");
+ drm_trusted_sapps_decrypt_package_info_s package_info;
+
+ strncpy(package_info.sadcf_filepath, m_source.c_str(),
+ sizeof(package_info.sadcf_filepath));
+ strncpy(package_info.decrypt_filepath, m_destPath.c_str(),
+ sizeof(package_info.decrypt_filepath));
+
+ drm_trusted_request_type_e requestType =
+ DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE;
+
+ int ret = drm_trusted_handle_request(requestType,
+ (void *)&package_info, NULL);
+ if (DRM_TRUSTED_RETURN_SUCCESS != ret) {
+ LogDebug("Failed unzip drm widget");
+ ThrowMsg(Exceptions::ExtractFileFailed, m_destPath);
+ }
+}
+} //namespace WidgetInstall
+} //namespace Jobs
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file widget_unzip.cpp
+ * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
+ * @version 1.0
+ * @brief Implementation file for installer task unzip
+ */
+#ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_WIDGET_UNZIP_H
+#define INSTALLER_CORE_JOS_WIDGET_INSTALL_WIDGET_UNZIP_H
+
+#include <string>
+#include <memory>
+
+#include <dpl/zip_input.h>
+
+class InstallerContext;
+
+namespace Jobs {
+namespace WidgetInstall {
+class WidgetUnzip
+{
+ private:
+ // Installation context
+ std::string m_source;
+ std::string m_destPath;
+
+ // Unzip state
+ std::unique_ptr<DPL::ZipInput> m_zip;
+ DPL::ZipInput::const_iterator m_zipIterator;
+
+ void ExtractFile(DPL::ZipInput::File *input,
+ const std::string &destFileName);
+
+ void UnzipPrepare();
+ void UnzipProgress();
+
+ public:
+ WidgetUnzip(std::string m_source, std::string m_destPath);
+ void UnzipWidget();
+ void UnzipDRMWidget();
+};
+} //namespace WidgetInstall
+} //namespace Jobs
+
+#endif // INSTALLER_CORE_JOS_WIDGET_INSTALL_WIDGET_UNZIP_H
AddTask(new TaskSmack(m_context));
AddTask(new TaskCheck(m_context));
- if (dao.getPkgType() == PKG_TYPE_TIZEN_WITHSVCAPP) {
+ if (dao.getPackagingType() == PKG_TYPE_HYBRID_WEB_APP) {
AddTask(new TaskUninstallOspsvc(m_context));
}
AddTask(new TaskRemoveFiles(m_context));
m_dirpath = Jobs::WidgetInstall::createTempPath();
}
+WidgetLocation::DirectoryDeletor::DirectoryDeletor(std::string tempPath)
+{
+ m_dirpath = tempPath;
+}
+
WidgetLocation::DirectoryDeletor::~DirectoryDeletor()
{
LogDebug("Removing widget installation temporary directory: " << m_dirpath.c_str());
return m_dirpath;
}
-WidgetLocation::WidgetLocation() : m_browser(false)
+WidgetLocation::WidgetLocation()
{
}
-WidgetLocation::WidgetLocation(const std::string & widgetname) : m_pkgname(widgetname), m_browser(false)
+WidgetLocation::WidgetLocation(const std::string & widgetname) :
+ m_pkgname(widgetname)
{
}
WidgetLocation::WidgetLocation(const std::string & widgetname,
std::string sourcePath,
- bool browserRequest,
- WrtDB::PkgType t):
+ WrtDB::PackagingType t):
m_pkgname(widgetname),
m_widgetSource(sourcePath),
- m_browser(browserRequest),
m_type(t),
m_temp(new WidgetLocation::DirectoryDeletor())
{
}
+WidgetLocation::WidgetLocation(const std::string & widgetname,
+ std::string sourcePath,
+ std::string dirPath,
+ WrtDB::PackagingType t):
+ m_pkgname(widgetname),
+ m_widgetSource(sourcePath),
+ m_type(t),
+ m_temp(new
+ WidgetLocation::DirectoryDeletor(dirPath))
+{
+}
+
// TODO cache all these paths
std::string WidgetLocation::getInstallationDir() const
{
return m_temp->getTempPath();
}
-bool WidgetLocation::browserRequest() const
-{
- return m_browser;
-}
-
std::string WidgetLocation::getTemporaryRootDir() const
{
- if(m_type == WrtDB::PKG_TYPE_TIZEN_WITHSVCAPP)
+ if(m_type == WrtDB::PKG_TYPE_HYBRID_WEB_APP)
{
return getTemporaryPackageDir() + WrtDB::GlobalConfig::GetWidgetSrcPath();
}
std::string WidgetLocation::getConfigurationDir() const
{
- if(m_browser)
+ if(m_type == WrtDB::PKG_TYPE_HOSTED_WEB_APP)
{
std::string path = ".";
int index = m_widgetSource.find_last_of("\\/");
{
public:
DirectoryDeletor();
+ DirectoryDeletor(std::string tempPath);
~DirectoryDeletor();
std::string getTempPath() const;
private:
* @brief WidgetLocation Builds paths for widget location during installation
*
* @param widgetname name of widget
- * @param browserRequest is browser Request
* @param sourcePath given source path
* @param t declaraced type of widget if type is needed
*
* In destruction removes temporary directory
*/
WidgetLocation(const std::string & widgetname, std::string sourcePath,
- bool browserRequest = false, WrtDB::PkgType t = WrtDB::PKG_TYPE_TIZEN_WEBAPP);
+ WrtDB::PackagingType t = WrtDB::PKG_TYPE_NOMAL_WEB_APP);
+
+ WidgetLocation(const std::string & widgetname, std::string sourcePath,
+ std::string dirPath,
+ WrtDB::PackagingType t = WrtDB::PKG_TYPE_NOMAL_WEB_APP);
~WidgetLocation();
// Installed paths
std::string getBackupBinaryDir() const; // /opt/apps/[package]/backup/bin
std::string getBackupExecFile() const; // /opt/apps/[package]/backup/bin/[package]
- bool browserRequest() const;
-
// Temporary paths
/**
* @brief getTemporaryRootDir
private:
std::string m_widgetSource; // Source widget zip file/widget url
- bool m_browser; // is browser request installation
std::string m_pkgname; //name of package
std::string m_iconPath; //installed icon path
- WrtDB::PkgType m_type;
+ WrtDB::PackagingType m_type;
std::shared_ptr<DirectoryDeletor> m_temp; //directory
WrtDB::ExternalLocationList m_externals;
};