- regex_t reg;
- regcomp(®, REG_TIZENID_PATTERN, REG_NOSUB);
- struct stat dirStat;
- if(!!configInfo.tizenId) {
- LogDebug("Setting tizenId provided in config.xml");
- if ((regexec(®, DPL::ToUTF8String(*(configInfo.tizenId)).c_str(),
- static_cast<size_t>(0), NULL, 0) != 0) ||
- (DPL::ToUTF8String(*(configInfo.tizenId)).size() > MAX_TIZENID_LENTH) ||
- (stat((std::string(GlobalConfig::GetUserInstalledWidgetPath()) + "/"
- + DPL::ToUTF8String(*(configInfo.tizenId))).c_str(), &dirStat) == 0))
- {
- //it is true when tizenId does not fit REG_TIZENID_PATTERN
- LogError("pkgName provided but not proper.");
- regfree(®);
- return false;
- }
- m_installerContext.widgetConfig.pkgname = configInfo.tizenId;
-
- } else {
- LogInfo("package name is generated by WRT");
- // tizen id should be generated by secure random algorithm
- std::string pkgName = WrtDB::GlobalConfig::GetPkgnamePrefix();
-
- bool named = false;
- FOREACH(it, configInfo.localizedDataSet)
- {
- if (!!((it->second).name)) {
- //there is a name provided
- std::string name = DPL::ToUTF8String(*(it->second).name);
- //cut very long widget's name
- name = name.substr(0, MAX_TIZENID_LENTH - strlen(
- WrtDB::GlobalConfig::GetPkgnamePrefix()));
- //check name if all characters are supported by filesystem
- if (regexec(®, name.c_str(), static_cast<size_t>(0), NULL, 0)
- == 0)
- {
- //WidgetName is ok and can be used as package name
- //replace all spaces with '_'
- size_t pos = 0;
- while((pos = name.find(" ", pos)) != std::string::npos) {
- name.replace(pos, 1, "_");
- ++pos;
- }
- pkgName += name;
- named = true;
- }
- break;
+ Try
+ {
+ std::string tempDir =
+ Jobs::WidgetInstall::createTempPath(m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_PRELOAD);
+
+ m_isDRM = isDRMWidget(widgetPath);
+ if (true == m_isDRM) {
+ LogDebug("decrypt DRM widget");
+ if (DecryptDRMWidget(widgetPath, tempDir)) {
+ LogDebug("Failed decrypt DRM widget");
+ return ConfigureResult::Failed_DrmError;