From: Jihoon Chung Date: Sat, 29 Dec 2012 05:12:57 +0000 (+0900) Subject: [Release] wrt-commons_0.2.88 X-Git-Tag: submit/tizen_2.0/20121229.051323 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=18e08c1667b77ebe591bd1109fc3bd349097b243;p=platform%2Fframework%2Fweb%2Fwrt-commons.git [Release] wrt-commons_0.2.88 Change-Id: I75010545e0bd27a0d60296c87fba7a64a51c2169 --- diff --git a/build/encryption/CMakeLists.txt b/build/encryption/CMakeLists.txt index 710ada6..bf38cae 100644 --- a/build/encryption/CMakeLists.txt +++ b/build/encryption/CMakeLists.txt @@ -54,6 +54,8 @@ TARGET_LINK_LIBRARIES(${TARGET_DPL_ENCRYPTION} ${TARGET_DPL_EFL} ) +TARGET_LINK_LIBRARIES(${TARGET_DPL_ENCRYPTION} -L./libs -lcal) + # Target library properties SET_TARGET_PROPERTIES(${TARGET_DPL_ENCRYPTION} PROPERTIES SOVERSION ${API_VERSION} diff --git a/build/encryption/libs/libcal.a b/build/encryption/libs/libcal.a new file mode 100755 index 0000000..8400c5f Binary files /dev/null and b/build/encryption/libs/libcal.a differ diff --git a/build/encryption/libs/libcal.arm.a b/build/encryption/libs/libcal.arm.a new file mode 100755 index 0000000..f1d622b Binary files /dev/null and b/build/encryption/libs/libcal.arm.a differ diff --git a/build/encryption/libs/libcal.i586.a b/build/encryption/libs/libcal.i586.a new file mode 100755 index 0000000..b02e413 Binary files /dev/null and b/build/encryption/libs/libcal.i586.a differ diff --git a/debian/changelog b/debian/changelog index 5fd642d..52e2fd1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,21 @@ +wrt-commons (0.2.88) unstable; urgency=low + + * Add path builder for vconf key + + * Git : framework/web/wrt-commons + * Tag : wrt-commons_0.2.88 + + -- Jihoon Chung Sat, 29 Dec 2012 14:02:18 +0900 + +wrt-commons (0.2.87) unstable; urgency=low + + * changed to get encryption/decryption key from device unique key + + * Git : framework/web/wrt-commons + * Tag : wrt-commons_0.2.87 + + -- Soyoung Kim Fri, 28 Dec 2012 20:47:21 +0900 + wrt-commons (0.2.86) unstable; urgency=low * Revert "Modify get encryption/decryption key from device unique key" diff --git a/modules/encryption/include/dpl/encryption/resource_decryption.h b/modules/encryption/include/dpl/encryption/resource_decryption.h index c22b1d2..2a39eb1 100644 --- a/modules/encryption/include/dpl/encryption/resource_decryption.h +++ b/modules/encryption/include/dpl/encryption/resource_decryption.h @@ -28,8 +28,9 @@ #include #include -namespace WRTDecryptor{ +extern char** calculate(char*pappId, int idLen, int keyLen); +namespace WRTDecryptor{ class ResourceDecryptor { public: @@ -50,7 +51,7 @@ class ResourceDecryptor private: AES_KEY* GetDecryptionKey(); - AES_KEY *m_decKey; + AES_KEY m_decKey; }; } //namespace WRTDecryptor diff --git a/modules/encryption/include/dpl/encryption/resource_encryption.h b/modules/encryption/include/dpl/encryption/resource_encryption.h index ffc82c2..6f57a93 100644 --- a/modules/encryption/include/dpl/encryption/resource_encryption.h +++ b/modules/encryption/include/dpl/encryption/resource_encryption.h @@ -28,8 +28,9 @@ #include #include -namespace WRTEncryptor{ +extern char** calculate(char*pappId, int idLen, int keyLen); +namespace WRTEncryptor{ class ResourceEncryptor { public: diff --git a/modules/encryption/src/resource_decryption.cpp b/modules/encryption/src/resource_decryption.cpp index db45f81..9e8b39f 100644 --- a/modules/encryption/src/resource_decryption.cpp +++ b/modules/encryption/src/resource_decryption.cpp @@ -28,19 +28,16 @@ #include namespace { -inline std::string GetDefaultEncryptKeyPath() { - return "/opt/share/widget/data/"; -} +#define BITS_SIZE 128 +#define KEY_SIZE 16 } namespace WRTDecryptor{ -ResourceDecryptor::ResourceDecryptor() : - m_decKey(NULL) +ResourceDecryptor::ResourceDecryptor() { LogDebug("Started Decryption"); } -ResourceDecryptor::ResourceDecryptor(std::string userKey) : - m_decKey(NULL) +ResourceDecryptor::ResourceDecryptor(std::string userKey) { LogDebug("Finished Decryption"); SetDecryptionKey(userKey); @@ -48,47 +45,39 @@ ResourceDecryptor::ResourceDecryptor(std::string userKey) : ResourceDecryptor::~ResourceDecryptor() { - delete m_decKey; } void ResourceDecryptor::SetDecryptionKey(std::string userKey) { - /* TODO : get key from secure storage */ - std::string keyPath = GetDefaultEncryptKeyPath() + userKey + "_dec"; - LogDebug("Description Key path : " << keyPath); - - FILE* fp = fopen(keyPath.c_str(), "rb"); - if (fp == NULL) { - ThrowMsg(ResourceDecryptor::Exception::GetDecKeyFailed, - "Failed to get decryption key"); + if (userKey.empty()) { + return; } - m_decKey = new AES_KEY; - size_t resultSize =fread(m_decKey, 1, sizeof(AES_KEY),fp); - if (resultSize!= sizeof(AES_KEY)) - ThrowMsg(ResourceDecryptor::Exception::GetDecKeyFailed, - "Failed to get AES key"); + char **duk = calculate(const_cast(userKey.c_str()), userKey.size(), KEY_SIZE); + unsigned char *key = reinterpret_cast(*duk); - fclose(fp); + if ( 0 > AES_set_decrypt_key(key, BITS_SIZE, &m_decKey)) { + ThrowMsg(ResourceDecryptor::Exception::GetDecKeyFailed, + "Failed to create decryption key"); + } } AES_KEY* ResourceDecryptor::GetDecryptionKey() { - return m_decKey; + return &m_decKey; } void ResourceDecryptor::GetDecryptedChunk(unsigned char* inBuf, unsigned char* decBuf, size_t inBufSize) { Assert(decBuf); - Assert(m_decKey); - if (decBuf == NULL || m_decKey == NULL) { + if (decBuf == NULL) { ThrowMsg(ResourceDecryptor::Exception::EncryptionFailed, "Failed to Get Decryption Chunk"); } unsigned char ivec[16] = {0, }; - AES_cbc_encrypt(inBuf, decBuf, inBufSize, m_decKey, ivec, AES_DECRYPT); + AES_cbc_encrypt(inBuf, decBuf, inBufSize, &m_decKey, ivec, AES_DECRYPT); LogDebug("Success decryption"); } diff --git a/modules/encryption/src/resource_encryption.cpp b/modules/encryption/src/resource_encryption.cpp index e89940e..a238705 100644 --- a/modules/encryption/src/resource_encryption.cpp +++ b/modules/encryption/src/resource_encryption.cpp @@ -27,12 +27,7 @@ namespace { #define BITS_SIZE 128 -const char* ENCRYPTION_FILE = "_enc"; -const char* DECRYPTION_FILE = "_dec"; - -inline std::string GetDefaultEncryptKeyPath() { - return "/opt/share/widget/data"; -} +#define KEY_SIZE 16 } namespace WRTEncryptor{ ResourceEncryptor::ResourceEncryptor() @@ -59,44 +54,13 @@ void ResourceEncryptor::CreateEncryptionKey(std::string userKey) return; } - AES_KEY decKey; - const unsigned char* key = reinterpret_cast( - const_cast(userKey.c_str())); + char **duk = calculate(const_cast(userKey.c_str()), userKey.size(), KEY_SIZE); + unsigned char *key = reinterpret_cast(*duk); if ( 0 > AES_set_encrypt_key(key, BITS_SIZE, &m_encKey)) { ThrowMsg(ResourceEncryptor::Exception::CreateEncKeyFailed, "Failed to create encryption key"); } - if ( 0 > AES_set_decrypt_key(key, BITS_SIZE, &decKey)) { - ThrowMsg(ResourceEncryptor::Exception::CreateDecKeyFailed, - "Failed to create decryption key"); - } - - std::string encPath, decPath; - - encPath = GetDefaultEncryptKeyPath() + "/" + userKey + ENCRYPTION_FILE; - decPath = GetDefaultEncryptKeyPath() + "/" + userKey + DECRYPTION_FILE; - - /* TODO : save keys to secure storage */ - LogDebug("Encryption Key path " << encPath); - LogDebug("Decryption Key path " << decPath); - - FILE* encFp = fopen(encPath.c_str(), "wb"); - if (encFp == NULL) { - ThrowMsg(ResourceEncryptor::Exception::CreateEncKeyFileFailed, - "Failed to save encryption key"); - } - fwrite(&m_encKey, 1, sizeof(m_encKey), encFp); - fclose(encFp); - - FILE* decFp = fopen(decPath.c_str(), "wb"); - if (decFp == NULL) { - ThrowMsg(ResourceEncryptor::Exception::CreateDecKeyFileFailed, - "Failed to save decryption key"); - } - - fwrite(&decKey, 1, sizeof(decKey), decFp); - fclose(decFp); LogDebug("Success to create ecryption and decryption key"); } diff --git a/modules/widget_dao/CMakeLists.txt b/modules/widget_dao/CMakeLists.txt index fca9cba..cf1034f 100644 --- a/modules/widget_dao/CMakeLists.txt +++ b/modules/widget_dao/CMakeLists.txt @@ -126,11 +126,12 @@ INSTALL(FILES include/dpl/wrt-dao-ro/plugin_dao_read_only.h include/dpl/wrt-dao-ro/property_dao_read_only.h include/dpl/wrt-dao-ro/widget_config.h + include/dpl/wrt-dao-ro/vconf_config.h include/dpl/wrt-dao-ro/widget_dao_read_only.h include/dpl/wrt-dao-ro/wrt_db_types.h include/dpl/wrt-dao-ro/WrtDatabase.h DESTINATION include/dpl-efl/dpl/wrt-dao-ro - ) + ) INSTALL(FILES include/dpl/wrt-dao-rw/feature_dao.h diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h b/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h index 2721214..87bf9d6 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h @@ -284,6 +284,37 @@ inline const char* GetTempInstallInfoPath() { return "/opt/share/widget/temp_info"; } + +inline const char* GetVconfKeyPrefixPath() +{ + return "file/private"; +} + +inline const char* GetVconfKeyPopupUsagePath() +{ + return "/popup_usage"; +} + +inline const char* GetVconfKeyGeolocationUsagePath() +{ + return "/geolocation_usage"; +} + +inline const char* GetVconfKeyWebNotificationUsagePath() +{ + return "/web_notification_usage"; +} + +inline const char* GetVconfKeyWebDatabaseUsagePath() +{ + return "/web_database_usage"; +} + +inline const char* GetVconfKeyFilesystemUsagePath() +{ + return "/filesystem_usage"; +} + } // namespace GlobalConfig } // namespace WrtDB diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/vconf_config.h b/modules/widget_dao/include/dpl/wrt-dao-ro/vconf_config.h new file mode 100644 index 0000000..4a3c2cb --- /dev/null +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/vconf_config.h @@ -0,0 +1,89 @@ +/* + * 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 vconf_config.h + * @author Jihoon Chung (jihoon.chung@samsung.com) + * @version 1.0 + * @brief Implementation file for vconf key config. + */ +#ifndef SRC_DOMAIN_VCONF_CONFIG_H +#define SRC_DOMAIN_VCONF_CONFIG_H + +#include +#include + +#include +#include + +namespace WrtDB { +namespace VconfConfig { +inline std::string GetVconfKeyRootPath(DPL::String pkgName) +{ + return PathBuilder() + .Append(GlobalConfig::GetVconfKeyPrefixPath()) + .Append(DPL::ToUTF8String(pkgName)) + .GetFullPath(); +} + +inline std::string GetVconfKeyPopupUsage(DPL::String pkgName) +{ + return PathBuilder() + .Append(GlobalConfig::GetVconfKeyPrefixPath()) + .Append(DPL::ToUTF8String(pkgName)) + .Concat(GlobalConfig::GetVconfKeyPopupUsagePath()) + .GetFullPath(); +} + +inline std::string GetVconfKeyGeolocationUsage(DPL::String pkgName) +{ + return PathBuilder() + .Append(GlobalConfig::GetVconfKeyPrefixPath()) + .Append(DPL::ToUTF8String(pkgName)) + .Concat(GlobalConfig::GetVconfKeyGeolocationUsagePath()) + .GetFullPath(); +} + +inline std::string GetVconfKeyWebNotificationUsage(DPL::String pkgName) +{ + return PathBuilder() + .Append(GlobalConfig::GetVconfKeyPrefixPath()) + .Append(DPL::ToUTF8String(pkgName)) + .Concat(GlobalConfig::GetVconfKeyWebNotificationUsagePath()) + .GetFullPath(); +} + +inline std::string GetVconfKeyWebDatabaseUsage(DPL::String pkgName) +{ + return PathBuilder() + .Append(GlobalConfig::GetVconfKeyPrefixPath()) + .Append(DPL::ToUTF8String(pkgName)) + .Concat(GlobalConfig::GetVconfKeyWebDatabaseUsagePath()) + .GetFullPath(); +} + +inline std::string GetVconfKeyFilesystemUsage(DPL::String pkgName) +{ + return PathBuilder() + .Append(GlobalConfig::GetVconfKeyPrefixPath()) + .Append(DPL::ToUTF8String(pkgName)) + .Concat(GlobalConfig::GetVconfKeyFilesystemUsagePath()) + .GetFullPath(); +} + +} // namespace VconfConfig +} // namespace WrtDB + +#endif diff --git a/packaging/wrt-commons.spec b/packaging/wrt-commons.spec index 0751d22..a1ca79e 100644 --- a/packaging/wrt-commons.spec +++ b/packaging/wrt-commons.spec @@ -1,7 +1,7 @@ -#git:framework/web/wrt-commons wrt-commons 0.2.86 +#git:framework/web/wrt-commons wrt-commons 0.2.88 Name: wrt-commons Summary: Wrt common library -Version: 0.2.86 +Version: 0.2.88 Release: 1 Group: Development/Libraries License: Apache License, Version 2.0 @@ -44,6 +44,13 @@ Wrt common library development headers %endif %build + +%ifarch %{ix86} +cp build/encryption/libs/libcal.i586.a build/encryption/libs/libcal.a +%else +cp build/encryption/libs/libcal.arm.a build/encryption/libs/libcal.a +%endif + export LDFLAGS+="-Wl,--rpath=%{_libdir} -Wl,--hash-style=both -Wl,--as-needed" cmake . -DVERSION=%{version} \