From 97e7d0bb8d5fc5e4f649d407768f72cdacfeea7c Mon Sep 17 00:00:00 2001 From: Dongjin Choi Date: Fri, 10 May 2013 16:56:13 +0900 Subject: [PATCH] Update change log and spec for wrt-plugins-tizen_0.4.30 [Issue#] N/A [Problem] PermissionDeniedError used instead of SecurityError [Cause] Misused MACRO [Solution] Fixed Macros --- packaging/wrt-plugins-tizen.spec | 2 +- src/Callhistory/ResponseDispatcher.cpp | 6 +- src/Common/SecurityExceptions.h | 4 +- src/DataControl/DataControlListener.cpp | 2 +- src/Filesystem/JSFile.cpp | 8 +- src/Filesystem/JSFilesystemManager.cpp | 2 +- src/Filesystem/ResponseDispatcher.cpp | 14 +- src/SecureElement/SEUtil.cpp | 2 +- src/SecureStorage/CMakeLists.txt | 25 -- src/SecureStorage/JSSecureStorageManager.cpp | 406 --------------------------- src/SecureStorage/JSSecureStorageManager.h | 71 ----- src/SecureStorage/SecureStorageManager.cpp | 265 ----------------- src/SecureStorage/SecureStorageManager.h | 53 ---- src/SecureStorage/config.xml | 18 -- src/SecureStorage/plugin_config.cpp | 127 --------- src/SecureStorage/plugin_config.h | 38 --- src/SecureStorage/plugin_initializer.cpp | 60 ---- 17 files changed, 20 insertions(+), 1083 deletions(-) delete mode 100644 src/SecureStorage/CMakeLists.txt delete mode 100644 src/SecureStorage/JSSecureStorageManager.cpp delete mode 100644 src/SecureStorage/JSSecureStorageManager.h delete mode 100644 src/SecureStorage/SecureStorageManager.cpp delete mode 100644 src/SecureStorage/SecureStorageManager.h delete mode 100644 src/SecureStorage/config.xml delete mode 100644 src/SecureStorage/plugin_config.cpp delete mode 100644 src/SecureStorage/plugin_config.h delete mode 100644 src/SecureStorage/plugin_initializer.cpp diff --git a/packaging/wrt-plugins-tizen.spec b/packaging/wrt-plugins-tizen.spec index 16dd410..0f1aec8 100755 --- a/packaging/wrt-plugins-tizen.spec +++ b/packaging/wrt-plugins-tizen.spec @@ -1,6 +1,6 @@ Name: wrt-plugins-tizen Summary: JavaScript plugins for WebRuntime -Version: 0.4.29 +Version: 0.4.30 Release: 0 Group: Development/Libraries License: Apache License, Version 2.0 diff --git a/src/Callhistory/ResponseDispatcher.cpp b/src/Callhistory/ResponseDispatcher.cpp index ae0fdcf..8002c0f 100755 --- a/src/Callhistory/ResponseDispatcher.cpp +++ b/src/Callhistory/ResponseDispatcher.cpp @@ -68,7 +68,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventFindCallHistoryPtr& event) } else { JSObjectRef jsException = NULL; if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) { - jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "Permission denied error"); + jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error"); } else { jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown error"); } @@ -89,7 +89,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventRemoveBatchPtr& event) } else { JSObjectRef jsException = NULL; if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) { - jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "Permission denied error"); + jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error"); } else { jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown error"); } @@ -110,7 +110,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventRemoveAllPtr& event) } else { JSObjectRef jsException = NULL; if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) { - jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "Permission denied error"); + jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error"); } else { jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown error"); } diff --git a/src/Common/SecurityExceptions.h b/src/Common/SecurityExceptions.h index 0c5c3d0..f76b623 100644 --- a/src/Common/SecurityExceptions.h +++ b/src/Common/SecurityExceptions.h @@ -37,7 +37,7 @@ namespace Common { break; \ case AceSecurityStatus::AccessDenied: \ return JSWebAPIErrorFactory::postException(context, exception, \ - JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR); \ + JSWebAPIErrorFactory::SECURITY_ERROR); \ break; \ default: \ break; \ @@ -57,7 +57,7 @@ namespace Common { return JSValueMakeNull(context); \ case AceSecurityStatus::AccessDenied: \ cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, \ - JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "PERMISSION_DENIED_ERROR")); \ + JSWebAPIErrorFactory::SECURITY_ERROR, "Security Error")); \ return JSValueMakeNull(context); \ default: \ break; \ diff --git a/src/DataControl/DataControlListener.cpp b/src/DataControl/DataControlListener.cpp index 3254502..d0eb7f6 100644 --- a/src/DataControl/DataControlListener.cpp +++ b/src/DataControl/DataControlListener.cpp @@ -81,7 +81,7 @@ void DataControlListener::MakeErrorJSCallBack(JSCallbackManagerPtr cbm, JSContex err[0] = converter.toJSValueRef(reqid); err[1] = JSWebAPIErrorFactory::makeErrorObject(globalContext, - JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, errorMsg); + JSWebAPIErrorFactory::SECURITY_ERROR, errorMsg); break; case ExceptionCodes::UnsupportedException: diff --git a/src/Filesystem/JSFile.cpp b/src/Filesystem/JSFile.cpp index b083d25..b669a6c 100644 --- a/src/Filesystem/JSFile.cpp +++ b/src/Filesystem/JSFile.cpp @@ -539,7 +539,7 @@ JSValueRef JSFile::openStream(JSContextRef context, } if ((AM_READ != mode) && (PERM_READ == privateObject->getObject()->getNode()->getPermissions())) { - return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "Permission denied error"); + return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error"); } std::string path = privateObject->getObject()->getNode()->getPath()->getFullPath(); @@ -816,7 +816,7 @@ JSValueRef JSFile::moveTo(JSContextRef context, } if ((privateObject->getObject()->getNode()->getPermissions() & PERM_WRITE) == 0) { - return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "Permission denied error"); + return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error"); } Converter converter(context); @@ -1083,7 +1083,7 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context, cbm->setObject(thisObject); if ((privateObject->getObject()->getNode()->getPermissions() & PERM_WRITE) == 0) { - return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "Permission denied error"); + return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error"); } if (privateObject->getObject()->getNode()->getType() != NT_DIRECTORY) { @@ -1194,7 +1194,7 @@ JSValueRef JSFile::deleteFile(JSContextRef context, if ((privateObject->getObject()->getNode()->getPermissions() & PERM_WRITE) == 0) { - return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "Permission denied error"); + return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error"); } JSValueRef onSuccess = NULL; diff --git a/src/Filesystem/JSFilesystemManager.cpp b/src/Filesystem/JSFilesystemManager.cpp index 80ed8d9..47d6182 100644 --- a/src/Filesystem/JSFilesystemManager.cpp +++ b/src/Filesystem/JSFilesystemManager.cpp @@ -557,7 +557,7 @@ JSValueRef JSFilesystemManager::resolve(JSContextRef context, } if (permissions & PERM_WRITE && virtualPath == "wgt-package") { - return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "permission denied"); + return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::SECURITY_ERROR, "permission denied"); } PermissionsAccessInfo perms(permissions, virtualPath); diff --git a/src/Filesystem/ResponseDispatcher.cpp b/src/Filesystem/ResponseDispatcher.cpp index e41fd70..ca51a1a 100644 --- a/src/Filesystem/ResponseDispatcher.cpp +++ b/src/Filesystem/ResponseDispatcher.cpp @@ -108,7 +108,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventListNodesPtr& event) } else { JSObjectRef jsException = NULL; if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) { - jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "Permission denied error"); + jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error"); } else { jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::IO_ERROR, "IO error"); } @@ -160,7 +160,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventCopyPtr& event) } else { JSObjectRef jsException = NULL; if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) { - jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "Permission denied error"); + jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error"); } else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) { jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::NOT_FOUND_ERROR, "NotFoundError"); @@ -192,7 +192,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventMovePtr& event) } else { JSObjectRef jsException = NULL; if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) { - jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "Permission denied error"); + jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error"); } else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) { jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::NOT_FOUND_ERROR, "NotFoundError"); @@ -218,7 +218,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventRemovePtr& event) } else { JSObjectRef jsException = NULL; if (event->getExceptionCode() ==WrtDeviceApis::Commons::ExceptionCodes::SecurityException) { - jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "Permission denied error"); + jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error"); } else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) { jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::NOT_FOUND_ERROR, "NotFoundError"); @@ -266,7 +266,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventReadTextPtr& event) } else { JSObjectRef jsException = NULL; if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) { - jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "Permission denied error"); + jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error"); } else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) { jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::NOT_FOUND_ERROR, "NotFoundError"); @@ -296,7 +296,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventGetStoragePtr& event) } else { JSObjectRef jsException = NULL; if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) { - jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "Permission denied error"); + jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error"); } else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) { jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::NOT_FOUND_ERROR, "Not found error"); @@ -326,7 +326,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventListStoragesPtr& event) } else { JSObjectRef jsException = NULL; if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) { - jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "Permission denied error"); + jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error"); } else { jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::IO_ERROR, "IO error"); } diff --git a/src/SecureElement/SEUtil.cpp b/src/SecureElement/SEUtil.cpp index 0f50002..5d32bce 100644 --- a/src/SecureElement/SEUtil.cpp +++ b/src/SecureElement/SEUtil.cpp @@ -68,7 +68,7 @@ std::string SEUtil::getErrorString(const int errorCode) { case SCARD_ERROR_ILLEGAL_PARAM: return DeviceAPI::Common::JSWebAPIErrorFactory::INVALID_VALUES_ERROR; case SCARD_ERROR_SECURITY_NOT_ALLOWED: - return DeviceAPI::Common::JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR; + return DeviceAPI::Common::JSWebAPIErrorFactory::SECURITY_ERROR; case SCARD_ERROR_IO_FAILED: return DeviceAPI::Common::JSWebAPIErrorFactory::NOT_FOUND_ERROR; } diff --git a/src/SecureStorage/CMakeLists.txt b/src/SecureStorage/CMakeLists.txt deleted file mode 100644 index a329913..0000000 --- a/src/SecureStorage/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -SET(TARGET_NAME ${securestorage_target}) -SET(DESTINATION_NAME ${securestorage_dest}) - -PKG_CHECK_MODULES(platform_pkgs_securestorage REQUIRED secure-storage) - -INCLUDE_DIRECTORIES( - ${platform_pkgs_securestorage_INCLUDE_DIRS} -) - -SET(SRCS - plugin_initializer.cpp - plugin_config.cpp - SecureStorageManager.cpp - JSSecureStorageManager.cpp -) - -ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS}) - -TARGET_LINK_LIBRARIES(${TARGET_NAME} - ${LIBS_COMMON} - ${platform_pkgs_securestorage_LIBRARIES} -) - -INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_NAME}) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_NAME}) diff --git a/src/SecureStorage/JSSecureStorageManager.cpp b/src/SecureStorage/JSSecureStorageManager.cpp deleted file mode 100644 index b2a5561..0000000 --- a/src/SecureStorage/JSSecureStorageManager.cpp +++ /dev/null @@ -1,406 +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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "JSSecureStorageManager.h" -#include "plugin_config.h" - -using namespace std; -using namespace DPL; -using namespace WrtDeviceApis; -using namespace WrtDeviceApis::CommonsJavaScript; -using namespace DeviceAPI::Common; - -namespace TizenApis { -namespace Tizen1_0 { - -JSClassDefinition JSSecureStorageManager::m_classInfo = -{ - 0, - kJSClassAttributeNone, - "SecureStorageManager", - NULL, - NULL, - m_function, - initialize, - finalize, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - hasInstance, - NULL -}; - - -JSStaticFunction JSSecureStorageManager::m_function[] = -{ - { "remove", JSSecureStorageManager::remove, kJSPropertyAttributeNone }, - { "set", JSSecureStorageManager::set, kJSPropertyAttributeNone }, - { "get", JSSecureStorageManager::get, kJSPropertyAttributeNone }, - { "listKeys", JSSecureStorageManager::listKeys, kJSPropertyAttributeNone }, - { "removeAll", JSSecureStorageManager::removeAll, kJSPropertyAttributeNone }, - { 0, 0, 0 } -}; - - -const JSClassRef JSSecureStorageManager::getClassRef() -{ - if (!m_jsClassRef) { - m_jsClassRef = JSClassCreate(&m_classInfo); - } - return m_jsClassRef; -} - -const JSClassDefinition* JSSecureStorageManager::getClassInfo() -{ - return &m_classInfo; -} - -JSClassRef JSSecureStorageManager::m_jsClassRef = JSClassCreate(JSSecureStorageManager::getClassInfo()); - -void JSSecureStorageManager::initialize(JSContextRef context, JSObjectRef object) -{ - LoggerD("JSSecureStorageManager::initialize "); - JSSecureStorageManagerPriv* priv = static_cast(JSObjectGetPrivate(object)); - - if (priv == NULL) - { - SecureStorageManagerPtr secureStorage(new SecureStorageManager()); - priv = new JSSecureStorageManagerPriv( context, secureStorage); - if(!JSObjectSetPrivate(object, static_cast(priv))) - { - LoggerE("Object can't store private data."); - delete priv; - } - } - else - { - LoggerD("JSSecureStorageManager::already exist "); - } -} - -void JSSecureStorageManager::finalize(JSObjectRef object) -{ - JSSecureStorageManagerPriv* priv = static_cast(JSObjectGetPrivate(object)); - - LoggerD("JSSecureStorageManager::Finalrize"); - - if (priv != NULL) - { - JSObjectSetPrivate(object, NULL); - delete priv; - } -} - -bool JSSecureStorageManager::hasInstance(JSContextRef context, JSObjectRef constructor, - JSValueRef possibleInstance, JSValueRef* exception) -{ - return JSValueIsObjectOfClass(context, possibleInstance, getClassRef()); -} - - -JSValueRef JSSecureStorageManager::listKeys(JSContextRef context, JSObjectRef object, - JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], - JSValueRef* exception) -{ - JSSecureStorageManagerPriv* priv = static_cast(JSObjectGetPrivate(thisObject)); - - try - { - if (priv == NULL) - { - LoggerE("priv null"); - Throw(WrtDeviceApis::Commons::ConversionException); - } - - - // to do : need to update TizenPolicy.xml - // AceSecurityStatus status = SECURE_STORAGE_CHECK_ACCESS(SECURE_STORAGE_FUNC_READ); - // TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); - - SecureStorageManagerPtr secureStorage(priv->getObject()); - Converter converter(priv->getContext()); - std::vector keys = secureStorage->listKeys(); - return converter.toJSValueRef(keys); - } - catch (const WrtDeviceApis::Commons::Exception& ex) - { - LoggerD("Error message" << ex.GetMessage()); - switch(ex.getCode()) - { - case WrtDeviceApis::Commons::ExceptionCodes::NotFoundException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::NOT_FOUND_ERROR, "not found error"); - case WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "invalid parameter error"); - case WrtDeviceApis::Commons::ExceptionCodes::ConversionException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "type mismatch error"); - case WrtDeviceApis::Commons::ExceptionCodes::SecurityException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "permission denied error"); - case WrtDeviceApis::Commons::ExceptionCodes::Exception: - default: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unkown error"); - } - } - return JSValueMakeUndefined(context); - -} - - -JSValueRef JSSecureStorageManager::set(JSContextRef context, JSObjectRef object, - JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], - JSValueRef* exception) -{ - JSSecureStorageManagerPriv* priv = static_cast(JSObjectGetPrivate(thisObject)); - JSValueRef reserveArguments[2]; - size_t index = 0; - - - try - { - if (priv == NULL) - { - LoggerE("priv null"); - - Throw(WrtDeviceApis::Commons::ConversionException); - } - - // to do : need to update TizenPolicy.xml - // AceSecurityStatus status = SECURE_STORAGE_CHECK_ACCESS(SECURE_STORAGE_FUNC_WRITE); - // TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); - - - for (index = 0; index < 2; index++) - { - if (index < argumentCount) - reserveArguments[index] = arguments[index]; - else - reserveArguments[index] = JSValueMakeUndefined(context); - } - - SecureStorageManagerPtr secureStorage(priv->getObject()); - Converter converter(priv->getContext()); - std::string key = converter.toString(reserveArguments[0]); - std::string value = converter.toString(reserveArguments[1]); - secureStorage->set(key, value); - - } - catch (const WrtDeviceApis::Commons::Exception& ex) - { - LoggerD("Error message" << ex.GetMessage()); - switch(ex.getCode()) - { - case WrtDeviceApis::Commons::ExceptionCodes::NotFoundException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::NOT_FOUND_ERROR, "not found error"); - case WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "invalid parameter error"); - case WrtDeviceApis::Commons::ExceptionCodes::ConversionException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "type mismatch error"); - case WrtDeviceApis::Commons::ExceptionCodes::SecurityException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "permission denied error"); - case WrtDeviceApis::Commons::ExceptionCodes::Exception: - default: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unkown error"); - } - } - return JSValueMakeUndefined(context); -} - -JSValueRef JSSecureStorageManager::get(JSContextRef context, JSObjectRef object, - JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], - JSValueRef* exception) -{ - JSSecureStorageManagerPriv* priv = static_cast(JSObjectGetPrivate(thisObject)); - JSValueRef reserveArguments; - - try - { - if (priv == NULL) - { - LoggerE("priv null"); - Throw(WrtDeviceApis::Commons::ConversionException); - } - - // to do : need to update TizenPolicy.xml - // AceSecurityStatus status = SECURE_STORAGE_CHECK_ACCESS(SECURE_STORAGE_FUNC_READ); - // TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); - - if (argumentCount > 0) - reserveArguments = arguments[0]; - else - reserveArguments = JSValueMakeUndefined(context); - - SecureStorageManagerPtr secureStorage(priv->getObject()); - Converter converter(priv->getContext()); - std::string key = converter.toString(reserveArguments); - std::string value = secureStorage->get(key); - return converter.toJSValueRef(value); - } - catch (const WrtDeviceApis::Commons::Exception& ex) - { - LoggerD("Error message" << ex.GetMessage()); - switch(ex.getCode()) - { - case WrtDeviceApis::Commons::ExceptionCodes::NotFoundException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::NOT_FOUND_ERROR, "not found error"); - case WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "invalid parameter error"); - case WrtDeviceApis::Commons::ExceptionCodes::ConversionException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "type mismatch error"); - case WrtDeviceApis::Commons::ExceptionCodes::SecurityException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "permission denied error"); - case WrtDeviceApis::Commons::ExceptionCodes::Exception: - default: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unkown error"); - } - } - return JSValueMakeUndefined(context); - -} - -JSValueRef JSSecureStorageManager::remove(JSContextRef context, JSObjectRef object, - JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], - JSValueRef* exception) -{ - JSSecureStorageManagerPriv* priv = static_cast(JSObjectGetPrivate(thisObject)); - JSValueRef reserveArguments; - - try - { - if (priv == NULL) - { - LoggerE("priv null"); - Throw(WrtDeviceApis::Commons::ConversionException); - } - - // to do : need to update TizenPolicy.xml - // AceSecurityStatus status = SECURE_STORAGE_CHECK_ACCESS(SECURE_STORAGE_FUNC_WRITE); - // TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); - - if (argumentCount > 0) - reserveArguments = arguments[0]; - else - reserveArguments = JSValueMakeUndefined(context); - - SecureStorageManagerPtr secureStorage(priv->getObject()); - Converter converter(priv->getContext()); - std::string key = converter.toString(reserveArguments); - secureStorage->remove(key); - } - catch (const WrtDeviceApis::Commons::Exception& ex) - { - LoggerD("Error message" << ex.GetMessage()); - switch(ex.getCode()) - { - case WrtDeviceApis::Commons::ExceptionCodes::NotFoundException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::NOT_FOUND_ERROR, "not found error"); - case WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "invalid parameter error"); - case WrtDeviceApis::Commons::ExceptionCodes::ConversionException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "type mismatch error"); - case WrtDeviceApis::Commons::ExceptionCodes::SecurityException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "permission denied error"); - case WrtDeviceApis::Commons::ExceptionCodes::Exception: - default: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unkown error"); - } - } - return JSValueMakeUndefined(context); - -} - -JSValueRef JSSecureStorageManager::removeAll(JSContextRef context, JSObjectRef object, - JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], - JSValueRef* exception) -{ - JSSecureStorageManagerPriv* priv = static_cast(JSObjectGetPrivate(thisObject)); - - try - { - if (priv == NULL) - { - LoggerE("priv null"); - Throw(WrtDeviceApis::Commons::ConversionException); - } - - // to do : need to update TizenPolicy.xml - // AceSecurityStatus status = SECURE_STORAGE_CHECK_ACCESS(SECURE_STORAGE_FUNC_WRITE); - // TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); - - SecureStorageManagerPtr secureStorage(priv->getObject()); - Converter converter(priv->getContext()); - secureStorage->removeAll(); - - } - catch (const WrtDeviceApis::Commons::Exception& ex) - { - LoggerD("Error message" << ex.GetMessage()); - switch(ex.getCode()) - { - case WrtDeviceApis::Commons::ExceptionCodes::NotFoundException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::NOT_FOUND_ERROR, "not found error"); - case WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "invalid parameter error"); - case WrtDeviceApis::Commons::ExceptionCodes::ConversionException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "type mismatch error"); - case WrtDeviceApis::Commons::ExceptionCodes::SecurityException: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::PERMISSION_DENIED_ERROR, "permission denied error"); - case WrtDeviceApis::Commons::ExceptionCodes::Exception: - default: - return JSWebAPIErrorFactory::postException(context, exception, - JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unkown error"); - } - } - return JSValueMakeUndefined(context); - -} - -} -} - diff --git a/src/SecureStorage/JSSecureStorageManager.h b/src/SecureStorage/JSSecureStorageManager.h deleted file mode 100644 index b0ba72a..0000000 --- a/src/SecureStorage/JSSecureStorageManager.h +++ /dev/null @@ -1,71 +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. - */ - - -#ifndef TIZENAPIS_TIZEN_JS_SECURE_STORAGE_MANAGER_H_ -#define TIZENAPIS_TIZEN_JS_SECURE_STORAGE_MANAGER_H_ - -#include -#include "SecureStorageManager.h" -#include - -using namespace WrtDeviceApis::CommonsJavaScript; -using namespace WrtDeviceApis; -using namespace WrtDeviceApis::Commons; - - -namespace TizenApis { -namespace Tizen1_0 { - - -typedef PrivateObjectT::Type JSSecureStorageManagerPriv; - -class JSSecureStorageManager { -public: - static const JSClassDefinition* getClassInfo(); - static const JSClassRef getClassRef(); -private: - static void initialize(JSContextRef context, JSObjectRef object); - static void finalize(JSObjectRef object); - static bool hasInstance(JSContextRef context, JSObjectRef constructor, - JSValueRef possibleInstance, JSValueRef* exception); - - static JSValueRef listKeys(JSContextRef context, JSObjectRef object, - JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], - JSValueRef* exception); - static JSValueRef set(JSContextRef context, JSObjectRef object, - JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], - JSValueRef* exception); - static JSValueRef get(JSContextRef context, JSObjectRef object, - JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], - JSValueRef* exception); - static JSValueRef remove(JSContextRef context, JSObjectRef object, - JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], - JSValueRef* exception); - static JSValueRef removeAll(JSContextRef context, JSObjectRef object, - JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], - JSValueRef* exception); - - static JSClassDefinition m_classInfo; - static JSStaticFunction m_function[]; - static JSClassRef m_jsClassRef; -}; - -} -} - -#endif - diff --git a/src/SecureStorage/SecureStorageManager.cpp b/src/SecureStorage/SecureStorageManager.cpp deleted file mode 100644 index 842b93d..0000000 --- a/src/SecureStorage/SecureStorageManager.cpp +++ /dev/null @@ -1,265 +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. - */ - -#include "SecureStorageManager.h" -#include -#include -#include -#include -#include -#include - -using namespace DPL; -using namespace WrtDeviceApis::Commons; - -namespace TizenApis { -namespace Tizen1_0{ - -std::string SecureStorageManager::m_filePath = "securedata.txt"; -int SecureStorageManager::m_maxLength = 256; - -SecureStorageManager::SecureStorageManager() -{ - LoggerD("OK"); - - try - { - loadSecurePairData(); - } - catch (const WrtDeviceApis::Commons::Exception& ex) - { - LoggerE("Exception: " << ex.GetMessage()); - LoggerD("there is no file"); - } - - LoggerD("initial map size : " << m_securePairData.size()); -} - -SecureStorageManager::~SecureStorageManager() -{ - LoggerD("OK"); -} - -std::string SecureStorageManager::get(std::string key) -{ - LoggerD("OK"); - - std::map::iterator it = m_securePairData.find(key); - - if (it == m_securePairData.end()) - { - ThrowMsg(WrtDeviceApis::Commons::NotFoundException, "not found key"); - } - - return m_securePairData[key]; -} - -std::vector SecureStorageManager::listKeys() -{ - std::vector vector; - std::map::iterator it; - - LoggerD("OK"); - - for (it = m_securePairData.begin(); it != m_securePairData.end(); ++it) - { - vector.push_back((*it).first); - } - - return vector; -} -void SecureStorageManager::set(std::string key, std::string value) -{ - m_securePairData[key] = value; - - LoggerD("Save current data"); - saveSecurePairData(); -} - -void SecureStorageManager::remove(std::string key) -{ - LoggerD("OK"); - - std::map::iterator it = m_securePairData.find(key); - - if (it == m_securePairData.end()) - { - ThrowMsg(WrtDeviceApis::Commons::NotFoundException, "not found key"); - } - m_securePairData.erase(it); - LoggerD("Save current data"); - saveSecurePairData(); -} - -void SecureStorageManager::removeAll() -{ - LoggerD("OK"); - - ssm_flag flag = SSM_FLAG_SECRET_OPERATION; - - m_securePairData.clear(); - ssm_delete_file(m_filePath.c_str(), flag, NULL); -} - -void SecureStorageManager::saveSecurePairData() -{ - LoggerD("OK"); - - std::map::iterator it; - size_t dataSize = 0; - size_t index = 0; - size_t num = 0; - size_t mapSize = m_securePairData.size(); - int ret = -1; - - for (it = m_securePairData.begin(); it != m_securePairData.end(); ++it) - { - dataSize += (*it).first.size(); - dataSize += (*it).second.size(); - } - - dataSize += sizeof(size_t) * 2 * m_securePairData.size(); - dataSize += sizeof(size_t) * 2; - - DPL::ScopedArray saveBuf(new char[dataSize]); - - memcpy(&saveBuf[index], (char*)&mapSize, sizeof(size_t)); - index += sizeof(size_t); - - memcpy(&saveBuf[index], (char*)&dataSize, sizeof(size_t)); - index += sizeof(size_t); - - for (it = m_securePairData.begin(); it != m_securePairData.end(); ++it) - { - num = (*it).first.size(); - memcpy(&saveBuf[index], (char*)&num, sizeof(size_t)); - index += sizeof(size_t); - - memcpy(&saveBuf[index], (char*)(*it).first.c_str(), (*it).first.size()); - index += (*it).first.size(); - - num = (*it).second.size(); - memcpy(&saveBuf[index], (char*)&num, sizeof(size_t)); - index += sizeof(size_t); - memcpy(&saveBuf[index], (char*)(*it).second.c_str(), (*it).second.size()); - index += (*it).second.size(); - } - - ssm_flag flag = SSM_FLAG_SECRET_OPERATION; - - ret = ssm_write_buffer(saveBuf.Get(), dataSize, m_filePath.c_str(), flag, NULL); - - if (ret < 0) - { - ThrowMsg(WrtDeviceApis::Commons::PlatformException, "ssm write buf error"); - } - LoggerD("save result : " << ret); -} - -std::string SecureStorageManager::readStringFromMemory(const char *saveBuf, size_t ¤t, size_t dataSize) -{ - std::string value = ""; - size_t num = 0; - char tempbuf[m_maxLength]; - - if (current + sizeof(size_t) > dataSize) - { - ThrowMsg(WrtDeviceApis::Commons::PlatformException, "get size error "); - } - - memcpy(&num, &saveBuf[current], sizeof(size_t)); - memset(tempbuf, 0, sizeof(tempbuf)); - current += sizeof(size_t); - - if (current + num > dataSize) - { - ThrowMsg(WrtDeviceApis::Commons::PlatformException, "get size error "); - } - - memcpy(tempbuf, &saveBuf[current], num); - current += num; - value = tempbuf; - - return value; -} - - -void SecureStorageManager::loadSecurePairData() -{ - LoggerD("OK"); - - int ret = -1; - size_t num = 0; - size_t dataSize = 0; - size_t i = 0; - size_t readlen = 0; - char* retbuf = NULL; - ssm_file_info_t sfi; - ssm_flag flag = SSM_FLAG_SECRET_OPERATION; - size_t index = 0; - - m_securePairData.clear(); - ret = ssm_getinfo(m_filePath.c_str(), &sfi, flag, NULL); - - if (ret < 0) - { - ThrowMsg(WrtDeviceApis::Commons::PlatformException, "get info error"); - } - - if (sfi.originSize == 0) - { - ThrowMsg(WrtDeviceApis::Commons::PlatformException, "originSize error"); - } - - DPL::ScopedArray saveBuf(new char[sfi.originSize]); - retbuf = saveBuf.Get(); - - memset(retbuf, 0x00, sizeof(char) * sfi.originSize); - ret = ssm_read(m_filePath.c_str(), retbuf, sfi.originSize, &readlen, flag, NULL); - - if (ret < 0) - { - ThrowMsg(WrtDeviceApis::Commons::PlatformException, "read buf error"); - } - - LoggerD("read result : " << ret << ", length:" << readlen); - - memcpy(&num, &saveBuf[index], sizeof(size_t)); - index += sizeof(size_t); - - memcpy(&dataSize, &saveBuf[index], sizeof(size_t)); - index += sizeof(size_t); - - LoggerD("dataSize" << dataSize << "-" << num); - - for (i = 0; i < num; i++) - { - std::string key = readStringFromMemory(retbuf, index, dataSize); - std::string value = readStringFromMemory(retbuf, index, dataSize); - - if (key.size() == 0 || value.size() == 0) - { - ThrowMsg(WrtDeviceApis::Commons::PlatformException, "read buf error"); - } - m_securePairData[key] = value; - LoggerD("contents:" << key << "-" << m_securePairData[key]); - } -} - - -} -} - diff --git a/src/SecureStorage/SecureStorageManager.h b/src/SecureStorage/SecureStorageManager.h deleted file mode 100644 index bb37aab..0000000 --- a/src/SecureStorage/SecureStorageManager.h +++ /dev/null @@ -1,53 +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. - */ - - -#ifndef TIZENAPIS_TIZEN_SECURE_STORAGE_MANAGER_H_ -#define TIZENAPIS_TIZEN_SECURE_STORAGE_MANAGER_H_ - -#include -#include -#include -#include - -namespace TizenApis { -namespace Tizen1_0 { - -class SecureStorageManager; -typedef DPL::SharedPtr SecureStorageManagerPtr; - - -class SecureStorageManager -{ -public: - std::string get(std::string key); - std::vector listKeys(); - void set(std::string key, std::string value); - void remove(std::string key); - void removeAll(); - SecureStorageManager(); - ~SecureStorageManager(); -private: - static std::string m_filePath; - static int m_maxLength; - std::map m_securePairData; - void saveSecurePairData(); - void loadSecurePairData(); - std::string readStringFromMemory(const char *saveBuf, size_t ¤t, size_t dataSize); -}; -} -} -#endif diff --git a/src/SecureStorage/config.xml b/src/SecureStorage/config.xml deleted file mode 100644 index b8835e9..0000000 --- a/src/SecureStorage/config.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - libwrt-plugins-tizen-securestorage.so - securestorage.install.uri - SAMSUNG plugin group - SAMSUNG certificate authority - AAAABBBBCCCCDDDEEEE0000 - - http://tizen.org/privilege/securestorage.read - securestorage.read - - - http://tizen.org/privilege/securestorage.write - securestorage.write - - - diff --git a/src/SecureStorage/plugin_config.cpp b/src/SecureStorage/plugin_config.cpp deleted file mode 100644 index 3265456..0000000 --- a/src/SecureStorage/plugin_config.cpp +++ /dev/null @@ -1,127 +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. - */ - - -#include -#include -#include -#include -#include -#include "plugin_config.h" - -#define SECURE_STORAGE_FEATURE_API_READ "http://tizen.org/privilege/securestorage.read" -#define SECURE_STORAGE_FEATURE_API_WRITE "http://tizen.org/privilege/securestorage.write" - -#define SECURE_STORAGE_DEVICE_CAP_READ "securestorage.read" -#define SECURE_STORAGE_DEVICE_CAP_WRITE "securestorage.write" - -namespace TizenApis { -namespace Tizen1_0 { - -const char* SECURE_STORAGE_FUNC_READ = "SecureStroageReadFunc"; -const char* SECURE_STORAGE_FUNC_WRITE = "SecureStroageWriteFunc"; -const char* SECURE_STORAGE_FUNC_READWRITE = "SecureStroageReadWriteFunc"; - -static WrtDeviceApis::Commons::FunctionMapping createSecureStorageFunctions(); - -static WrtDeviceApis::Commons::FunctionMapping SecureStorageFunctions = - createSecureStorageFunctions(); - -#pragma GCC visibility push(default) - -DEFINE_FUNCTION_GETTER(SecureStorage, SecureStorageFunctions); - -#pragma GCC visibility pop - -static WrtDeviceApis::Commons::FunctionMapping createSecureStorageFunctions() -{ - using namespace WrtDeviceApis::Commons; - - ACE_CREATE_DEVICE_CAP(DEVICE_CAP_SECURE_STORAGE_READ, SECURE_STORAGE_DEVICE_CAP_READ); - ACE_CREATE_DEVICE_CAP(DEVICE_CAP_SECURE_STORAGE_WRITE, SECURE_STORAGE_DEVICE_CAP_WRITE); - - - ACE_CREATE_DEVICE_CAPS_LIST(EMPTY_DEVICE_LIST); - - ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_SECURE_STORAGE_READ); - ACE_ADD_DEVICE_CAP(DEVICE_LIST_SECURE_STORAGE_READ, DEVICE_CAP_SECURE_STORAGE_READ); - - ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_SECURE_STORAGE_WRITE); - ACE_ADD_DEVICE_CAP(DEVICE_LIST_SECURE_STORAGE_WRITE, DEVICE_CAP_SECURE_STORAGE_WRITE); - - - ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_SECURE_STORAGE_READWRITE); - ACE_ADD_DEVICE_CAP(DEVICE_LIST_SECURE_STORAGE_READWRITE, DEVICE_CAP_SECURE_STORAGE_READ); - ACE_ADD_DEVICE_CAP(DEVICE_LIST_SECURE_STORAGE_READWRITE, DEVICE_CAP_SECURE_STORAGE_WRITE); - - - ACE_CREATE_FEATURE(FEATURE_READ, SECURE_STORAGE_FEATURE_API_READ); - ACE_CREATE_FEATURE(FEATURE_WRITE, SECURE_STORAGE_FEATURE_API_WRITE); - - ACE_CREATE_FEATURE_LIST(SECURE_STORAGE_FEATURES_SECURE_READWRITE); - ACE_ADD_API_FEATURE(SECURE_STORAGE_FEATURES_SECURE_READWRITE, FEATURE_READ); - ACE_ADD_API_FEATURE(SECURE_STORAGE_FEATURES_SECURE_READWRITE, FEATURE_WRITE); - - ACE_CREATE_FEATURE_LIST(SECURE_STORAGE_FEATURES_READ); - ACE_ADD_API_FEATURE(SECURE_STORAGE_FEATURES_READ, FEATURE_READ); - - ACE_CREATE_FEATURE_LIST(SECURE_STORAGE_FEATURES_WRITE); - ACE_ADD_API_FEATURE(SECURE_STORAGE_FEATURES_WRITE, FEATURE_WRITE); - - - FunctionMapping SecureStorageFunctions; - - AceFunction secureStorageRead = ACE_CREATE_FUNCTION( - FUNCTION_SECURE_STORAGE_READ_FUNCTIONS, - SECURE_STORAGE_FUNC_READ, - SECURE_STORAGE_FEATURES_READ, - DEVICE_LIST_SECURE_STORAGE_READ); - - SecureStorageFunctions.insert(std::make_pair( - SECURE_STORAGE_FUNC_READ, - secureStorageRead)); - - AceFunction secureStorageWrite = ACE_CREATE_FUNCTION( - FUNCTION_SECURE_STORAGE_WRITE_FUNCTIONS, - SECURE_STORAGE_FUNC_WRITE, - SECURE_STORAGE_FEATURES_WRITE, - DEVICE_LIST_SECURE_STORAGE_WRITE); - - SecureStorageFunctions.insert(std::make_pair( - SECURE_STORAGE_FUNC_WRITE, - secureStorageWrite)); - - AceFunction secureStorageReadWrite = ACE_CREATE_FUNCTION( - FUNCTION_SECURE_STORAGE_READWRITE_FUNCTIONS, - SECURE_STORAGE_FUNC_READWRITE, - SECURE_STORAGE_FEATURES_SECURE_READWRITE, - DEVICE_LIST_SECURE_STORAGE_READWRITE); - - SecureStorageFunctions.insert(std::make_pair( - SECURE_STORAGE_FUNC_READWRITE, - secureStorageReadWrite)); - - return SecureStorageFunctions; -} -} -} - -#undef SECURE_STORAGE_FEATURE_API -#undef SECURE_STORAGE_FEATURE_API_WRITE -#undef SECURE_STORAGE_FEATURE_API_READ -#undef SECURE_STORAGE_DEVICE_CAP_WRITE -#undef SECURE_STORAGE_DEVICE_CAP_READ - diff --git a/src/SecureStorage/plugin_config.h b/src/SecureStorage/plugin_config.h deleted file mode 100644 index 572b634..0000000 --- a/src/SecureStorage/plugin_config.h +++ /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. - */ - -#ifndef TIZENAPIS_TIZEN_JS_SECURE_STORAGE_PLUGIN_CONFIG_H_ -#define TIZENAPIS_TIZEN_JS_SECURE_STORAGE_PLUGIN_CONFIG_H_ - -#include - -namespace TizenApis { -namespace Tizen1_0 { - -extern const char* SECURE_STORAGE_FUNC_READ; -extern const char* SECURE_STORAGE_FUNC_WRITE; - - -WrtDeviceApis::Commons::AceFunction getSecureStorageFunctionData(const std::string & functionId); - -#define SECURE_STORAGE_CHECK_ACCESS(functionName) \ - aceCheckAccess >( \ - getSecureStorageFunctionData, \ - functionName) -} -} - -#endif diff --git a/src/SecureStorage/plugin_initializer.cpp b/src/SecureStorage/plugin_initializer.cpp deleted file mode 100644 index d1e1c6a..0000000 --- a/src/SecureStorage/plugin_initializer.cpp +++ /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. - */ - -#include -#include -#include "JSSecureStorageManager.h" -#include - -using namespace WrtDeviceApis; -using namespace WrtDeviceApis::Commons; - -void on_widget_start_callback(int widgetId) -{ - LoggerD("[Tizen\\Bluetooth ] on_widget_start_callback ("<