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)
ADD_SUBDIRECTORY(custom_handler_dao)
ADD_SUBDIRECTORY(utils)
ADD_SUBDIRECTORY(support)
-ADD_SUBDIRECTORY(encryption)
ADD_SUBDIRECTORY(certificate_dao)
ADD_SUBDIRECTORY(i18n)
+++ /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 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)
+++ /dev/null
-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
include(utils/config.cmake)
include(localization/config.cmake)
include(support/config.cmake)
-include(encryption/config.cmake)
+++ /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 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
-)
+++ /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 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 <string.h>
-#include <string>
-#include <openssl/aes.h>
-#include <openssl/sha.h>
-#include <dpl/exception.h>
-
-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 */
+++ /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 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 <string.h>
-#include <string>
-#include <openssl/aes.h>
-#include <openssl/sha.h>
-#include <dpl/exception.h>
-
-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 */
+++ /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 resource_decryption.cpp
- * @author Soyoung Kim (sy037.kim@samsung.com)
- * @version 1.0
- * @brief Implementation file for resource decryption
- */
-#include <stddef.h>
-#include <dpl/encryption/resource_decryption.h>
-
-#include <fcntl.h>
-#include <string>
-#include <dpl/log/log.h>
-#include <dpl/exception.h>
-#include <dukgen.h>
-
-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<char*>(userKey.c_str()),
- userKey.size(), KEY_SIZE);
-
- unsigned char *key = reinterpret_cast<unsigned char*>(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
+++ /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 resource_encryption.cpp
- * @author Soyoung Kim (sy037.kim@samsung.com)
- * @version 1.0
- * @brief Implementation file for resource encryption
- */
-#include <stddef.h>
-#include <dpl/encryption/resource_encryption.h>
-
-#include <fcntl.h>
-#include <dpl/log/log.h>
-#include <dukgen.h>
-
-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<char*>(userKey.c_str()),
- userKey.size(), KEY_SIZE);
- unsigned char *key = reinterpret_cast<unsigned char*>(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
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(libiri)
BuildRequires: pkgconfig(libidn)
-BuildRequires: pkgconfig(cryptsvc)
-BuildRequires: pkgconfig(dukgenerator)
BuildRequires: pkgconfig(minizip)
-Requires: libcryptsvc
%description
Wrt common library