${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}
+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 <jihoon.chung@samsung.com> 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 <sy037.kim@samsung.com> 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"
#include <openssl/sha.h>
#include <dpl/exception.h>
-namespace WRTDecryptor{
+extern char** calculate(char*pappId, int idLen, int keyLen);
+namespace WRTDecryptor{
class ResourceDecryptor
{
public:
private:
AES_KEY* GetDecryptionKey();
- AES_KEY *m_decKey;
+ AES_KEY m_decKey;
};
} //namespace WRTDecryptor
#include <openssl/sha.h>
#include <dpl/exception.h>
-namespace WRTEncryptor{
+extern char** calculate(char*pappId, int idLen, int keyLen);
+namespace WRTEncryptor{
class ResourceEncryptor
{
public:
#include <dpl/exception.h>
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);
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<char*>(userKey.c_str()), userKey.size(), KEY_SIZE);
+ unsigned char *key = reinterpret_cast<unsigned char*>(*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");
}
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()
return;
}
- AES_KEY decKey;
- const unsigned char* key = reinterpret_cast<unsigned char*>(
- const_cast<char*>(userKey.c_str()));
+ char **duk = calculate(const_cast<char*>(userKey.c_str()), userKey.size(), KEY_SIZE);
+ unsigned char *key = reinterpret_cast<unsigned char*>(*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");
}
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
{
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
--- /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 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 <string>
+#include <dpl/string.h>
+
+#include <dpl/wrt-dao-ro/global_config.h>
+#include <dpl/wrt-dao-ro/path_builder.h>
+
+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
-#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
%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} \