From 36a3a4e014b79f40a124b106df7b65e51a9de446 Mon Sep 17 00:00:00 2001 From: Pawel Sikorski Date: Thu, 13 Aug 2015 12:41:12 +0200 Subject: [PATCH] WebApp encryption step alignement to libwebapenc library API change Requires: https://review.tizen.org/gerrit/#/c/46007/ Change-Id: I718f11f597cf8a7bd9916607864920582ca21cd7 --- src/wgt/step/step_encrypt_resources.cc | 8 ++++++-- src/wgt/step/step_remove_encryption_data.cc | 6 +++++- src/wgt/wgt_installer.cc | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/wgt/step/step_encrypt_resources.cc b/src/wgt/step/step_encrypt_resources.cc index 1511431..a1ca7c5 100644 --- a/src/wgt/step/step_encrypt_resources.cc +++ b/src/wgt/step/step_encrypt_resources.cc @@ -56,6 +56,7 @@ common_installer::Step::Status StepEncryptResources::process() { LOG(DEBUG) << "no encryption"; return common_installer::Step::Status::OK; } + LOG(DEBUG) << "Encrypting"; if (!Encrypt(input_)) { LOG(ERROR) << "Error during encryption"; @@ -125,11 +126,14 @@ bool StepEncryptResources::EncryptFile(const bf::path &src) { unsigned char* encrypted_data = nullptr; size_t enc_data_len = 0; // TODO(p.sikorski) check if it is Preloaded - int is_preloaded = 0; + wae_app_type_e enc_type = + context_->uid.get() == tzplatform_getuid(TZ_SYS_GLOBALAPP_USER) ? + WAE_DOWNLOADED_GLOBAL_APP : WAE_DOWNLOADED_NORMAL_APP; + int ret = wae_encrypt_web_application( context_->pkgid.get().c_str(), - is_preloaded, + enc_type, reinterpret_cast(input_buffer), length, &encrypted_data, diff --git a/src/wgt/step/step_remove_encryption_data.cc b/src/wgt/step/step_remove_encryption_data.cc index 24357f6..d22f0de 100644 --- a/src/wgt/step/step_remove_encryption_data.cc +++ b/src/wgt/step/step_remove_encryption_data.cc @@ -13,10 +13,14 @@ namespace wgt { namespace encrypt { common_installer::Step::Status StepRemoveEncryptionData::process() { + wae_app_type_e enc_type = + context_->uid.get() == tzplatform_getuid(TZ_SYS_GLOBALAPP_USER) ? + WAE_DOWNLOADED_GLOBAL_APP : WAE_DOWNLOADED_NORMAL_APP; + // There is no check, if application was encrypted or not // (it is not saved anywhere in tizen manifest) // so, if WAE_ERROR_NO_KEY error, then application was not encrypted - int ret = wae_remove_app_dek(context_->pkgid.get().c_str()); + int ret = wae_remove_app_dek(context_->pkgid.get().c_str(), enc_type); if (WAE_ERROR_NONE == ret || WAE_ERROR_NO_KEY == ret) { LOG(DEBUG) << "Encryption data removed (if existed)"; return common_installer::Step::Status::OK; diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index 9b75632..7609060 100644 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -39,6 +39,7 @@ #include "wgt/step/step_create_symbolic_link.h" #include "wgt/step/step_check_settings_level.h" +#include "wgt/step/step_encrypt_resources.h" #include "wgt/step/step_parse.h" #include "wgt/step/step_parse_recovery.h" #include "wgt/step/step_remove_encryption_data.h" @@ -63,6 +64,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(true); AddStep(); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); -- 2.7.4