From: Tomasz Iwanek Date: Thu, 25 Jul 2013 11:51:44 +0000 (+0200) Subject: DPL Encryption module removal X-Git-Tag: 2.2.1_release~9^2~42 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f86a026902aa5beccaf8f8cdd30ed688b57480e;p=framework%2Fweb%2Fwrt-commons.git DPL Encryption module removal [Issue#] N/A [Feature] Removal of unused code [Cause] Unused code [Solution] Removal [Verification] Build repository. This code will not be used as it was replaced by secure storage. Change-Id: I938a79185990740191522a98cb520e48f4f67e0e --- diff --git a/CMakeLists.txt b/CMakeLists.txt index fe837ef..92f1d49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,7 +191,6 @@ SET(TARGET_CUSTOM_HANDLER_DAO_RO_LIB "wrt-commons-custom-handler-dao-ro") SET(TARGET_SECURITY_ORIGIN_DAO_LIB "wrt-commons-security-origin-dao") SET(TARGET_CERTIFICATE_DAO_LIB "wrt-commons-certificate-dao") SET(TARGET_DPL_UTILS_EFL "lib${PROJECT_NAME}-utils-efl") -SET(TARGET_DPL_ENCRYPTION "lib${PROJECT_NAME}-encryption") SET(TARGET_I18N_DAO_RO_LIB "wrt-commons-i18n-dao-ro") macro(configure_and_install_pkg PKG_FILE) diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 852127c..b9598d6 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -31,6 +31,5 @@ ADD_SUBDIRECTORY(security_origin_dao) ADD_SUBDIRECTORY(custom_handler_dao) ADD_SUBDIRECTORY(utils) ADD_SUBDIRECTORY(support) -ADD_SUBDIRECTORY(encryption) ADD_SUBDIRECTORY(certificate_dao) ADD_SUBDIRECTORY(i18n) diff --git a/build/encryption/CMakeLists.txt b/build/encryption/CMakeLists.txt deleted file mode 100644 index 6e643b2..0000000 --- a/build/encryption/CMakeLists.txt +++ /dev/null @@ -1,76 +0,0 @@ -# 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 CMakeLists.txt -# @author Soyoung Kim (sy037.kim@samsung.com) -# @version 1.0 -# @brief -# - -# Check required modules -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(SYS_ENCRYPTION - dlog - openssl - cryptsvc - dukgenerator - REQUIRED -) - -# Add core include directories -INCLUDE_DIRECTORIES( - ${DPL_LOG_INCLUDE_DIR} - ${DPL_CORE_INCLUDE_DIR} - ${DPL_DB_INCLUDE_DIR} - ${DPL_ENCRYPTION_INCLUDE_DIR} -) - -INCLUDE_DIRECTORIES(SYSTEM ${SYS_ENCRYPTION_INCLUDE_DIRS}) - -LINK_DIRECTORIES( - ${SYS_ENCRYPTION_LIBRARY_DIRS} -) - -# Base EFL based DPL library -SET(DPL_ENCRYPTION_LIBRARY "${PROJECT_NAME}-encryption") - -# Build shared library - -ADD_LIBRARY(${TARGET_DPL_ENCRYPTION} SHARED - ${DPL_ENCRYPTION_SOURCES} -) - -TARGET_LINK_LIBRARIES(${TARGET_DPL_ENCRYPTION} - ${SYS_ENCRYPTION_LIBRARIES} - ${TARGET_DPL_EFL} -) - -# Target library properties -SET_TARGET_PROPERTIES(${TARGET_DPL_ENCRYPTION} PROPERTIES - SOVERSION ${API_VERSION} - VERSION ${VERSION} - CLEAN_DIRECT_OUTPUT 1 - OUTPUT_NAME ${DPL_ENCRYPTION_LIBRARY}) - -# Install libraries -INSTALL(TARGETS ${TARGET_DPL_ENCRYPTION} - DESTINATION lib) - -# Install detail headers - -INSTALL(FILES ${DPL_ENCRYPTION_HEADERS} - DESTINATION include/dpl-efl/dpl/encryption) - -# Install pkgconfig script -configure_and_install_pkg(dpl-encryption.pc) diff --git a/build/encryption/dpl-encryption.pc.in b/build/encryption/dpl-encryption.pc.in deleted file mode 100644 index dfddda3..0000000 --- a/build/encryption/dpl-encryption.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include - -Name: dpl-encryption -Description: DPL UTILS - EFL based -Version: @VERSION@ -Requires: dpl-efl -Libs: -L${libdir} -ldpl-encryption -Cflags: -I${includedir}/dpl-efl diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 4467c2c..a80bb78 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -35,4 +35,3 @@ ADD_SUBDIRECTORY(i18n) include(utils/config.cmake) include(localization/config.cmake) include(support/config.cmake) -include(encryption/config.cmake) diff --git a/modules/encryption/config.cmake b/modules/encryption/config.cmake deleted file mode 100644 index 5188ecb..0000000 --- a/modules/encryption/config.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# 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 config.cmake -# @author Soyoung Kim(sy037.kim@samsung.com) -# @version 1.0 -# @brief -# - -SET(DPL_ENCRYPTION_SOURCES - ${PROJECT_SOURCE_DIR}/modules/encryption/src/resource_encryption.cpp - ${PROJECT_SOURCE_DIR}/modules/encryption/src/resource_decryption.cpp - PARENT_SCOPE -) - - -SET(DPL_ENCRYPTION_HEADERS - ${PROJECT_SOURCE_DIR}/modules/encryption/include/dpl/encryption/resource_encryption.h - ${PROJECT_SOURCE_DIR}/modules/encryption/include/dpl/encryption/resource_decryption.h - PARENT_SCOPE -) - -SET(DPL_ENCRYPTION_INCLUDE_DIR - ${PROJECT_SOURCE_DIR}/modules/encryption/include - PARENT_SCOPE -) diff --git a/modules/encryption/include/dpl/encryption/resource_decryption.h b/modules/encryption/include/dpl/encryption/resource_decryption.h deleted file mode 100644 index a6d7af0..0000000 --- a/modules/encryption/include/dpl/encryption/resource_decryption.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 resource_decryption.h - * @author Soyoung Kim (sy037.kim@samsung.com) - * @version 1.0 - * @brief Header file for resource decryption - */ -#ifndef RESOURCE_DECRYPTION_H -#define RESOURCE_DECRYPTION_H - -#include -#include -#include -#include -#include - -extern char** calculate(char*pappId, int idLen, int keyLen); - -namespace WRTDecryptor { -class ResourceDecryptor -{ - public: - class Exception - { - public: - DECLARE_EXCEPTION_TYPE(DPL::Exception, Base) - DECLARE_EXCEPTION_TYPE(Base, GetDecKeyFailed) - DECLARE_EXCEPTION_TYPE(Base, EncryptionFailed) - }; - - ResourceDecryptor(); - ResourceDecryptor(std::string userKey); - virtual ~ResourceDecryptor(); - - void SetDecryptionKey(std::string userKey); - void GetDecryptedChunk(unsigned char* inBuf, - unsigned char* decBuf, - size_t chunkSize); - - private: - AES_KEY* GetDecryptionKey(); - AES_KEY m_decKey; -}; -} //namespace WRTDecryptor - -#endif /* RESOURCE_DECRYPTION_H */ diff --git a/modules/encryption/include/dpl/encryption/resource_encryption.h b/modules/encryption/include/dpl/encryption/resource_encryption.h deleted file mode 100644 index f2e4988..0000000 --- a/modules/encryption/include/dpl/encryption/resource_encryption.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 resource_encryption.h - * @author Soyoung Kim (sy037.kim@samsung.com) - * @version 1.0 - * @brief Header file for resource encryption - */ -#ifndef RESOURCE_ENCRYPTION_H -#define RESOURCE_ENCRYPTION_H - -#include -#include -#include -#include -#include - -extern char** calculate(char*pappId, int idLen, int keyLen); - -namespace WRTEncryptor { -class ResourceEncryptor -{ - public: - class Exception - { - public: - DECLARE_EXCEPTION_TYPE(DPL::Exception, Base) - DECLARE_EXCEPTION_TYPE(DPL::Exception, CreateEncKeyFailed) - DECLARE_EXCEPTION_TYPE(DPL::Exception, CreateDecKeyFailed) - DECLARE_EXCEPTION_TYPE(DPL::Exception, CreateEncKeyFileFailed) - DECLARE_EXCEPTION_TYPE(DPL::Exception, CreateDecKeyFileFailed) - DECLARE_EXCEPTION_TYPE(DPL::Exception, EncryptionFailed) - }; - - ResourceEncryptor(); - virtual ~ResourceEncryptor(); - - int GetBlockSize(int inSize); - void CreateEncryptionKey(std::string userKey); - void EncryptChunk(unsigned char* inputBuf, unsigned char* encBuf, size_t - chunkSize); - - private: - AES_KEY GetEncryptionkey(); - AES_KEY m_encKey; -}; -} //namespace WRTEncryptor - -#endif /* RESOURCE_DECRYPTION_H */ diff --git a/modules/encryption/src/resource_decryption.cpp b/modules/encryption/src/resource_decryption.cpp deleted file mode 100644 index c599e64..0000000 --- a/modules/encryption/src/resource_decryption.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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 resource_decryption.cpp - * @author Soyoung Kim (sy037.kim@samsung.com) - * @version 1.0 - * @brief Implementation file for resource decryption - */ -#include -#include - -#include -#include -#include -#include -#include - -namespace { -#define BITS_SIZE 128 -#define KEY_SIZE 16 -} -namespace WRTDecryptor { -ResourceDecryptor::ResourceDecryptor() -{ - LogDebug("Started Decryption"); -} - -ResourceDecryptor::ResourceDecryptor(std::string userKey) -{ - LogDebug("Finished Decryption"); - SetDecryptionKey(userKey); -} - -ResourceDecryptor::~ResourceDecryptor() -{} - -void ResourceDecryptor::SetDecryptionKey(std::string userKey) -{ - if (userKey.empty()) { - return; - } - - char* pKey = GetDeviceUniqueKey(const_cast(userKey.c_str()), - userKey.size(), KEY_SIZE); - - unsigned char *key = reinterpret_cast(pKey); - - 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; -} - -void ResourceDecryptor::GetDecryptedChunk(unsigned char* - inBuf, - unsigned char* decBuf, - size_t inBufSize) -{ - Assert(decBuf); - 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); - LogDebug("Success decryption"); -} -} //namespace WRTDecryptor diff --git a/modules/encryption/src/resource_encryption.cpp b/modules/encryption/src/resource_encryption.cpp deleted file mode 100644 index 8dc5284..0000000 --- a/modules/encryption/src/resource_encryption.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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 resource_encryption.cpp - * @author Soyoung Kim (sy037.kim@samsung.com) - * @version 1.0 - * @brief Implementation file for resource encryption - */ -#include -#include - -#include -#include -#include - -namespace { -#define BITS_SIZE 128 -#define KEY_SIZE 16 -} -namespace WRTEncryptor { -ResourceEncryptor::ResourceEncryptor() -{ - LogDebug("Started Encrytion"); -} - -ResourceEncryptor::~ResourceEncryptor() -{ - LogDebug("Finished Encrytion"); -} - -int ResourceEncryptor::GetBlockSize(int inSize) -{ - if ((inSize % AES_BLOCK_SIZE) != 0) { - return (( inSize / AES_BLOCK_SIZE) + 1) * AES_BLOCK_SIZE; - } - return inSize; -} - -void ResourceEncryptor::CreateEncryptionKey(std::string userKey) -{ - if (userKey.empty()) { - return; - } - - char* pKey = GetDeviceUniqueKey(const_cast(userKey.c_str()), - userKey.size(), KEY_SIZE); - unsigned char *key = reinterpret_cast(pKey); - - if (0 > AES_set_encrypt_key(key, BITS_SIZE, &m_encKey)) { - ThrowMsg(ResourceEncryptor::Exception::CreateEncKeyFailed, - "Failed to create encryption key"); - } - LogDebug("Success to create ecryption and decryption key"); -} - -AES_KEY ResourceEncryptor::GetEncryptionkey() -{ - return m_encKey; -} - -void ResourceEncryptor::EncryptChunk(unsigned char* - inputBuf, - unsigned char* encBuf, - size_t chunkSize) -{ - Assert(inputBuf); - Assert(encBuf); - - unsigned char ivec[16] = { 0, }; - - AES_cbc_encrypt(inputBuf, encBuf, chunkSize, &m_encKey, ivec, AES_ENCRYPT); -} -} //namespace ResourceEnc diff --git a/packaging/wrt-commons.spec b/packaging/wrt-commons.spec index 406d974..fc13198 100644 --- a/packaging/wrt-commons.spec +++ b/packaging/wrt-commons.spec @@ -23,10 +23,7 @@ BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(libiri) BuildRequires: pkgconfig(libidn) -BuildRequires: pkgconfig(cryptsvc) -BuildRequires: pkgconfig(dukgenerator) BuildRequires: pkgconfig(minizip) -Requires: libcryptsvc %description Wrt common library