FIDO UAF ASM Framework initial version 23/105123/2 accepted/tizen/common/20170207.061922 accepted/tizen/mobile/20170207.092050 accepted/tizen/wearable/20170207.092103 submit/tizen/20170202.133813 submit/tizen/20170207.023724
authorManasij Sur Roy <manasij.r@samsung.com>
Thu, 15 Dec 2016 12:21:54 +0000 (17:51 +0530)
committerManasij Sur Roy <manasij.r@samsung.com>
Wed, 1 Feb 2017 08:35:59 +0000 (14:05 +0530)
- Authenticator Specific Module (ASM) acts as abstraction layer on top of Authenticator(s).
- Tizen FIDO UAF ASM supports various types of FIDO Authenticators via plugin architecture.
- Both Bound and Roaming types supported.
- BT and IoTivity connectivity supported.
- Only First Factor support is provided.
- Applications can not directly call ASM, instead they need to use fido-client APIs.
- Includes a test authenticator : To interact with FIDO server, the product must have commercial authenticator(s).
(Test Authenticator certificates are just self signed dummy, so it will fail if used with commercial FIDO server)

Change-Id: If654570eeaad6072e9f87220c25627fefe5b3335
Signed-off-by: Manasij Sur Roy <manasij.r@samsung.com>
313 files changed:
.gitignore [new file with mode: 0644]
CMakeLists.txt [new file with mode: 0644]
Instructions.txt [new file with mode: 0644]
LICENSE.APLv2 [new file with mode: 0644]
NOTICE [new file with mode: 0644]
ble_roaming_agent/CMakeLists.txt [new file with mode: 0644]
ble_roaming_agent/inc/BTRoamingKeys.h [new file with mode: 0644]
ble_roaming_agent/src/bt_ragent_main.c [new file with mode: 0644]
ble_roaming_agent/src/fido_gatt_server.c [new file with mode: 0644]
ble_roaming_agent/src/fido_gatt_server.h [new file with mode: 0644]
bt_roaming_agent/CMakeLists.txt [new file with mode: 0644]
bt_roaming_agent/inc/BTRoamingKeys.h [new file with mode: 0644]
bt_roaming_agent/inc/bt_server.h [new file with mode: 0644]
bt_roaming_agent/src/bt_ragent_main.c [new file with mode: 0644]
bt_roaming_agent/src/bt_server.c [new file with mode: 0644]
common/AsmHelper.h [new file with mode: 0644]
common/cryptoutil/inc/asmcrypto.h [new file with mode: 0644]
common/cryptoutil/src/AsmCrypto.cpp [new file with mode: 0644]
common/datatypes/auth/AuthnrTypes.h [new file with mode: 0644]
common/datatypes/inc/AsmAuthRequest.h [new file with mode: 0644]
common/datatypes/inc/AsmAuthResponse.h [new file with mode: 0644]
common/datatypes/inc/AsmDeregRequest.h [new file with mode: 0644]
common/datatypes/inc/AsmDeregResponse.h [new file with mode: 0644]
common/datatypes/inc/AsmGetInfoRequest.h [new file with mode: 0644]
common/datatypes/inc/AsmGetRegsRequest.h [new file with mode: 0644]
common/datatypes/inc/AsmGetRegsResponse.h [new file with mode: 0644]
common/datatypes/inc/AsmOpenSettingsRequest.h [new file with mode: 0644]
common/datatypes/inc/AsmOpenSettingsResponse.h [new file with mode: 0644]
common/datatypes/inc/AsmRegRequest.h [new file with mode: 0644]
common/datatypes/inc/AsmRegResponse.h [new file with mode: 0644]
common/datatypes/inc/AsmRequest.h [new file with mode: 0644]
common/datatypes/inc/AsmResponse.h [new file with mode: 0644]
common/datatypes/inc/GetInfoResponse.h [new file with mode: 0644]
common/datatypes/src/AsmAuthRequest.cpp [new file with mode: 0644]
common/datatypes/src/AsmAuthResponse.cpp [new file with mode: 0644]
common/datatypes/src/AsmDeregRequest.cpp [new file with mode: 0644]
common/datatypes/src/AsmDeregResponse.cpp [new file with mode: 0644]
common/datatypes/src/AsmGetRegsRequest.cpp [new file with mode: 0644]
common/datatypes/src/AsmGetRegsResponse.cpp [new file with mode: 0644]
common/datatypes/src/AsmOpenSettingsRequest.cpp [new file with mode: 0644]
common/datatypes/src/AsmOpenSettingsResponse.cpp [new file with mode: 0644]
common/datatypes/src/AsmRegRequest.cpp [new file with mode: 0644]
common/datatypes/src/AsmRegResponse.cpp [new file with mode: 0644]
common/datatypes/src/AsmRequest.cpp [new file with mode: 0644]
common/datatypes/src/AsmResponse.cpp [new file with mode: 0644]
common/datatypes/src/AuthnrTypes.cpp [new file with mode: 0644]
common/dbus_interfaces/CMakeLists.txt [new file with mode: 0644]
common/dbus_interfaces/fido-asm.xml [new file with mode: 0644]
common/fido-ra-acl-server.dat [new file with mode: 0644]
common/jsonutil/inc/JsonUtil.h [new file with mode: 0644]
common/jsonutil/src/JsonUtil.cpp [new file with mode: 0644]
common/uafv1tlvutil/inc/AttBasicFullTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/AttBasicSurrTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/AuthAssertionInfoTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/AuthCountersInfoTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/BufferTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/DeRegReqTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/DeRegRespTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/GetInfoReqTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/GetInfoRespTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/ITlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/IntTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/RegAssertionInfoTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/RegAuthAssertionTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/RegCountersInfoTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/RegReqTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/RegRespTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/SignAuthAssertionTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/SignReqTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/SignRespTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/SignedDataTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/StringTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/inc/Tlv.h [new file with mode: 0644]
common/uafv1tlvutil/inc/TlvData.h [new file with mode: 0644]
common/uafv1tlvutil/inc/Uafv1KrdTlvEncoder.h [new file with mode: 0644]
common/uafv1tlvutil/src/AttBasicFullTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/AttBasicSurrTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/AuthAssertionInfoTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/AuthCountersInfoTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/BufferTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/DeRegReqTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/DeRegRespTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/GetInfoReqTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/GetInfoRespTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/IntTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/RegAssertionInfoTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/RegAuthAssertionTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/RegCountersInfoTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/RegReqTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/RegRespTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/SignAuthAssertionTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/SignReqTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/SignRespTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/SignedDataTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/StringTlvEncoder.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/Tlv.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/TlvEncoderFactory.cpp [new file with mode: 0644]
common/uafv1tlvutil/src/Uafv1KrdTlvEncoder.cpp [new file with mode: 0644]
common/uiutil/inc/AcUiAdaptor.h [new file with mode: 0644]
common/uiutil/inc/AsmUiCommonTypes.h [new file with mode: 0644]
common/uiutil/inc/AuthUiFactory.h [new file with mode: 0644]
common/uiutil/inc/IAuthUiAdaptor.h [new file with mode: 0644]
common/uiutil/inc/PinAuthUiAdaptor.h [new file with mode: 0644]
common/uiutil/inc/TCUiAdaptor.h [new file with mode: 0644]
common/uiutil/src/AcUiAdaptor.cpp [new file with mode: 0644]
common/uiutil/src/AuthUiFactory.cpp [new file with mode: 0644]
common/uiutil/src/PinAuthUiAdaptor.cpp [new file with mode: 0644]
common/uiutil/src/TCUiAdaptor.cpp [new file with mode: 0644]
fido-asm.manifest [new file with mode: 0644]
fido-ble-ragent.manifest [new file with mode: 0644]
fido-bt-ragent.manifest [new file with mode: 0644]
fido-roaming-agent.manifest [new file with mode: 0644]
fido_tizen_auth.der [new file with mode: 0644]
fido_tizen_auth.key [new file with mode: 0644]
fido_tizen_auth_b64.txt [new file with mode: 0644]
org.tizen.asmui.manifest [new file with mode: 0644]
packaging/fido-asm.service [new file with mode: 0644]
packaging/fido-asm.spec [new file with mode: 0644]
packaging/fido-ble-roaming-agent.service [new file with mode: 0644]
packaging/fido-bt-roaming-agent.service [new file with mode: 0644]
packaging/fido-roaming-agent.service [new file with mode: 0644]
packaging/org.tizen.fido-asm.conf [new file with mode: 0644]
packaging/org.tizen.fido-asm.service [new file with mode: 0644]
roaming_agent/CMakeLists.txt [new file with mode: 0644]
roaming_agent/inc/RoamingKeys.h [new file with mode: 0644]
roaming_agent/src/iotcon_handler.c [new file with mode: 0644]
roaming_agent/src/iotcon_handler.h [new file with mode: 0644]
roaming_agent/src/ragent_main.c [new file with mode: 0644]
server/CMakeLists.txt [new file with mode: 0644]
server/auth_discovery/inc/AuthIndexHanlder.h [new file with mode: 0644]
server/auth_discovery/inc/AuthManager.h [new file with mode: 0644]
server/auth_discovery/inc/BAuthStub.h [new file with mode: 0644]
server/auth_discovery/inc/BleAdProvider.h [new file with mode: 0644]
server/auth_discovery/inc/BleCon.h [new file with mode: 0644]
server/auth_discovery/inc/BoundADProvider.h [new file with mode: 0644]
server/auth_discovery/inc/BtAdProvider.h [new file with mode: 0644]
server/auth_discovery/inc/BtCon.h [new file with mode: 0644]
server/auth_discovery/inc/IADProvider.h [new file with mode: 0644]
server/auth_discovery/inc/IAuthConnection.h [new file with mode: 0644]
server/auth_discovery/inc/IAuthStub.h [new file with mode: 0644]
server/auth_discovery/inc/IoTCon.h [new file with mode: 0644]
server/auth_discovery/inc/IotADProvider.h [new file with mode: 0644]
server/auth_discovery/inc/LocalCon.h [new file with mode: 0644]
server/auth_discovery/inc/RAuthStub.h [new file with mode: 0644]
server/auth_discovery/inc/RoamingUtil.h [new file with mode: 0644]
server/auth_discovery/src/AuthIndexHanlder.cpp [new file with mode: 0644]
server/auth_discovery/src/AuthManager.cpp [new file with mode: 0644]
server/auth_discovery/src/BAuthStub.cpp [new file with mode: 0644]
server/auth_discovery/src/BleAdProvider.cpp [new file with mode: 0644]
server/auth_discovery/src/BleCon.cpp [new file with mode: 0644]
server/auth_discovery/src/BoundADProvider.cpp [new file with mode: 0644]
server/auth_discovery/src/BtADProvider.cpp [new file with mode: 0644]
server/auth_discovery/src/BtCon.cpp [new file with mode: 0644]
server/auth_discovery/src/IoTCon.cpp [new file with mode: 0644]
server/auth_discovery/src/IotADProvider.cpp [new file with mode: 0644]
server/auth_discovery/src/RAuthStub.cpp [new file with mode: 0644]
server/auth_discovery/src/RoamingUtil.cpp [new file with mode: 0644]
server/fido_asm.json [new file with mode: 0644]
server/inc/AsmStorage.h [new file with mode: 0644]
server/inc/ClientListener.h [new file with mode: 0644]
server/ops/inc/AsmOp.h [new file with mode: 0644]
server/ops/inc/AsmOpFactory.h [new file with mode: 0644]
server/ops/inc/AuthenticateOp.h [new file with mode: 0644]
server/ops/inc/DeregOp.h [new file with mode: 0644]
server/ops/inc/GetInfoOp.h [new file with mode: 0644]
server/ops/inc/GetRegsOp.h [new file with mode: 0644]
server/ops/inc/OpenSettingOp.h [new file with mode: 0644]
server/ops/inc/RegisterOp.h [new file with mode: 0644]
server/ops/src/AsmOp.cpp [new file with mode: 0644]
server/ops/src/AsmOpFactory.cpp [new file with mode: 0644]
server/ops/src/AuthenticateOp.cpp [new file with mode: 0644]
server/ops/src/DeregOp.cpp [new file with mode: 0644]
server/ops/src/GetInfoOp.cpp [new file with mode: 0644]
server/ops/src/GetRegsOp.cpp [new file with mode: 0644]
server/ops/src/OpenSettingOp.cpp [new file with mode: 0644]
server/ops/src/RegisterOp.cpp [new file with mode: 0644]
server/src/AsmStorage.cpp [new file with mode: 0644]
server/src/ClientListener.cpp [new file with mode: 0644]
server/src/asm_main.cpp [new file with mode: 0644]
server/states/inc/AuthenticateState.h [new file with mode: 0644]
server/states/inc/DeregState.h [new file with mode: 0644]
server/states/inc/EnrollState.h [new file with mode: 0644]
server/states/inc/GetRegsState.h [new file with mode: 0644]
server/states/inc/IAsmOpState.h [new file with mode: 0644]
server/states/inc/InitState.h [new file with mode: 0644]
server/states/inc/RegisterState.h [new file with mode: 0644]
server/states/inc/TCState.h [new file with mode: 0644]
server/states/inc/VerifyState.h [new file with mode: 0644]
server/states/src/AuthenticateState.cpp [new file with mode: 0644]
server/states/src/DeregState.cpp [new file with mode: 0644]
server/states/src/EnrollState.cpp [new file with mode: 0644]
server/states/src/GetRegsState.cpp [new file with mode: 0644]
server/states/src/InitState.cpp [new file with mode: 0644]
server/states/src/RegisterState.cpp [new file with mode: 0644]
server/states/src/TCState.cpp [new file with mode: 0644]
server/states/src/VerifyState.cpp [new file with mode: 0644]
silent_auth/CMakeLists.txt [new file with mode: 0644]
silent_auth/silent_auth_entry.cpp [new file with mode: 0644]
silent_auth/silent_auth_entry.h [new file with mode: 0644]
test/RADemoTV/.cproject [new file with mode: 0644]
test/RADemoTV/.exportMap [new file with mode: 0644]
test/RADemoTV/.gitignore [new file with mode: 0644]
test/RADemoTV/.package-stamp [new file with mode: 0644]
test/RADemoTV/.project [new file with mode: 0644]
test/RADemoTV/.rds_delta [new file with mode: 0644]
test/RADemoTV/.sdk_delta.info [new file with mode: 0644]
test/RADemoTV/.sign/.manifest.tmp [new file with mode: 0644]
test/RADemoTV/.sign/author-signature.xml [new file with mode: 0644]
test/RADemoTV/.sign/signature1.xml [new file with mode: 0644]
test/RADemoTV/.tproject [new file with mode: 0644]
test/RADemoTV/Instruction.txt [new file with mode: 0644]
test/RADemoTV/accessibility/screen_reader/custom_frame.edc [new file with mode: 0644]
test/RADemoTV/accessibility/screen_reader/description.edc [new file with mode: 0644]
test/RADemoTV/accessibility/screen_reader/reading_order.edc [new file with mode: 0644]
test/RADemoTV/button.edc [new file with mode: 0644]
test/RADemoTV/datetime.edc [new file with mode: 0644]
test/RADemoTV/default/inc/my_button_header.edc [new file with mode: 0644]
test/RADemoTV/default/my_button.edc [new file with mode: 0644]
test/RADemoTV/edc_resource/accessibility/screen_reader/custom_frame.edc [new file with mode: 0644]
test/RADemoTV/edc_resource/accessibility/screen_reader/description.edc [new file with mode: 0644]
test/RADemoTV/edc_resource/accessibility/screen_reader/reading_order.edc [new file with mode: 0644]
test/RADemoTV/edc_resource/button.edc [new file with mode: 0644]
test/RADemoTV/edc_resource/datetime.edc [new file with mode: 0644]
test/RADemoTV/edc_resource/default/inc/my_button_header.edc [new file with mode: 0644]
test/RADemoTV/edc_resource/default/my_button.edc [new file with mode: 0644]
test/RADemoTV/edc_resource/entry.edc [new file with mode: 0644]
test/RADemoTV/edc_resource/genlist.edc [new file with mode: 0644]
test/RADemoTV/edc_resource/label.edc [new file with mode: 0644]
test/RADemoTV/edc_resource/layout.edc [new file with mode: 0644]
test/RADemoTV/edc_resource/pagecontrol.edc [new file with mode: 0644]
test/RADemoTV/edc_resource/popup_custom.edc [new file with mode: 0644]
test/RADemoTV/edc_resource/progressbar.edc [new file with mode: 0644]
test/RADemoTV/edc_resource/slider.edc [new file with mode: 0644]
test/RADemoTV/entry.edc [new file with mode: 0644]
test/RADemoTV/genlist.edc [new file with mode: 0644]
test/RADemoTV/inc/fido_handler.h [new file with mode: 0644]
test/RADemoTV/inc/rademotv.h [new file with mode: 0644]
test/RADemoTV/inc/storage_handler.h [new file with mode: 0644]
test/RADemoTV/inc/util.h [new file with mode: 0644]
test/RADemoTV/label.edc [new file with mode: 0644]
test/RADemoTV/layout.edc [new file with mode: 0644]
test/RADemoTV/manasij.p12 [new file with mode: 0644]
test/RADemoTV/pagecontrol.edc [new file with mode: 0644]
test/RADemoTV/popup_custom.edc [new file with mode: 0644]
test/RADemoTV/progressbar.edc [new file with mode: 0644]
test/RADemoTV/project_def.prop [new file with mode: 0644]
test/RADemoTV/res/images/Clock_tabs_icon_alarm.png [new file with mode: 0644]
test/RADemoTV/res/images/Clock_tabs_icon_timer.png [new file with mode: 0644]
test/RADemoTV/res/images/Clock_tabs_icon_world_clock.png [new file with mode: 0644]
test/RADemoTV/res/images/Clock_tabs_icon_world_stopwatch.png [new file with mode: 0644]
test/RADemoTV/res/images/arrow-down.png [new file with mode: 0644]
test/RADemoTV/res/images/arrow-left.png [new file with mode: 0644]
test/RADemoTV/res/images/arrow-left1.png [new file with mode: 0644]
test/RADemoTV/res/images/arrow-right.png [new file with mode: 0644]
test/RADemoTV/res/images/arrow-up.png [new file with mode: 0644]
test/RADemoTV/res/images/btn_style_nor.png [new file with mode: 0644]
test/RADemoTV/res/images/contacts_ic_circle_btn_call.png [new file with mode: 0644]
test/RADemoTV/res/images/contacts_ic_circle_btn_email.png [new file with mode: 0644]
test/RADemoTV/res/images/contacts_ic_circle_btn_note.png [new file with mode: 0644]
test/RADemoTV/res/images/core_floating_icon_01.png [new file with mode: 0644]
test/RADemoTV/res/images/core_floating_icon_02.png [new file with mode: 0644]
test/RADemoTV/res/images/core_icon_expand_close.png [new file with mode: 0644]
test/RADemoTV/res/images/core_icon_expand_open.png [new file with mode: 0644]
test/RADemoTV/res/images/custom_highlight.png [new file with mode: 0644]
test/RADemoTV/res/images/custom_highlight2.png [new file with mode: 0644]
test/RADemoTV/res/images/grid_image/1_raw.png [new file with mode: 0644]
test/RADemoTV/res/images/grid_image/2_raw.png [new file with mode: 0644]
test/RADemoTV/res/images/horz_scrollbar.png [new file with mode: 0644]
test/RADemoTV/res/images/tizen.png [new file with mode: 0644]
test/RADemoTV/res/offline_auth_req.json [new file with mode: 0644]
test/RADemoTV/res/offline_dereg_req.json [new file with mode: 0644]
test/RADemoTV/res/offline_reg_req.json [new file with mode: 0644]
test/RADemoTV/res/ui-controls.edc [new file with mode: 0644]
test/RADemoTV/shared/res/fido.png [new file with mode: 0644]
test/RADemoTV/shared/res/rademotv.png [new file with mode: 0644]
test/RADemoTV/slider.edc [new file with mode: 0644]
test/RADemoTV/src/fido_handler.c [new file with mode: 0644]
test/RADemoTV/src/rademotv.c [new file with mode: 0644]
test/RADemoTV/src/storage_handler.c [new file with mode: 0644]
test/RADemoTV/tizen-manifest.xml [new file with mode: 0644]
test/conformance_test/FIDOSample/.cproject [new file with mode: 0644]
test/conformance_test/FIDOSample/.exportMap [new file with mode: 0644]
test/conformance_test/FIDOSample/.package-stamp [new file with mode: 0644]
test/conformance_test/FIDOSample/.project [new file with mode: 0644]
test/conformance_test/FIDOSample/.rds_delta [new file with mode: 0644]
test/conformance_test/FIDOSample/.sdk_delta.info [new file with mode: 0644]
test/conformance_test/FIDOSample/.sign/.manifest.tmp [new file with mode: 0644]
test/conformance_test/FIDOSample/.sign/author-signature.xml [new file with mode: 0644]
test/conformance_test/FIDOSample/.sign/signature1.xml [new file with mode: 0644]
test/conformance_test/FIDOSample/.tproject [new file with mode: 0644]
test/conformance_test/FIDOSample/inc/fidosample.h [new file with mode: 0644]
test/conformance_test/FIDOSample/project_def.prop [new file with mode: 0644]
test/conformance_test/FIDOSample/res/auth_req.json [new file with mode: 0644]
test/conformance_test/FIDOSample/res/dereg_req.json [new file with mode: 0644]
test/conformance_test/FIDOSample/res/reg_req.json [new file with mode: 0644]
test/conformance_test/FIDOSample/shared/res/fidosample.png [new file with mode: 0644]
test/conformance_test/FIDOSample/src/fidosample.c [new file with mode: 0644]
test/conformance_test/FIDOSample/tizen-manifest.xml [new file with mode: 0644]
test/conformance_test/manasij.p12 [new file with mode: 0644]
test/org.example.rademotv-1.0.0-arm.tpk [new file with mode: 0644]
test/shell_tc/CMakeLists.txt [new file with mode: 0644]
test/shell_tc/fido_asm_shell_tc.cpp [new file with mode: 0644]
test/shell_tc/fido_asm_shell_tc_util.cpp [new file with mode: 0644]
test/shell_tc/fido_asm_shell_tc_util.h [new file with mode: 0644]
ui/CMakeLists.txt [new file with mode: 0644]
ui/data/org.tizen.asmui.png [new file with mode: 0644]
ui/data/org.tizen.asmui.xml [new file with mode: 0644]
ui/org.tizen.asmui.png [new file with mode: 0644]
ui/org.tizen.asmui.rule [new file with mode: 0644]
ui/org.tizen.asmui.xml [new file with mode: 0644]
ui/src/asm_ui.c [new file with mode: 0644]
ui/src/asm_ui_ipc.c [new file with mode: 0644]
ui/src/asm_ui_ipc.h [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..080e5b2
--- /dev/null
@@ -0,0 +1,5 @@
+*.config
+*.creator
+*.user
+*.files
+*.includes
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1cdee6f
--- /dev/null
@@ -0,0 +1,21 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(fido-asm)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(INCLUDEDIR "\${prefix}/include ")
+
+##ADD_SUBDIRECTORY(common)
+ADD_SUBDIRECTORY(server)
+##ADD_SUBDIRECTORY(test/shell_tc)
+ADD_SUBDIRECTORY(silent_auth)
+ADD_SUBDIRECTORY(ui)
+ADD_SUBDIRECTORY(roaming_agent)
+ADD_SUBDIRECTORY(common/dbus_interfaces)
+ADD_SUBDIRECTORY(bt_roaming_agent)
+ADD_SUBDIRECTORY(ble_roaming_agent)
+ADD_DEPENDENCIES(fido-asm fido-asm-dbus)
+ADD_DEPENDENCIES(fido-bt-ragent-service fido-asm-dbus)
+ADD_DEPENDENCIES(fido-ble-ragent-service fido-asm-dbus)
+ADD_DEPENDENCIES(fido-roaming-agent-service fido-asm-dbus)
+ADD_DEPENDENCIES(asmui fido-asm-dbus)
diff --git a/Instructions.txt b/Instructions.txt
new file mode 100644 (file)
index 0000000..dc9da25
--- /dev/null
@@ -0,0 +1,55 @@
+- FIDO Reference ASM is a newly implemented ASM capable of supporting multiple FIDO spec compliant Authenticators.
+- Target platform version is Tizen 3.x.
+
+- It generates the following:
+       1. fido-asm rpm
+       2. fido-asm devel rpm
+       3. org.tizen.asmui rpm
+       4. Multiple Authenticator plugin rpms (To be added)
+
+- Installation:
+       1. rpm -ivh --force --nodeps <fido-asm rpm>
+       2. rpm -ivh --force --nodeps <fido-asm devel rpm> [Only for internal unit level testing]
+       3. sync and reboot
+       4. rpm -ivh --force --nodeps <asmui rpm>
+       5. If you are using July Binary then
+       chsmack -e System::Privileged /usr/bin/tpk-backend
+       6. tpk-backend -y org.tizen.asmui --preload
+
+- Instllation: Roaming Authenticator
+       1. Pre-condition: Two TM1 devices must be connected to same Multicast AP.
+       2. Let TM1S = Server Device (Mobile), TM1C = Client Device (TV)
+       3. On Server Device,-
+               a. Install fido-asm, fido-asm-ui and fido-pin-auth
+               b. sync and reboot
+       4. On Client Device,-
+               a. Install fido-client, fido-asm and FIDOSample
+               b. sync and reboot.
+       5. After reboot, give some time to both devices to connect to the AP.
+       6. On Client Device, open FIDOSample app and test:
+               a. Find Authenticator
+               b. Registration
+               c. Authentication
+
+- Testing:
+       1. FIDOSample can be used to test, however the json must have AAID matched with one of the installed Authenticator's.
+       2. fido-devel rpm can be used for all unit level testing (except UI), after installation, 
+       run /opt/usr/devel/fido_asm/tc/fido-asm-shell-tc and select unit testing options.
+       3. For UI testing, first enable ASM_UI_TEST in server/ClientListener.cpp, then build fido-asm, reboot.
+               - Then, for Transaction UI testing, run from device shell,-
+                       dbus-send --system            \
+                 --dest=org.tizen.fidoasm \
+                 --type=method_call          \
+                 --print-reply               \
+                 /org/tizen/fidoasm       \
+                 org.tizen.fidoasm.asm_request \
+                 string:'tc'
+               - For Account UI testing, run from device shell,-
+                       dbus-send --system            \
+                 --dest=org.tizen.fidoasm \
+                 --type=method_call          \
+                 --print-reply               \
+                 /org/tizen/fidoasm       \
+                 org.tizen.fidoasm.asm_request \
+                 string:'acc'
+               - Mobile Emulator default theme might create visibility issue for UI, use General Purpose emulator.(To be fixed later)
diff --git a/LICENSE.APLv2 b/LICENSE.APLv2
new file mode 100644 (file)
index 0000000..d645695
--- /dev/null
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..0e0f016
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
diff --git a/ble_roaming_agent/CMakeLists.txt b/ble_roaming_agent/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f11cdcd
--- /dev/null
@@ -0,0 +1,45 @@
+SET(BLE_RAGENT_DAEMON fido-ble-ragent-service)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(BLE_RAGENT_DAEMON_PKGS REQUIRED
+               dlog
+               glib-2.0
+               capi-base-common
+               pkgmgr-info
+               gio-2.0
+               gio-unix-2.0
+               gmodule-2.0
+               cynara-client
+               cynara-session
+               cynara-creds-gdbus
+               capi-network-connection
+               capi-base-common
+               capi-appfw-application
+               capi-appfw-app-manager
+               aul
+               json-glib-1.0
+               capi-system-info
+               capi-system-system-settings
+               capi-network-bluetooth
+)
+
+FOREACH(flag ${BLE_RAGENT_DAEMON_PKGS_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}")
+SET(PKGS_LDFLAGS "${BLE_RAGENT_DAEMON_PKGS_LDFLAGS} -pie")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/ble_roaming_agent/inc/)
+
+FILE( GLOB BLE_RAGENT_DAEMON_SRCS_CC
+       src/*.c
+)
+
+ADD_EXECUTABLE(${BLE_RAGENT_DAEMON} ${BLE_RAGENT_DAEMON_SRCS_CC})
+
+TARGET_LINK_LIBRARIES(${BLE_RAGENT_DAEMON} ${BLE_RAGENT_DAEMON_PKGS_LDFLAGS} fido-asm-dbus "-ldl")
+
+INSTALL(TARGETS ${BLE_RAGENT_DAEMON} DESTINATION bin)
diff --git a/ble_roaming_agent/inc/BTRoamingKeys.h b/ble_roaming_agent/inc/BTRoamingKeys.h
new file mode 100644 (file)
index 0000000..5c066b8
--- /dev/null
@@ -0,0 +1,18 @@
+#include <tzplatform_config.h>
+
+#ifndef _BT_ROAMINGKEYS_H
+#define _BT_ROAMINGKEYS_H
+
+#define RA_BLE_FRAME_MAX_SIZE 20
+/*TODO: Change to some other uids*/
+#define RA_BLE_ADVERTISING_UUID                        "89D3502B-0F36-433A-8EF4-C502AD55F8DC"
+#define RA_BLE_SERVICE_UUID                            "89D3502B-0F36-433A-8EF4-C502AD55F8DC"
+#define RA_BLE_UUID_REQUEST                    "9B3C81D8-57B1-4A8A-B8DF-0E56F7CA51C2"
+#define RA_BLE_UUID_RESPONSE                                   "2F7CABCE-808D-411F-9A0C-BB92BA96C102"
+#define RA_BLE_SERVICE_REVISION                        "1.0"
+#define RA_BLE_FRAME_MAX_SIZE                          20
+#define RA_BLE_DATA_MAX_SIZE                           65536
+
+#define BT_DISC_TIMEOUT_SEC 5
+
+#endif // _BT_ROAMINGKEYS_H
diff --git a/ble_roaming_agent/src/bt_ragent_main.c b/ble_roaming_agent/src/bt_ragent_main.c
new file mode 100644 (file)
index 0000000..01f52f4
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014 - 2015 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 <tizen.h>
+#include <glib.h>
+
+#include "fido_gatt_server.h"
+#include "AsmHelper.h"
+
+int
+main(int argc, char *argv[])
+{
+       _INFO("Starting BT Roaming Agent Service");
+
+       GMainLoop *mainloop = g_main_loop_new(NULL, FALSE);
+
+       int ret = fido_gatt_server_init();
+       _INFO("fido_gatt_server_init=[%d]", ret);
+
+       g_main_loop_run(mainloop);
+
+       _INFO("Stopping BT Roaming Agent Service");
+       ret = fido_gatt_server_shutdown();
+       _INFO("[%d]", ret);
+
+       return 0;
+}
diff --git a/ble_roaming_agent/src/fido_gatt_server.c b/ble_roaming_agent/src/fido_gatt_server.c
new file mode 100644 (file)
index 0000000..d53328e
--- /dev/null
@@ -0,0 +1,312 @@
+
+#include <stdlib.h>
+#include <glib.h>
+#include <tizen.h>
+#include <stdio.h>
+
+#include <dlog.h>
+
+#include "fido_gatt_server.h"
+#include "BTRoamingKeys.h"
+#include "AsmHelper.h"
+#include "fido-client-ipc-stub.h"
+
+#include <system_info.h>
+#include <system_settings.h>
+#include <net_connection.h>
+#include <bluetooth.h>
+
+static bool __isStarted = false;
+
+static Fidoasm*
+__asm_get_dbus_proxy(void)
+{
+#if !GLIB_CHECK_VERSION(2, 35, 0)
+       g_type_init();
+#endif
+
+       GDBusConnection *connection = NULL;
+       GError *error = NULL;
+
+       connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+
+       /* Create the object */
+       Fidoasm *dbus_proxy = fidoasm_proxy_new_sync(connection,
+                                               G_DBUS_PROXY_FLAGS_NONE,
+                                                                                                "org.tizen.fidoasm",
+                                                                                                "/org/tizen/fidoasm",
+                                               NULL,
+                                               &error);
+
+       if (error != NULL)
+               _ERR("bluetooth fidoasm_proxy_new_sync failed %s", error->message);
+
+       return dbus_proxy;
+}
+
+static void
+__ra_notify_cb(int result, const char *remote_address, bt_gatt_server_h server,
+               bt_gatt_h characteristic, bool completed, void *user_data)
+{
+       _INFO("bluetooth ragent __ra_notify_cb=[%d]", result);
+}
+
+static void
+__ra__write_value_requested_cb(const char *remote_address, int request_id, bt_gatt_server_h server,
+               bt_gatt_h gatt_handle, int offset,
+               const char *value, int len, void *user_data)
+{
+       _INFO("bluetooth ragent __ra__write_value_requested_cb=[%s]", value);
+
+       /*Call ASM dbus and receive the response*/
+       Fidoasm *asm_proxy = __asm_get_dbus_proxy();
+       if (asm_proxy == NULL) {
+               _ERR("bluetooth Failed to get ASM proxy");
+               bt_gatt_server_send_response(request_id, BT_GATT_REQUEST_TYPE_WRITE,
+                                                                        offset, -1, NULL, 0);
+               return;
+       }
+
+
+       const char *tlvReqB64 = value;
+       char *tlvRespB64 = NULL;
+       GError *gErr = NULL;
+       int tz_err = 0;
+       fidoasm_call_asm_request_sync(asm_proxy, tlvReqB64,
+                                                                 &tz_err, &tlvRespB64, NULL, &gErr);
+       if (gErr != NULL) {
+
+               bt_gatt_server_send_response(request_id, BT_GATT_REQUEST_TYPE_WRITE,
+                                                                        offset, -1, NULL, 0);
+               _ERR("bluetooth Failed returned from ASM");
+               return;
+       }
+
+       int ret = bt_gatt_set_value(gatt_handle, tlvRespB64, strlen(tlvRespB64));
+       _INFO("bluetooth ragent bt_gatt_set_value=[%d]", ret);
+
+       bt_gatt_server_send_response(request_id, BT_GATT_REQUEST_TYPE_WRITE, offset, 0, NULL, 0);
+
+       ret = bt_gatt_server_notify_characteristic_changed_value(gatt_handle, __ra_notify_cb, remote_address, NULL);
+       _INFO("bluetooth ragent bt_gatt_server_notify_characteristic_changed_value=[%d]", ret);
+}
+
+static void
+__advertising_state_changed_cb(int result, bt_advertiser_h advertiser,
+                                                          bt_adapter_le_advertising_state_e adv_state, void* user_data)
+{
+       _INFO("bluetooth ragent __advertising_state_changed_cb=[%d]", adv_state);
+}
+
+#define MAX_BLE_SIZE 1024
+
+static void
+onGattConchanged(int result, bool connected, const char *remote_address, void *user_data)
+{
+       _INFO("remote_address=[%s]", remote_address);
+       _INFO("connected=[%d]", connected);
+       _INFO("[%d]", result);
+}
+
+static int
+__fido_gatt_server_start(void)
+{
+       _INFO("bluetooth Request to start GATT server");
+
+       if (__isStarted == true) {
+               _INFO("bluetooth Already started");
+               return 0;
+       }
+
+       _INFO("bluetooth New GATT server");
+       __isStarted = true;
+
+       bt_gatt_set_connection_state_changed_cb(onGattConchanged, NULL);
+
+       int ret = BT_ERROR_NONE;
+       bt_gatt_server_h server = NULL;
+       bt_gatt_h service = NULL;
+       bt_gatt_h ctrl_pt_write_req = NULL;
+       bt_gatt_h ctrl_pt_notif_resp = NULL;
+       int permissions = BT_GATT_PERMISSION_READ | BT_GATT_PERMISSION_WRITE;
+
+       /*Notification enabled */
+       char *reqVal = (char*)calloc(MAX_BLE_SIZE, sizeof(char));
+       char *respVal = (char*)calloc(MAX_BLE_SIZE, sizeof(char));
+
+       ret = bt_gatt_server_initialize();
+       if (ret != BT_ERROR_NONE) {
+               _ERR("bluetooth ragent bt_gatt_server_initialize=[%d]", ret);
+               goto FAIL;
+       }
+
+       ret = bt_gatt_server_create(&server);
+       if (ret != BT_ERROR_NONE) {
+               _ERR("bluetooth ragent bt_gatt_server_create=[%d]", ret);
+               goto FAIL;
+       }
+
+       _INFO("bluetooth ragent gatt service create");
+       ret = bt_gatt_service_create(RA_BLE_SERVICE_UUID, BT_GATT_SERVICE_TYPE_PRIMARY, &service);
+       if (ret != BT_ERROR_NONE)
+               goto FAIL;
+
+       _INFO("bluetooth ragent Create GATT Characteristic");
+       /* Create GATT Characteristic */
+       ret = bt_gatt_characteristic_create(RA_BLE_UUID_REQUEST,
+                                                                               permissions,
+                                                                               BT_GATT_PROPERTY_WRITE,
+                                                                               reqVal,
+                                                                               MAX_BLE_SIZE,
+                                                                               &ctrl_pt_write_req);
+       if (ret != BT_ERROR_NONE)
+               goto FAIL;
+
+       ret = bt_gatt_characteristic_create(RA_BLE_UUID_RESPONSE,
+                                                                               permissions,
+                                                                               BT_GATT_PROPERTY_NOTIFY,
+                                                                               respVal,
+                                                                               MAX_BLE_SIZE,
+                                                                               &ctrl_pt_notif_resp);
+
+       _INFO("bluetooth ragent set GATT Characterisitic Callback");
+
+       ret = bt_gatt_server_set_write_value_requested_cb(ctrl_pt_write_req,
+                                                                                                         __ra__write_value_requested_cb, NULL);
+       if (ret != BT_ERROR_NONE)
+               goto FAIL;
+
+       _INFO("bluetooth ragent Add GATT Characteristic in service");
+       /* add GATT Characteristic in service */
+       ret = bt_gatt_service_add_characteristic(service, ctrl_pt_write_req);
+       if (ret != BT_ERROR_NONE)
+               goto FAIL;
+
+       ret = bt_gatt_service_add_characteristic(service, ctrl_pt_notif_resp);
+       if (ret != BT_ERROR_NONE)
+               goto FAIL;
+
+       _INFO("bluetooth ragent Register GATT Service");
+       ret = bt_gatt_server_register_service(server, service);
+       if (ret != BT_ERROR_NONE) {
+               _INFO("bluetooth ragent can not register gatt service.");
+               goto FAIL;
+       }
+
+
+       _INFO("bluetooth ragent GATT Server Done");
+
+       ret = bt_gatt_server_start();
+       if (ret != BT_ERROR_NONE) {
+               _INFO("bluetooth ragent bt_gatt_server_start failed = [%d]", ret);
+               goto FAIL;
+       }
+
+       _INFO("bluetooth ragent GATT Server started");
+
+       _INFO("bluetooth ragent starting LE adv");
+       bt_advertiser_h adv_handle = NULL;
+       ret = bt_adapter_le_create_advertiser(&adv_handle);
+       if (ret != BT_ERROR_NONE) {
+               _INFO("bluetooth ragent bt_adapter_le_create_advertiser failed = [%d]", ret);
+               goto FAIL;
+       }
+
+       _INFO("bluetooth ragent after bt_adapter_le_create_advertiser");
+
+       ret = bt_adapter_le_set_advertising_connectable(adv_handle, true);
+       if (ret != BT_ERROR_NONE) {
+               _INFO("bluetooth ragent bt_adapter_le_set_advertising_connectable failed = [%d]", ret);
+               goto FAIL;
+       }
+
+       _INFO("bluetooth ragent after bt_adapter_le_set_advertising_connectable");
+
+       ret = bt_adapter_le_add_advertising_service_uuid(adv_handle,
+                                                                                                        BT_ADAPTER_LE_PACKET_ADVERTISING, RA_BLE_ADVERTISING_UUID);
+       if (ret != BT_ERROR_NONE) {
+               _INFO("bluetooth ragent bt_adapter_le_add_advertising_service_uuid failed = [%d]", ret);
+               goto FAIL;
+       }
+
+       _INFO("bluetooth ragent after bt_adapter_le_add_advertising_service_uuid");
+
+       ret = bt_adapter_le_set_advertising_device_name(adv_handle,
+                                                                                                       BT_ADAPTER_LE_PACKET_SCAN_RESPONSE, true);
+       if (ret != BT_ERROR_NONE) {
+               _INFO("bluetooth ragent bt_adapter_le_set_advertising_device_name failed = [%d]", ret);
+               goto FAIL;
+       }
+
+       _INFO("bluetooth ragent after bt_adapter_le_set_advertising_device_name");
+
+       ret = bt_adapter_le_start_advertising_new(adv_handle,
+                                                                                         __advertising_state_changed_cb, adv_handle);
+       if (ret != BT_ERROR_NONE) {
+               _INFO("bluetooth ragent bt_adapter_le_start_advertising_new failed = [%d]", ret);
+               goto FAIL;
+       }
+
+       _INFO("bluetooth ragent LE adv done");
+       return 0;
+
+FAIL:
+       _INFO("bluetooth ragent ERROR");
+       bt_gatt_characteristic_destroy(ctrl_pt_write_req);
+       bt_gatt_characteristic_destroy(ctrl_pt_notif_resp);
+       bt_gatt_service_destroy(service);
+       bt_gatt_server_destroy(server);
+
+       return -1;
+}
+
+static int
+__fido_gatt_server_stop(void)
+{
+       _INFO("bluetooth Stopping GATT server");
+       __isStarted = false;
+       bt_gatt_server_deinitialize();
+       return 0;
+}
+
+static void
+__bt_state_changed_cb(int result, bt_adapter_state_e adapter_state, void* user_data)
+{
+       _INFO("bluetooth __bt_state_changed_cb=[%d]", adapter_state);
+       if (adapter_state == BT_ADAPTER_ENABLED) {
+               __fido_gatt_server_start();
+       }
+}
+
+int
+fido_gatt_server_shutdown(void)
+{
+       return __fido_gatt_server_stop();
+}
+
+int
+fido_gatt_server_init(void)
+{
+       int ret = bt_initialize();
+       if ((ret != BT_ERROR_NONE) && (ret != BT_ERROR_ALREADY_DONE)) {
+               _ERR("bluetooth bt_init failed = [%d]", ret);
+               return -1;
+       }
+
+       __isStarted = false;
+
+       bt_adapter_set_state_changed_cb(__bt_state_changed_cb, NULL);
+
+       bt_adapter_state_e adapter_state = BT_ADAPTER_DISABLED;
+       ret = bt_adapter_get_state(&adapter_state);
+       if (ret != BT_ERROR_NONE) {
+               _ERR("bluetooth bt_adapter_get_state failed = [%d]", ret);
+               return -1;
+       }
+
+       if (adapter_state == BT_ADAPTER_ENABLED) {
+               return __fido_gatt_server_start();
+       }
+
+       return 0;
+}
diff --git a/ble_roaming_agent/src/fido_gatt_server.h b/ble_roaming_agent/src/fido_gatt_server.h
new file mode 100644 (file)
index 0000000..b03954b
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef _FIDO_GATT_SERVER_H_
+#define _FIDO_GATT_SERVER_H_
+
+
+int fido_gatt_server_init(void);
+int fido_gatt_server_shutdown(void);
+
+
+#endif /* _FIDO_GATT_SERVER_H_ */
diff --git a/bt_roaming_agent/CMakeLists.txt b/bt_roaming_agent/CMakeLists.txt
new file mode 100644 (file)
index 0000000..401f562
--- /dev/null
@@ -0,0 +1,45 @@
+SET(BT_RAGENT_DAEMON fido-bt-ragent-service)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(BT_RAGENT_DAEMON_PKGS REQUIRED
+               dlog
+               glib-2.0
+               capi-base-common
+               pkgmgr-info
+               gio-2.0
+               gio-unix-2.0
+               gmodule-2.0
+               cynara-client
+               cynara-session
+               cynara-creds-gdbus
+               capi-network-connection
+               capi-base-common
+               capi-appfw-application
+               capi-appfw-app-manager
+               aul
+               json-glib-1.0
+               capi-system-info
+               capi-system-system-settings
+               capi-network-bluetooth
+)
+
+FOREACH(flag ${BT_RAGENT_DAEMON_PKGS_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}")
+SET(PKGS_LDFLAGS "${BT_RAGENT_DAEMON_PKGS_LDFLAGS} -pie")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/bt_roaming_agent/inc/)
+
+FILE( GLOB BT_RAGENT_DAEMON_SRCS_CC
+       src/*.c
+)
+
+ADD_EXECUTABLE(${BT_RAGENT_DAEMON} ${BT_RAGENT_DAEMON_SRCS_CC})
+
+TARGET_LINK_LIBRARIES(${BT_RAGENT_DAEMON} ${BT_RAGENT_DAEMON_PKGS_LDFLAGS} fido-asm-dbus "-ldl")
+
+INSTALL(TARGETS ${BT_RAGENT_DAEMON} DESTINATION bin)
diff --git a/bt_roaming_agent/inc/BTRoamingKeys.h b/bt_roaming_agent/inc/BTRoamingKeys.h
new file mode 100644 (file)
index 0000000..c4a8809
--- /dev/null
@@ -0,0 +1,25 @@
+#include <tzplatform_config.h>
+
+#ifndef _BT_ROAMINGKEYS_H
+#define _BT_ROAMINGKEYS_H
+
+#define RA_RESOURCE_URI "/fido/auth/roaming/pin"
+#define RA_RESOURCE_TYPE "org.tizen.fidoauthroamingpin"
+
+#define RA_QUERY_KEY_REQUEST "ra_query_prcoess_tlv"
+#define RA_QUERY_KEY_SERVER_ID "ra_query_server_id"
+#define RA_QUERY_KEY_RESPONSE "ra_response"
+
+#define RA_BLE_FRAME_MAX_SIZE 20
+/*TODO: Change to some other uids*/
+#define RA_BLE_ADVERTISING_UUID                        "89D3502B-0F36-433A-8EF4-C502AD55F8DC"
+#define RA_BLE_SERVICE_UUID                            "89D3502B-0F36-433A-8EF4-C502AD55F8DC"
+#define RA_BLE_UUID_REQUEST                    "9B3C81D8-57B1-4A8A-B8DF-0E56F7CA51C2"
+#define RA_BLE_UUID_RESPONSE                                   "2F7CABCE-808D-411F-9A0C-BB92BA96C102"
+#define RA_BLE_SERVICE_REVISION                        "1.0"
+#define RA_BLE_FRAME_MAX_SIZE                          20
+#define RA_BLE_DATA_MAX_SIZE                           65536
+
+#define BT_DISC_TIMEOUT_SEC 5
+
+#endif // _BT_ROAMINGKEYS_H
diff --git a/bt_roaming_agent/inc/bt_server.h b/bt_roaming_agent/inc/bt_server.h
new file mode 100644 (file)
index 0000000..6e2653b
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef BT_SERVER_H
+#define BT_SERVER_H
+
+int bt_server_start(void);
+
+int bt_server_stop(void);
+
+#endif // BT_SERVER_H
diff --git a/bt_roaming_agent/src/bt_ragent_main.c b/bt_roaming_agent/src/bt_ragent_main.c
new file mode 100644 (file)
index 0000000..8341908
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014 - 2015 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 <tizen.h>
+#include <glib.h>
+
+#include "AsmHelper.h"
+#include "bt_server.h"
+
+int
+main(int argc, char *argv[])
+{
+       _INFO("Starting BT Roaming Agent Service");
+
+       GMainLoop *mainloop = g_main_loop_new(NULL, FALSE);
+
+       int ret = bt_server_start();
+       _INFO("bt_server_start=[%d]", ret);
+
+       g_main_loop_run(mainloop);
+
+       return 0;
+}
diff --git a/bt_roaming_agent/src/bt_server.c b/bt_roaming_agent/src/bt_server.c
new file mode 100644 (file)
index 0000000..7603002
--- /dev/null
@@ -0,0 +1,506 @@
+
+#include <bluetooth.h>
+#include "bt_server.h"
+
+#include "AsmHelper.h"
+#include "BTRoamingKeys.h"
+#include "fido-client-ipc-stub.h"
+
+#include <system_info.h>
+#include <system_settings.h>
+#include <net_connection.h>
+#include <bluetooth.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define RA_BT_SERVICE_UUID "00001101-0000-1000-8000-00805F9B34FB"
+#define RA_LEN_DELIM ':'
+#define RA_LEN_DELIM_STR ":"
+#define DELIM_LEN 2
+#define D_LEN_MAX_LEN 12
+
+/*Proper error*/
+#define ERR_RESP "ZXJyb3I"
+
+typedef struct _bt_server {
+       char *client_addr;
+       bool is_authorized;
+       int server_socket_fd;
+       int client_socket_fd;
+       char *client_req;
+       int client_req_len;
+       int expected_len;
+       int rem_len;
+       int active_timer_id;
+} bt_server_t;
+
+typedef struct _bt_timer_info {
+       int timer_id;
+       bt_server_t *caller;
+} bt_timer_info_t;
+
+static bt_server_t *server = NULL;
+
+static bt_server_t*
+__create_server_handle(void)
+{
+       bt_server_t *s = (bt_server_t*)calloc(1, sizeof(bt_server_t));
+       s->client_addr = NULL;
+       s->is_authorized = false;
+       s->server_socket_fd = -1;
+       s->client_socket_fd = -1;
+       s->client_req_len = 0;
+       s->client_req = NULL;
+       s->expected_len = 0;
+       s->rem_len = 0;
+       s->active_timer_id = 0;
+
+       return s;
+}
+
+
+static void
+__destroy_server_handle(bt_server_t *s)
+{
+       RET_IF_FAIL_VOID(s != NULL);
+
+       SAFE_DELETE(s->client_addr);
+       SAFE_DELETE(s->client_req);
+       s->client_req_len = 0;
+       SAFE_DELETE(s);
+}
+
+static Fidoasm*
+__asm_get_dbus_proxy(void)
+{
+#if !GLIB_CHECK_VERSION(2, 35, 0)
+       g_type_init();
+#endif
+
+       GDBusConnection *connection = NULL;
+       GError *error = NULL;
+
+       connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+
+       /* Create the object */
+       Fidoasm *dbus_proxy = fidoasm_proxy_new_sync(connection,
+                                               G_DBUS_PROXY_FLAGS_NONE,
+                                                                                                "org.tizen.fidoasm",
+                                                                                                "/org/tizen/fidoasm",
+                                               NULL,
+                                               &error);
+
+       if (error != NULL)
+               _ERR("bluetooth bluetooth fidoasm_proxy_new_sync failed %s", error->message);
+
+       return dbus_proxy;
+}
+
+
+static void
+__sock_state_changed_cb(int result, bt_socket_connection_state_e connection_state,
+                                               bt_socket_connection_s *connection, void *user_data)
+{
+       if (result != BT_ERROR_NONE) {
+               _ERR("bluetooth [%d]", result);
+               return;
+       }
+
+       if (connection_state == BT_SOCKET_CONNECTED) {
+               _INFO("bluetooth Connected = [%s][%s][%d]", connection->remote_address, connection->service_uuid,
+                         connection->local_role);
+
+               /*Allows only one*/
+               SAFE_DELETE(server->client_addr);
+               server->client_addr = _SAFE_DUP(connection->remote_address);
+               return;
+       }
+
+       if (connection_state == BT_SOCKET_DISCONNECTED) {
+               _INFO("bluetooth DisConnected = [%s][%s][%d]", connection->remote_address, connection->service_uuid,
+                         connection->local_role);
+               return;
+       }
+}
+
+static int
+__bt_send_data(int sock_fd, char *data)
+{
+       if (data == NULL) {
+               data = strdup(ERR_RESP);
+               _ERR("bluetooth Failed returned from ASM");
+       }
+
+       int d_len = strlen(data);
+       int full_data_max_len = d_len + DELIM_LEN + D_LEN_MAX_LEN;
+       char *full_data = (char*)(calloc(full_data_max_len, sizeof(char)));
+
+       snprintf(full_data, full_data_max_len, "%d%s%s", d_len, RA_LEN_DELIM_STR, data);
+
+       int full_data_len = strlen(full_data);
+       _INFO("Sending data of len=[%d]", full_data_len);
+
+       int ret = bt_socket_send_data(sock_fd, full_data, full_data_len);
+       _INFO("bt_socket_send_data=[%d]", ret);
+
+       return 0;
+}
+
+static void
+__receive_finished(bt_server_t *server)
+{
+       if (server->client_req == NULL) {
+               _ERR("bluetooth No request");
+               return;
+       }
+
+       if (server->expected_len == 0) {
+               _INFO("Ignoring timeout, since data received fully before timeout");
+               return;
+       }
+
+       server->expected_len = 0;
+       server->rem_len = 0;
+
+       char *fullDataString = (char*)calloc(server->client_req_len + 1, sizeof(char));
+       memcpy(fullDataString, server->client_req, server->client_req_len);
+
+       _INFO("bluetooth Total pack length = [%d]", server->client_req_len);
+
+       /*Call ASM dbus and receive the response*/
+       Fidoasm *asm_proxy = __asm_get_dbus_proxy();
+       if (asm_proxy == NULL) {
+               _ERR("bluetooth bluetooth Failed to get ASM proxy");
+
+               server->active_timer_id = 0;
+               __bt_send_data(server->client_socket_fd, NULL);
+               return;
+       }
+
+       /*const char *tlvReqB64 = server->client_req;*/
+       char *tlvReqB64 = (char*)calloc(server->client_req_len + 1, sizeof(char));
+       memcpy(tlvReqB64, server->client_req, server->client_req_len);
+
+       char *tlvRespB64 = NULL;
+       GError *gErr = NULL;
+       int tz_err = 0;
+       fidoasm_call_ra_request_sync(asm_proxy, tlvReqB64,
+                                                                 &tz_err, &tlvRespB64, NULL, &gErr);
+       if (tlvRespB64 == NULL) {
+
+               server->active_timer_id = 0;
+               __bt_send_data(server->client_socket_fd, NULL);
+               return;
+       }
+
+       int ret = -1;
+       if (server->is_authorized == false) {
+               ret = bt_device_set_authorization(server->client_addr, BT_DEVICE_AUTHORIZED);
+               _INFO("bluetooth bt_device_set_authorization= [%d]", ret);
+       }
+
+       _INFO("%s", tlvRespB64);
+       int respLen = strlen(tlvRespB64);
+       _INFO("%d", respLen);
+       ret = __bt_send_data(server->client_socket_fd, tlvRespB64);
+
+       server->active_timer_id = 0;
+
+       /*TODO free client_req?*/
+       server->client_req = NULL;
+       server->client_req_len = 0;
+       server->client_socket_fd = -1;
+
+       return;
+}
+
+static void
+__timer_expired(gpointer data)
+{
+       _INFO("bluetooth __timer_expired");
+
+       bt_timer_info_t *bt_timer_info = (bt_timer_info_t*)data;
+       if (bt_timer_info == NULL)
+               return;
+
+       bt_server_t *server = (bt_server_t*)bt_timer_info->caller;
+       if (server == NULL)
+               return;
+
+       _INFO("timeout id=[%d], active id =[%d]", bt_timer_info->timer_id, server->active_timer_id);
+
+       if (bt_timer_info->timer_id != server->active_timer_id) {
+               _INFO("timeout ignored");
+               bt_timer_info->caller = NULL;
+               free(bt_timer_info);
+               return;
+       }
+
+       if (server->client_req == NULL) {
+               _ERR("bluetooth No request");
+               return;
+       }
+
+       if (server->expected_len == 0) {
+               _INFO("Ignoring timeout, since data received fully before timeout");
+               return;
+       }
+
+       server->expected_len = 0;
+       server->rem_len = 0;
+       server->active_timer_id = 0;
+       bt_timer_info->caller = NULL;
+       free(bt_timer_info);
+
+       /*TODO free client_req?*/
+       server->client_req = NULL;
+       server->client_req_len = 0;
+       server->client_socket_fd = -1;
+
+       return;
+}
+
+static gboolean
+__discoverTimeOutCb(gpointer user_data)
+{
+       _INFO("bluetooth bluetooth discoverTimeOutCb");
+
+       return G_SOURCE_REMOVE;
+}
+
+static void
+__bt_sock_data_received_cb(bt_socket_received_data_s* data, void* user_data)
+{
+       if (data == NULL) {
+               _ERR("bluetooth No received data!");
+               return;
+       }
+
+       _INFO("bluetooth Socket fd: %d", data->socket_fd);
+       _INFO("bluetooth Data: %s", data->data);
+       _INFO("bluetooth Size: %d", data->data_size);
+
+       char *pack = NULL;
+       int fullPackLen = 0;
+       int cur_pack_len = 0;
+       //bt_server_t *server = (bt_server_t*)user_data;
+       server->client_socket_fd = data->socket_fd;
+       /*Packets may arrive segmented, so use timer to get long data*/
+       if (server->client_req == NULL) {
+
+               int recv_d_len = data->data_size;
+               if (recv_d_len <= 0) {
+                       _ERR("Empty data frame");
+                       __bt_send_data(server->client_socket_fd, NULL);
+                       return;
+               }
+
+               int i = 0;
+
+               while (1) {
+
+                       if (data->data[i] == RA_LEN_DELIM)
+                               break;
+                       if ((i == data->data_size) || (data->data[i] == '\0')) {
+                               i = 0;
+                               break;
+                       }
+                       i++;
+               }
+
+               if (i <= 0) {
+                       _ERR("Missing :");
+                       __bt_send_data(server->client_socket_fd, NULL);
+                       return;
+               }
+
+               int d_first_frame_len = data->data_size - (i + 1);
+               if (d_first_frame_len <= 0) {
+                       _ERR("Empty data frame following :");
+                       __bt_send_data(server->client_socket_fd, NULL);
+                       return;
+               }
+
+               char *d_len_str = (char*)calloc(12, sizeof(char));
+               memcpy(d_len_str, data->data, i);
+               /*snprintf(d_len_str, i, "%s", data->data);*/
+               d_len_str[i] = '\0';
+               _INFO("[%s]", d_len_str);
+
+               int d_len = 0;
+               sscanf(d_len_str, "%d", &d_len);
+
+               _INFO("Data Len frame=[%d]", d_len);
+
+               server->expected_len = d_len;
+
+               pack = (char*)calloc(d_first_frame_len + 1, sizeof(char));
+               char *data_pack = data->data;
+               data_pack += i + 1;
+               memcpy(pack, data_pack, d_first_frame_len);
+
+               server->rem_len = server->expected_len - d_first_frame_len;
+               cur_pack_len = d_first_frame_len;
+
+               if (server->rem_len > 0) {
+                       _INFO("Need framing");
+                       bt_timer_info_t *bt_timer_info = (bt_timer_info_t*)calloc(1, sizeof(bt_timer_info_t));
+                       bt_timer_info->caller = server;
+                       if (server->active_timer_id > 1000)
+                               server->active_timer_id = 0;
+                       else
+                               server->active_timer_id++;
+
+                       bt_timer_info->timer_id = server->active_timer_id;
+
+                       _INFO("bluetooth bluetooth [%d] sec timeout starting", 6);
+                       g_timeout_add_seconds_full(G_PRIORITY_DEFAULT, 6, __discoverTimeOutCb, bt_timer_info,
+                                                                       __timer_expired);
+               }
+
+       } else {
+
+               pack = (char*)calloc(data->data_size, sizeof(char));
+               memcpy(pack, data->data, data->data_size);
+
+               server->rem_len = server->rem_len - data->data_size;
+               cur_pack_len = data->data_size;
+       }
+
+       if (server->client_req != NULL)
+               fullPackLen = cur_pack_len + server->client_req_len;
+       else
+               fullPackLen = cur_pack_len;
+
+       char *fullPackNew = (char*)calloc(fullPackLen, sizeof(char));
+
+       if (server->client_req != NULL)
+               memcpy(fullPackNew, server->client_req, server->client_req_len);
+
+       memcpy(fullPackNew + server->client_req_len, pack, cur_pack_len);
+
+       server->client_req_len = fullPackLen;
+       if (server->client_req != NULL)
+               free(server->client_req);
+       server->client_req = fullPackNew;
+
+       free(pack);
+
+       if (server->rem_len <= 0) {
+               _INFO("Received all");
+               __receive_finished(server);
+       }
+}
+
+static void
+__bt_authorization_changed_cb(bt_device_authorization_e authorization,
+                                                         char *remote_address, void *user_data)
+{
+       _INFO("bluetooth Authorization changed=[%d][%s]", authorization, remote_address);
+       if (authorization == BT_DEVICE_AUTHORIZED)
+               server->is_authorized = true;
+       else
+               server->is_authorized = false;
+}
+
+/*
+ * Bonding is not performed via framework, user needs to pair manually, to ensure
+ * security.
+*/
+static int
+__start_rfcomm(bt_server_t *server_loc)
+{
+       _INFO("");
+       static bool is_started = false;
+       if (is_started == false) {
+
+               _INFO("bluetooth ");
+               int sock_fd_temp = -1;
+               int ret = bt_socket_create_rfcomm(RA_BT_SERVICE_UUID, &sock_fd_temp);
+               if (ret != BT_ERROR_NONE) {
+                       _ERR("bluetooth bt_socket_create_rfcomm() failed.");
+                       return -1;
+               }
+
+               _INFO("bluetooth socket fd = [%d]", sock_fd_temp);
+               server->server_socket_fd = sock_fd_temp;
+
+               _INFO("bluetooth before bt_socket_set_connection_state_changed_cb");
+               ret = bt_socket_set_connection_state_changed_cb(__sock_state_changed_cb,
+                                                                                                               server);
+               if (ret != BT_ERROR_NONE) {
+                       _ERR("bluetooth [bt_socket_listen_and_accept_rfcomm] failed.");
+                       return -1;
+               }
+
+               _INFO("bluetooth before bt_socket_listen_and_accept_rfcomm");
+               ret = bt_socket_listen_and_accept_rfcomm(server->server_socket_fd, 1);
+               if (ret != BT_ERROR_NONE) {
+                       _ERR("[bt_socket_listen_and_accept_rfcomm] failed.");
+                       return -1;
+               }
+
+               _INFO("bluetooth before bt_socket_set_data_received_cb");
+               ret = bt_socket_set_data_received_cb(__bt_sock_data_received_cb, server);
+               if (ret != BT_ERROR_NONE) {
+                       _ERR("[bt_socket_set_data_received_cb] failed.");
+                       return -1;
+               }
+
+                ret = bt_device_set_authorization_changed_cb(__bt_authorization_changed_cb, server);
+               _INFO("bluetooth %d", ret);
+               is_started = true;
+       }
+
+       _INFO("bluetooth ");
+       return 0;
+}
+
+static void
+adapter_state_changed_cb(int result, bt_adapter_state_e adapter_state, void* user_data)
+{
+       _INFO("bluetooth %d", result);
+       _INFO("bluetooth %d", adapter_state);
+       if (adapter_state == BT_ADAPTER_ENABLED) {
+               __start_rfcomm(user_data);
+       }
+}
+
+int
+bt_server_start(void)
+{
+       int ret = bt_initialize();
+       if (ret != BT_ERROR_NONE) {
+               _ERR("bluetooth bt_socket_create_rfcomm() failed.");
+               return -1;
+       }
+
+       server = __create_server_handle();
+
+       ret = bt_adapter_set_state_changed_cb(adapter_state_changed_cb, NULL);
+
+       bt_adapter_state_e adapter_state = BT_ADAPTER_ENABLED;
+
+       ret = bt_adapter_get_state(&adapter_state);
+       if (ret != BT_ERROR_NONE) {
+               _ERR("bluetooth bt_socket_create_rfcomm() failed.");
+               return -1;
+       }
+
+       _INFO("bluetooth %d", adapter_state);
+
+       if (adapter_state == BT_ADAPTER_ENABLED) {
+               return __start_rfcomm(server);
+       }
+       return 0;
+}
+
+int
+bt_server_stop(void)
+{
+       _INFO("bluetooth ");
+       bt_socket_destroy_rfcomm(server->server_socket_fd);
+       __destroy_server_handle(server);
+       server = NULL;
+       return 0;
+}
diff --git a/common/AsmHelper.h b/common/AsmHelper.h
new file mode 100644 (file)
index 0000000..5850666
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2014 - 2015 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 ASMHELPER_H
+#define ASMHELPER_H
+
+#include <tizen.h>
+#include <dlog.h>
+
+#define RET_IF_FAIL_VOID(cond) do {\
+               if (!(cond)){\
+                       return;\
+               }\
+} while(0)
+
+#define RET_IF_FAIL(cond, err) do {\
+               if (!(cond)){\
+                       return err;\
+               }\
+} while(0)
+
+#define CATCH_IF_FAIL(cond) do {\
+               if (!(cond)){\
+                       goto CATCH;\
+               }\
+} while(0)
+
+#define CATCH_IF_FAIL_X(cond, expr) do {\
+               if (!(cond)){\
+                       expr;\
+                       goto CATCH;\
+               }\
+} while(0)
+
+#define GOTO_IF_FAIL(cond, catch_block) do {\
+               if (!(cond)){\
+                       goto catch_block;\
+               }\
+} while(0)
+
+#define SAFE_DELETE(x) do {\
+       if (x != NULL) {\
+               free(x);    \
+               x = NULL;\
+       }\
+} while(0)
+
+#define _SAFE_DUP(x) ((x) ? strdup(x) : NULL)
+
+#ifdef  LOG_TAG
+#undef  LOG_TAG
+#endif
+#define LOG_TAG "org.tizen.fido.asm"
+
+#ifndef _ERR
+#define _ERR(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _DBG
+#define _DBG(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _INFO
+#define _INFO(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _BEGIN
+#define _BEGIN LOGI("[%s:%d] START \n", __func__, __LINE__)
+#endif
+
+#ifndef _END
+#define _END LOGI("[%s:%d] END \n", __func__, __LINE__)
+#endif
+
+#define ALLOC(type) (type *)calloc(1, sizeof(type))
+#define NALLOC(num, type) (type *)calloc(num, sizeof(type))
+
+#endif // ASMHELPER_H
diff --git a/common/cryptoutil/inc/asmcrypto.h b/common/cryptoutil/inc/asmcrypto.h
new file mode 100644 (file)
index 0000000..90fff27
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2014 - 2015 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 __asmcrypto_H__
+#define __asmcrypto_H__
+
+#include <stdio.h>
+#include <tizen.h>
+#include <string>
+#include <pkgmgr-info.h>
+
+class AsmCrypto {
+
+public:
+       static int genRandom(unsigned char *random, int num);
+       static bool genHash256(const void* input, unsigned long length, unsigned char* md);
+       static int genRSAKeyPair(char *pubkey, char *prikey, const char *passwd, int keysize);
+       static int genRSASignValue(const char *privkey, const char * passwd, const unsigned char * msg, unsigned int len, unsigned char *sign,unsigned int *signlen);
+       static int genB64Encode(const unsigned char *input, int inlen, unsigned char * output, int *outlen);
+       static unsigned char *ToBase64Url(const unsigned char *input, int inputLen);
+       static int genB64Decodes(const unsigned char *input, int inlen, unsigned char * output, int *outlen);
+       static unsigned char *FromBase64Url(const unsigned char *input, int inputLen);
+       static int aesEncrypt(const unsigned char *plaintext, int plaintext_len, const unsigned char *key,
+                                                                                const unsigned char *iv, unsigned char *ciphertext);
+       static int aesDecrypt(const unsigned char *ciphertext, int ciphertext_len, const unsigned char *key,
+                                                                                const unsigned char *iv, unsigned char *plaintext);
+       static int createRSAKeyPair(int ksz, char **pubkey, int *pubkey_len, char **prikey, int *prikey_len);
+       static int createSha256Digest(const unsigned char *ip, int ip_len, char **op);
+       static unsigned char* readDer(const char *der_file_name, int *len);
+       static unsigned char *signRSA(const unsigned char *m, unsigned char *pri_key);
+
+       /*Caller must call AuthenrStub::Hash on this*/
+       static std::string getKHAccessToken(std::string appId, bool isBound);
+
+       static int signWithRSAPSSMGF1(const char *message, int m_len,
+                                                                         const char *privKeyFile, const char *pwd,
+                                                                         unsigned char **signature, int *sig_len);
+
+       static int digestSignRSAPSSMGF1(const char *message, int m_len,
+                                                                 const char *privKeyFile, const char *pwd,
+                                                                 unsigned char **signature, int *sig_len);
+
+       static std::string getDeviceId(void);
+       static char* getAppId(char *appIdPubKey);
+
+       static unsigned char* fidoSignWithKey(const unsigned char *msg, int msg_len,
+                                                                                 const unsigned char *private_key, int priv_key_len,
+                                                                                 int *sig_len);
+
+       static unsigned char* fidoSign(const unsigned char *msg, int msg_len, const char *private_key_file,
+                                               const char *pwd, int *sig_len);
+
+       static std::string getAsmToken(void);
+private:
+
+       static int onPkgList(pkgmgrinfo_pkginfo_h handle, void *user_data);
+       static void logDataToFile(const char *file_name_prefix, const char *data, int data_len);
+       static void logRawDataToFile(const char *file_name_prefix, const unsigned char *data, int data_len);
+       AsmCrypto(void);
+       ~AsmCrypto(void);
+};
+
+
+#endif /* __asmcrypto_H__ */
diff --git a/common/cryptoutil/src/AsmCrypto.cpp b/common/cryptoutil/src/AsmCrypto.cpp
new file mode 100644 (file)
index 0000000..32d7dee
--- /dev/null
@@ -0,0 +1,1381 @@
+
+#include "asmcrypto.h"
+#include <string>
+#include <stdio.h>
+#include <net_connection.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <string.h>
+#include <vector>
+#include "AsmHelper.h"
+#include <openssl/sha.h>
+#include <openssl/evp.h>
+#include <openssl/rsa.h>
+#include <openssl/pem.h>
+#include <openssl/bio.h>
+#include <openssl/err.h>
+#include <openssl/rand.h>
+#include <openssl/bio.h>
+#include <openssl/aes.h>
+#include <bluetooth.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+#define ASM_CONFIG_FILE "/opt/usr/data/.asm.config"
+#define FIDO_CLIENT_CALLER_ID "org.tizen.fido"
+#define LOG_FILE_PATH "/tmp/"
+#define uid 5001
+
+#define EVP_SUCCESS 1
+#define EVP_FAIL 0
+
+typedef struct __der_cert {
+       unsigned char* raw_cert;
+       size_t cert_size;
+} _der_cert_s;
+
+void
+AsmCrypto::logDataToFile(const char *file_name_prefix, const char *data, int data_len)
+{
+       char fn[128] = {0, };
+       snprintf(fn, 127, "%s%s", LOG_FILE_PATH, file_name_prefix);
+
+       FILE *fp = fopen(fn, "w+");
+       if (fp == NULL)
+               return;
+
+       int num = fwrite(data, sizeof(char), data_len, fp);
+
+       _INFO("[%d] bytes logged in [%s]", num, fn);
+
+       fclose(fp);
+}
+
+void
+AsmCrypto::logRawDataToFile(const char *file_name_prefix, const unsigned char *data, int data_len)
+{
+       char fn[128] = {0, };
+       snprintf(fn, 127, "%s%s", LOG_FILE_PATH, file_name_prefix);
+
+       FILE *fp = fopen(fn, "w+");
+       if (fp == NULL)
+               return;
+
+       int num = fwrite(data, sizeof(unsigned char), data_len, fp);
+
+       _INFO("[%d] bytes logged in [%s]", num, fn);
+
+       fclose(fp);
+}
+
+static int
+__der_cert_new(unsigned char *raw_cert, size_t cert_size, _der_cert_s **ppcert)
+{
+       _INFO("__der_cert_new start");
+
+       _der_cert_s *pcert;
+
+       if(raw_cert == NULL || cert_size <= 0 || ppcert == NULL) {
+               return -1;
+       }
+
+       pcert = static_cast<_der_cert_s*>(malloc(sizeof(_der_cert_s)));
+       if(pcert == NULL) {
+               return -1;
+       }
+
+       pcert->raw_cert = reinterpret_cast<unsigned char*>(malloc(cert_size));
+       if(pcert->raw_cert == NULL) {
+               free(pcert);
+               return -1;
+       }
+       memcpy(pcert->raw_cert, raw_cert, cert_size);
+
+       pcert->cert_size = cert_size;
+
+       *ppcert = pcert;
+
+       _INFO("__der_cert_new end");
+       return 0;
+}
+
+static int
+__load_cert_from_x509(X509 *xCert, _der_cert_s **cert)
+{
+        _INFO("__load_cert_from_x509 start");
+
+       if(xCert == NULL) {
+       return -1;
+       }
+
+       BIO *bcert = BIO_new(BIO_s_mem());
+
+       i2d_X509_bio(bcert, xCert);
+
+       std::vector<unsigned char> output(8196);
+       int size = BIO_read(bcert, output.data(), output.size());
+       BIO_free_all(bcert);
+       if (size <= 0) {
+               return -1;
+       }
+       output.resize(size);
+
+       return __der_cert_new(output.data(), output.size(), cert);
+}
+
+std::string
+AsmCrypto::getDeviceId(void)
+{
+       /*Find IoTCon logic to get device id*/
+       return getAsmToken();
+}
+
+/*TODO revisit*/
+std::string
+AsmCrypto::getAsmToken(void)
+{
+       _BEGIN;
+
+       static char *asmTok = NULL;
+       if (asmTok != NULL)
+               return asmTok;
+
+       char *mac = NULL;
+
+       bt_initialize();
+       bt_adapter_state_e btState;
+       bt_adapter_get_state(&btState);
+       if (btState == BT_ADAPTER_ENABLED) {
+               bt_adapter_get_address(&mac);
+               if (mac != NULL) {
+                       char *macClone = _SAFE_DUP(mac);
+                       _INFO("%s", macClone);
+                       std::string macStr(macClone);
+                       _INFO("%s", macStr.c_str());
+                       asmTok = strdup(macClone);
+                       return macStr;
+               }
+       } else {
+               /*TODO*/
+               _ERR("Failed to get any NW ID, using rand");
+               time_t t;
+               srand((unsigned) time(&t));
+               mac = (char*)calloc(128, sizeof(char));
+               snprintf(mac, 128 - 1, "%d", (rand()%1000 + 1));
+
+               char *macClone = _SAFE_DUP(mac);
+               _INFO("%s", macClone);
+               std::string macStr(macClone);
+               _INFO("%s", macStr.c_str());
+               asmTok = strdup(macClone);
+               return macStr;
+       }
+
+       FILE *file = fopen(ASM_CONFIG_FILE, "r");
+
+       if (file == NULL) {
+               _INFO("AsmCrypto::getAsmToken:: asm_config file is NULL");
+
+               connection_h conn = NULL;
+               connection_create(&conn);
+
+               char *mac = NULL;
+
+               /*Try: Ethernet*/
+               int ret = connection_get_mac_address(conn, CONNECTION_TYPE_ETHERNET, &mac);
+
+               /*Try: Wifi*/
+               if (ret != CONNECTION_ERROR_NONE)
+                       ret = connection_get_mac_address(conn, CONNECTION_TYPE_WIFI, &mac);
+
+               /*Try: BT*/
+               if (ret != CONNECTION_ERROR_NONE)
+                       ret = connection_get_mac_address(conn, CONNECTION_TYPE_BT, &mac);
+
+               if (ret != CONNECTION_ERROR_NONE) {
+                       _ERR("Failed to get any NW ID, using rand");
+                       time_t t;
+                       srand((unsigned) time(&t));
+                       mac = (char*)calloc(128, sizeof(char));
+                       snprintf(mac, 128 - 1, "%d", (rand()%1000 + 1));
+               }
+               file = fopen(ASM_CONFIG_FILE, "w+");
+               fwrite(mac, sizeof(char), strlen(mac), file);
+               fclose(file);
+
+               std::string tok(mac, strlen(mac));
+               _END;
+               asmTok = strdup(mac);
+               return tok;
+       }
+       else {
+               fseek(file, 0, SEEK_END);
+               long size = ftell(file);
+               if (size <= 0) {
+                       fclose(file);
+                       _END;
+                       return std::string();
+               }
+
+               fseek(file, 0, SEEK_SET);
+
+               char *config = (char*)(calloc(1, size + 1));
+               int num_bytes = fread(config, size, 1, file);
+               if (num_bytes <= 0) {
+                       free(config);
+                       fclose(file);
+                       _END;
+                       return std::string();
+               }
+
+               config[size] = '\0';
+
+               fclose(file);
+
+               std::string tok(config, strlen(config));
+               _END;
+               asmTok = strdup(config);
+               return tok;
+       }
+}
+
+std::string
+AsmCrypto::getKHAccessToken(std::string appId, bool isBound)
+{
+       _BEGIN;
+       std::string khA(appId);
+
+       if (isBound == true) {
+               khA += getAsmToken();
+               /*TODO: Replace with TLM/GUMD APIs to get the logged-in user id*/
+               /*khA += getuid();*/
+               khA += FIDO_CLIENT_CALLER_ID;
+       }
+
+       _INFO("AsmCrypto::getKHAccessToken:: KHA = [%s]", khA.c_str());
+
+       _END;
+       return khA;
+}
+
+int
+AsmCrypto::genRandom(unsigned char *random, int num)
+{
+       int ret;
+       ret = RAND_bytes(random, num);
+       if(ret != -1)
+       {
+               return 0;
+       }
+       else
+       {
+               return -1;
+       }
+}
+
+bool
+AsmCrypto::genHash256(const void* input, unsigned long length, unsigned char* md)
+{
+       SHA256_CTX context;
+       if(!SHA256_Init(&context))
+               return false;
+
+       if(!SHA256_Update(&context, (unsigned char*)input, length))
+               return false;
+
+       if(!SHA256_Final(md, &context))
+               return false;
+
+       return true;
+}
+
+int
+AsmCrypto::genRSAKeyPair(char *pubkey, char *prikey, const char *passwd, int keysize)
+{
+       return -1;
+}
+
+int
+AsmCrypto::genRSASignValue(const char *privkey, const char * passwd, const unsigned char * msg, unsigned int len, unsigned char *sign,unsigned int *signlen)
+{
+       return -1;
+}
+
+int
+AsmCrypto::genB64Encode(const unsigned char *input, int inlen, unsigned char * output, int *outlen)
+{
+#if 0
+       EVP_ENCODE_CTX ctx;
+       int t = 0;
+       EVP_EncodeInit(&ctx);
+       EVP_EncodeUpdate(&ctx, output,outlen,input,inlen);
+       EVP_EncodeFinal(&ctx,output + *outlen, &t);
+       *outlen += t -1;
+#else
+       BIO * bmem = NULL;
+       BIO * b64 = NULL;
+       BUF_MEM * bptr = NULL;
+       b64 = BIO_new(BIO_f_base64());
+       if(b64 == NULL)
+       {
+               _ERR("BIO_new failed \n");
+               return -1;
+       }
+       BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
+
+       bmem = BIO_new(BIO_s_mem());
+       b64 = BIO_push(b64, bmem);
+       BIO_write(b64, input, inlen);
+       BIO_flush(b64);
+       BIO_get_mem_ptr(b64, &bptr);
+
+       memcpy(output, bptr->data, bptr->length);
+       output[bptr->length] = 0;
+       *outlen = bptr->length;
+       if(b64)
+       {
+               BIO_free_all(b64);
+       }
+       //printf("outlen is %d, out is %s\n",*outlen, output);
+#endif
+       for(int i =0; i < *outlen ; i++)
+       {
+               if(output[i] == '+')
+               {
+                       output[i] = '-';
+               }
+               else if(output[i] == '/')
+               {
+                       output[i] = '_';
+               }
+               else if(output[i] == '=')
+               {
+                       *outlen = i ;
+                       output[i] = '\0';
+                       break;
+               }
+       }
+
+       _INFO("AsmCrypto::genB64Encode:: outlen = [%d]", *outlen);
+       return 0;
+}
+
+int
+AsmCrypto::genB64Decodes(const unsigned char *input, int inlen, unsigned char * output, int *outlen)
+{
+       _INFO("GenBase64Decode start");
+
+       _INFO("%s", input);
+       _INFO("input len = %d", inlen);
+
+       int npadChars = (inlen %4) == 0 ? 0 : (4 - (inlen%4));
+       unsigned char *base64 = (unsigned char *) malloc(inlen + npadChars);
+       if(base64 == NULL)
+       {
+               _ERR("malloc failed \n");
+               return -1;
+       }
+       memcpy(base64, input, inlen);
+       for(int i =0; i < inlen ; i++)
+       {
+               if(base64[i] == '-')
+               {
+                       base64[i] = '+';
+               }
+               else if(base64[i] == '_')
+               {
+                       base64[i] = '/';
+               }
+       }
+       if(npadChars != 0)
+       {
+               memset(base64 + inlen, '=', npadChars);
+       }
+       //printf("in 2 is :%s. %d\n",base64, inlen);
+
+       BIO * b64 = NULL;
+       BIO * bmem = NULL;
+       b64 = BIO_new(BIO_f_base64());
+       if(b64 == NULL)
+       {
+               free(base64);
+               _ERR("BIO_new failed");
+               return -1;
+       }
+       BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
+       bmem = BIO_new_mem_buf(base64, inlen + npadChars);
+       if(bmem == NULL)
+       {
+               _ERR("BIO_new_mem_buf failed");
+               BIO_free(b64);
+               free(base64);
+               return -1;
+       }
+       bmem = BIO_push(b64, bmem);
+       *outlen = BIO_read(bmem, output, inlen + npadChars);
+       if(*outlen <=0)
+       {
+               BIO_free(b64);
+               free(base64);
+               _ERR("BIO_read failed. size or data error");
+               return -1;
+       }
+       if(b64)
+       {
+               BIO_free_all(b64);
+       }
+
+       _INFO("%s", output);
+       _INFO("outlen len = %d", *outlen);
+
+       return 0;
+}
+
+int
+AsmCrypto::aesEncrypt(const unsigned char *plaintext, int plaintext_len, const unsigned char *key,
+                                                                        const unsigned char *iv, unsigned char *ciphertext)
+{
+       EVP_CIPHER_CTX *ctx;
+
+       int len;
+
+       int ciphertext_len;
+
+
+       if(!(ctx = EVP_CIPHER_CTX_new()))
+       {
+         _ERR("EVP_CIPHER_CTX_new() failed");
+         return -1;
+       }
+
+       if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv))
+       {
+         _ERR("EVP_EncryptInit_ex() failed");
+         return -1;
+       }
+
+       if(1 != EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, plaintext_len))
+       {
+         _ERR("EVP_EncryptUpdate() failed");
+         return -1;
+       }
+
+       ciphertext_len = len;
+
+       if(1 != EVP_EncryptFinal_ex(ctx, ciphertext + len, &len))
+       {
+         _ERR("EVP_EncryptFinal_ex() failed");
+         return -1;
+       }
+
+       ciphertext_len += len;
+
+       EVP_CIPHER_CTX_free(ctx);
+
+       return ciphertext_len;
+}
+
+int
+AsmCrypto::aesDecrypt(const unsigned char *ciphertext, int ciphertext_len, const unsigned char *key,
+                                                                        const unsigned char *iv, unsigned char *plaintext)
+{
+       _BEGIN;
+
+       EVP_CIPHER_CTX *ctx;
+
+       int len;
+
+       int plaintext_len;
+
+       if(!(ctx = EVP_CIPHER_CTX_new()))
+       {
+         _ERR("EVP_CIPHER_CTX_new() failed");
+         return -1;
+       }
+
+       if(1 != EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv))
+       {
+         _ERR("EVP_DecryptInit_ex() failed");
+         return -1;
+       }
+
+       if(1 != EVP_DecryptUpdate(ctx, plaintext, &len, ciphertext, ciphertext_len))
+       {
+         _ERR("EVP_DecryptUpdate() failed");
+         return -1;
+       }
+
+       plaintext_len = len;
+
+       if(1 != EVP_DecryptFinal_ex(ctx, plaintext + len, &len))
+       {
+         _ERR("EVP_DecryptFinal_ex() failed");
+         return -1;
+       }
+
+       plaintext_len += len;
+
+       EVP_CIPHER_CTX_free(ctx);
+
+       _END;
+       return plaintext_len;
+}
+
+int
+AsmCrypto::createRSAKeyPair(int ksz, char **pubkey, int *pubkey_len, char **prikey, int *prikey_len)
+{
+       _INFO("Modified CreateRSAKeyPair start");
+
+       EVP_PKEY_CTX *pctx = NULL;
+       EVP_PKEY *pkey = NULL;
+       RSA *rsa;
+
+       pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);
+       if (!pctx)
+               return -1;
+
+       _INFO("After EVP_PKEY_CTX_new_id");
+
+       EVP_PKEY_keygen_init(pctx);
+       _INFO("After EVP_PKEY_keygen_init");
+
+       EVP_PKEY_CTX_set_rsa_keygen_bits(pctx, ksz);
+
+       _INFO("After EVP_PKEY_CTX_set_rsa_keygen_bits");
+
+       EVP_PKEY_keygen(pctx, &pkey);
+       _INFO("After EVP_PKEY_keygen");
+
+       rsa = EVP_PKEY_get1_RSA(pkey);
+       _INFO("After EVP_PKEY_get1_RSA");
+
+
+       /*Private Key*/
+       BIO *bio_priv = BIO_new(BIO_s_mem());
+       PEM_write_bio_RSAPrivateKey(bio_priv, rsa, NULL, NULL, 0, NULL, NULL);
+       int keylen_priv = BIO_pending(bio_priv);
+       char *pem_key_priv = (char *)calloc(keylen_priv + 1, 1); /* Null-terminate */
+       BIO_read(bio_priv, pem_key_priv, keylen_priv);
+       _INFO("After Private key");
+
+       /*Public Key*/
+       BIO *bio_pub = BIO_new(BIO_s_mem());
+       PEM_write_bio_RSAPublicKey(bio_pub, rsa);
+
+       int keylen_pub = BIO_pending(bio_pub);
+       char *pem_key_pub = (char *)calloc(keylen_pub + 1, 1); /* Null-terminate */
+       BIO_read(bio_pub, pem_key_pub, keylen_pub);
+       _INFO("After Public key");
+
+       *pubkey = pem_key_pub;
+       *prikey = pem_key_priv;
+
+       *pubkey_len = keylen_pub;
+       *prikey_len = keylen_priv;
+
+       _INFO("CreateRSAKeyPair end");
+
+       return 0;
+}
+
+int
+AsmCrypto::createSha256Digest(const unsigned char *ip, int ip_len, char **op)
+{
+       unsigned char hash[SHA256_DIGEST_LENGTH];
+       SHA256_CTX sha256;
+       SHA256_Init(&sha256);
+       SHA256_Update(&sha256, ip, ip_len);
+       SHA256_Final(hash, &sha256);
+
+       char *op_temp = (char *) (calloc(1, (SHA256_DIGEST_LENGTH * 2) + 1));
+       int i = 0;
+       for(i = 0; i < SHA256_DIGEST_LENGTH; i++)
+       {
+               sprintf(op_temp + (i * 2), "%02x", hash[i]);
+       }
+
+       *op = op_temp;
+
+       return 0;
+}
+
+unsigned char*
+AsmCrypto::readDer(const char *der_file_name, int *len)
+{
+       _INFO("ReadDERCertFile start");
+
+       FILE *fp = fopen(der_file_name, "r");
+       if(fp == NULL)
+               return NULL;
+
+       X509 *pcert = NULL;
+       pcert = d2i_X509_fp(fp, NULL);
+       fclose(fp);
+
+       if (pcert == NULL)
+               return NULL;
+
+       _der_cert_s *cert = (_der_cert_s*)(calloc(1, sizeof(_der_cert_s)));
+
+       int ret = __load_cert_from_x509(pcert, &cert);
+       if(ret != 0) {
+               return NULL;
+       }
+
+       *len = cert->cert_size;
+
+       _INFO("ReadDERCertFile end");
+
+       return cert->raw_cert;
+}
+
+
+
+unsigned char*
+AsmCrypto::ToBase64Url(const unsigned char *input, int inputLen)
+{
+       _BEGIN;
+       if (input == NULL)
+               return NULL;
+
+       int inputSz = inputLen; //input.size();
+
+       _INFO("AsmCrypto::ToBase64Url::input size = [%d]", inputSz);
+
+       unsigned char* output = NULL;
+       //MALLOC(output, unsigned char, inputSz*1.5);
+
+       output = (unsigned char*)calloc(1, inputSz*1.5);
+
+       int outputSz = 0;
+
+       if (0 != AsmCrypto::genB64Encode(input,
+                                                                               inputSz,
+                                                                               output,
+                                                                               &outputSz))
+       {
+               _ERR("Failed to encode base64.");
+               free(output);
+               return (unsigned char*)"";
+       }
+
+       _INFO("AsmCrypto::ToBase64Url::output size = [%d]", outputSz);
+       _INFO("AsmCrypto::ToBase64Url::output = [%s]", output);
+
+       _END;
+       return output;
+}
+
+unsigned char*
+AsmCrypto::FromBase64Url(const unsigned char *input, int inputLen)
+{
+       _BEGIN;
+
+       int inputSz = inputLen;
+       unsigned char* output = NULL;
+
+       output = (unsigned char*)calloc(1, inputSz*1.5);
+       int outputSz = 0;
+
+       if (0 != AsmCrypto::genB64Decodes(input,
+                                                                               inputSz,
+                                                                               output,
+                                                                               &outputSz))
+       {
+               _ERR("Failed to decode base64.");
+               free(output);
+               return (unsigned char*)"";
+       }
+
+       _END;
+       return output;
+}
+
+#define        RSA_MAX_MES_LENGTH      128
+#define        RSA_MAX_SIGN_SIZE       512
+#define        RSA_MAX_BITS            4096
+#define        RSA_MAX_DGST_SIZE       64
+
+void hex2bin(const char *str, int str_len, void *mem)
+{
+       int i;
+       int len = str_len;
+       char byte[3];
+       char *M = (char *) mem;
+       byte[2] = 0;
+
+       for(i = 0; i < len; i+=2)
+       {
+               byte[0] = str[i];
+               byte[1] = str[i+1];
+               M[i/2] = strtoul(byte, NULL, 16);
+       }
+}
+
+int
+AsmCrypto::signWithRSAPSSMGF1(const char *message, int m_len,
+                                                         const char *privKeyFile, const char *pwd,
+                                                         unsigned char **signature, int *sig_len)
+{
+       _BEGIN;
+       int err_no;
+       unsigned int size;
+       unsigned int dgst_size;
+       unsigned char mess[RSA_MAX_MES_LENGTH];
+       unsigned char dgst[RSA_MAX_DGST_SIZE];
+       unsigned char tbs[RSA_MAX_SIGN_SIZE];
+       unsigned char *sig = (unsigned char *)calloc(1, sizeof(RSA_MAX_SIGN_SIZE));
+       //RSA *rsa = NULL;
+       /*BIGNUM * bn_pub_exp = NULL;*/
+       EVP_MD_CTX * mdctx = NULL;
+       const EVP_MD *md = NULL;
+
+       OpenSSL_add_all_algorithms();
+
+       FILE *fp;
+       EVP_PKEY *pkey = NULL;
+
+       fp = fopen(privKeyFile, "r");
+       if (fp == NULL)
+       {
+               _ERR("Failed to open private key file");
+               return -1;
+       }
+
+       pkey = PEM_read_PrivateKey(fp, &pkey, NULL, (void *)pwd);
+
+       fclose(fp);
+
+       if (pkey == NULL)
+       {
+               _ERR("PEM_read_PrivateKey failed");
+               return -1;
+       }
+
+       RSA *rsa = EVP_PKEY_get1_RSA(pkey);
+
+//     int bits = 256;
+
+//     if (bits > RSA_MAX_BITS)
+//     {
+//             err_no = -1;
+//             goto err;
+//     }
+
+       size = m_len / 2;
+//     if ( ((size) > RSA_MAX_MES_LENGTH) || ((size) > (bits/8)))
+//             return -1;
+
+       hex2bin(message, m_len, (void *)mess);
+
+//     if ( (bn_pub_exp = BN_new()) == NULL )
+//     {
+//             err_no = -1;
+//             goto err;
+//     }
+
+//     if(!BN_hex2bn(&bn_pub_exp, str_pub_exp))
+//     {
+//             err_no = -1;
+//             goto err;
+//     }
+
+       md = EVP_get_digestbynid(NID_sha256);
+       if(!md)
+       {
+               err_no = -1;
+               goto err;
+       }
+
+       mdctx = EVP_MD_CTX_create();
+       if ( !mdctx)
+       {
+               err_no = -1;
+               goto err;
+       }
+
+       EVP_DigestInit_ex(mdctx, md, NULL);
+       EVP_DigestUpdate(mdctx, mess, size);
+       EVP_DigestFinal_ex(mdctx, dgst, &dgst_size);
+       EVP_MD_CTX_destroy(mdctx);
+
+       /*rsa = RSA_new();
+       if(!rsa)
+       {
+               err_no = RSA_ERR;
+               goto err;
+       }
+       RSA_set_method(rsa, (const RSA_METHOD *)RSA_get_default_method());
+
+       err_no = RSA_generate_key_ex(rsa, bits, bn_pub_exp, NULL);
+       if (err_no <= 0)
+       {
+               err_no = RSA_ERR;
+               goto err;
+       }*/
+
+       if (!RSA_padding_add_PKCS1_PSS_mgf1(rsa, tbs, dgst, md, md, -2 /* */ ))
+       {
+               err_no = -1;
+               goto err;
+       }
+
+       err_no = RSA_private_encrypt(RSA_size(rsa), tbs, sig, rsa, RSA_NO_PADDING);
+       if(err_no < 0)
+       {
+               _INFO("ERR::RSA_private_encrypt");
+               err_no = -1;
+               goto err;
+       }
+
+       _INFO("SUCCESS::RSA_private_encrypt");
+//     err_no = RSA_public_decrypt(RSA_size(rsa), sig, tbs, rsa, RSA_NO_PADDING);
+//     if (err_no <= 0)
+//     {
+//             err_no = RSA_ERR;
+//             goto err;
+//     }
+//     err_no = RSA_verify_PKCS1_PSS_mgf1(rsa, dgst, md, md, tbs, -2);
+//     if (err_no <= 0)
+//     {
+//             err_no = RSA_ERR;
+//             goto err;
+//     }
+
+       *signature = sig;
+       *sig_len = 256;
+
+       err_no = 0;
+
+err:
+
+//     if(rsa) RSA_free(rsa);
+//     if(bn_pub_exp) BN_free(bn_pub_exp);
+
+       return err_no;
+}
+
+int
+AsmCrypto::digestSignRSAPSSMGF1(const char *message, int m_len,
+                                                                 const char *privKeyFile, const char *pwd,
+                                                                 unsigned char **signature, int *sig_len)
+{
+
+       OpenSSL_add_all_algorithms();
+
+       FILE *fp;
+       EVP_PKEY *privKey = NULL;
+
+       fp = fopen(privKeyFile, "r");
+       if (fp == NULL)
+       {
+               _ERR("Failed to open private key file");
+               return -1;
+       }
+
+       privKey = PEM_read_PrivateKey(fp, &privKey, NULL, (void *)pwd);
+
+       fclose(fp);
+
+       if (privKey == NULL) {
+               _ERR("PEM_read_PrivateKey failed");
+               return -1;
+       }
+
+       EVP_MD_CTX *mdctx = EVP_MD_CTX_create();
+
+       EVP_PKEY_CTX *pctx = NULL;
+
+       // Create the Message Digest Context
+
+       if(EVP_SUCCESS != EVP_DigestSignInit(mdctx, &pctx, EVP_sha256(), NULL, privKey)) {
+                _ERR("EVP_DigestSignInit failed");
+                return -1;
+       }
+
+       /* Set padding algorithm */
+       if(EVP_SUCCESS != EVP_PKEY_CTX_set_rsa_padding(pctx, RSA_PKCS1_PSS_PADDING)) {
+               _ERR("EVP_PKEY_CTX_set_rsa_padding failed");
+               return -1;
+       }
+       if (EVP_SUCCESS != EVP_PKEY_CTX_set_rsa_pss_saltlen(pctx, 32)) {
+               _ERR("EVP_PKEY_CTX_set_rsa_pss_saltlen failed");
+               return -1;
+       }
+       _INFO("After EVP_PKEY_CTX_set_rsa_pss_saltlen with 32");
+
+       /* Set masking */
+       if(EVP_SUCCESS != EVP_PKEY_CTX_set_rsa_mgf1_md(pctx, EVP_sha256())) {
+               _ERR("EVP_PKEY_CTX_set_rsa_padding failed");
+               return -1;
+       }
+
+       /* Call update with the message */
+       if(EVP_SUCCESS != EVP_DigestSignUpdate(mdctx, message, m_len)) {
+                _ERR("EVP_DigestSignUpdate failed");
+                return -1;
+       }
+
+       /* Finalize the DigestSign operation */
+       /* First call EVP_DigestSignFinal with a NULL sig parameter to obtain the length of the
+       * signature. Length is returned in slen */
+       size_t slen;
+       if(EVP_SUCCESS != EVP_DigestSignFinal(mdctx, NULL, &slen)) {
+                _ERR("EVP_DigestSignFinal failed");
+                return -1;
+       }
+
+       /* Allocate memory for the signature based on size in slen */
+       unsigned char *sig = (unsigned char *)calloc(1, slen);
+       //int slen = 0;
+
+       /* Obtain the signature */
+       if(EVP_SUCCESS != EVP_DigestSignFinal(mdctx, sig, &slen)) {
+                _ERR("EVP_DigestSignFinal failed");
+                return -1;
+       }
+
+       *signature = sig;
+       *sig_len = slen;
+       return 0;
+}
+
+typedef struct _certHandle
+{
+       char *b64_hash_pubKey;
+       char *pkgId;
+} certHandle;
+
+static char*
+__b64_encode(unsigned char *input, int ip_len)
+{
+       RET_IF_FAIL(input != NULL, NULL);
+       RET_IF_FAIL(ip_len > 0, NULL);
+
+       unsigned char *output = (unsigned char*)calloc(ip_len * 1.5, sizeof(char));
+
+       BIO *bmem = NULL;
+       BIO *b64 = NULL;
+       BUF_MEM *bptr = NULL;
+       b64 = BIO_new(BIO_f_base64());
+       if (b64 == NULL) {
+               _ERR("BIO_new failed \n");
+               free(output);
+               return NULL;
+       }
+
+       BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
+
+       bmem = BIO_new(BIO_s_mem());
+       b64 = BIO_push(b64, bmem);
+       BIO_write(b64, input, ip_len);
+       BIO_flush(b64);
+       BIO_get_mem_ptr(b64, &bptr);
+
+       memcpy(output, bptr->data, bptr->length);
+       output[bptr->length] = 0;
+
+       if (b64)
+               BIO_free_all(b64);
+
+       return (char*)output;
+}
+
+static int
+__b64_decode(const char *encoded_data, int encoded_size, unsigned char **decoded_data, int *decoded_size)
+{
+       RET_IF_FAIL(encoded_data != NULL, -1);
+
+       //_INFO("%s", encoded_data);
+
+       int len = 0;
+       *decoded_size = encoded_size;
+
+       (*decoded_data) = (unsigned char *) calloc((*decoded_size) * 1.5, sizeof(char));
+
+       BIO *bmem = BIO_new_mem_buf((void *) encoded_data, (*decoded_size));
+
+       BIO *bioCmd = BIO_new(BIO_f_base64());
+
+       BIO_set_flags(bioCmd, BIO_FLAGS_BASE64_NO_NL);
+
+       bmem = BIO_push(bioCmd, bmem);
+
+       len = BIO_read(bmem, (void *) (*decoded_data), (*decoded_size));
+       _INFO("%d", len);
+
+       *decoded_size = len;
+
+       BIO_free_all(bmem);
+
+       _INFO("");
+
+       return 0;
+}
+
+static char*
+__get_pub_key_from_cert(const char *cert_b64)
+{
+       RET_IF_FAIL(cert_b64 != NULL, NULL);
+
+       unsigned char pubkey_der_digest[SHA256_DIGEST_LENGTH] = {0, };
+
+       unsigned char* cert_raw = NULL;//calloc(strlen(cert_b64) * 1.5, sizeof(char));
+
+       int cert_raw_len = 0;
+
+       int ret = __b64_decode(cert_b64, strlen(cert_b64), &cert_raw, &cert_raw_len);
+       if (ret != 0) {
+               _ERR("__b64_decode failed");
+               free(cert_raw);
+
+               return NULL;
+       }
+
+       X509 *x509 = d2i_X509(NULL, (const unsigned char **)(&cert_raw), cert_raw_len);
+       if (x509 == NULL) {
+               _ERR("d2i_X509 failed");
+               free(cert_raw);
+               return NULL;
+       }
+
+       int der_len = i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x509), NULL);
+       if (der_len <= 0) {
+               _ERR("i2d_X509_PUBKEY failed");
+               free(cert_raw);
+               return NULL;
+       }
+
+       unsigned char* der_pubkey  = NULL;
+
+       unsigned char* der_pubkey_temp = NULL;
+
+       int hashed_len = 0;
+
+       der_pubkey_temp = der_pubkey = (unsigned char*)OPENSSL_malloc(der_len);
+
+       i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x509), (unsigned char **)&der_pubkey_temp);
+
+       ret = EVP_Digest(der_pubkey, der_len, pubkey_der_digest, (unsigned int*)&hashed_len, EVP_sha256(), NULL);
+
+       if (ret != 1) {
+               _ERR("EVP_Digest failed");
+               OPENSSL_free(der_pubkey);
+
+               return NULL;
+       }
+
+       char *pub_key =  __b64_encode(pubkey_der_digest, (int)hashed_len);
+
+       OPENSSL_free(der_pubkey);
+
+       return pub_key;
+}
+
+int
+AsmCrypto::onPkgList(pkgmgrinfo_pkginfo_h handle, void *user_data)
+{
+       certHandle *certInfo = (certHandle*)user_data;
+       RET_IF_FAIL(certInfo != NULL, 0);
+
+       char *b64_hash_pubkey = NULL;
+       char *pkgid = NULL;
+       b64_hash_pubkey = certInfo->b64_hash_pubKey;
+
+       int ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
+       if (ret != PMINFO_R_OK) {
+
+               _ERR("pkgmgrinfo_pkginfo_get_pkgid failed [%d]", ret);
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               return 0;
+       }
+
+       _INFO("pkgmgrinfo_pkginfo_get_pkgid success");
+
+       pkgmgrinfo_certinfo_h cert_handle = NULL;
+       const char *author_cert = NULL;
+       ret = pkgmgrinfo_pkginfo_create_certinfo(&cert_handle);
+       if (ret != PMINFO_R_OK) {
+               _ERR("");
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               return 0;
+       }
+
+       _INFO("pkgmgrinfo_pkginfo_create_certinfo success");
+
+       /*TODO implement getUid function*/
+       ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, cert_handle, uid);
+
+
+       if (ret != PMINFO_R_OK) {
+               _ERR("");
+               pkgmgrinfo_pkginfo_destroy_certinfo(cert_handle);
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               return 0;
+       }
+
+       _INFO("pkgmgrinfo_pkginfo_load_certinfo success");
+
+       ret = pkgmgrinfo_pkginfo_get_cert_value(cert_handle, PMINFO_AUTHOR_SIGNER_CERT, &author_cert);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_destroy_certinfo(cert_handle);
+               _ERR("");
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               return 0;
+       }
+
+       /*_INFO("Author Root Cert=%s", author_cert);*/
+
+       _INFO("pkgmgrinfo_pkginfo_get_cert_value success");
+
+       char *author_cert_hash = NULL;
+       char *tz_facet_id = NULL;
+       int tz_facet_id_max_len = -1;
+
+
+       author_cert_hash = __get_pub_key_from_cert(author_cert);
+       _INFO("");
+       if(author_cert_hash == NULL)
+               return 0;
+
+       tz_facet_id_max_len = strlen(author_cert_hash) + 128;
+       tz_facet_id = (char*)(calloc(1, tz_facet_id_max_len));
+       snprintf(tz_facet_id, tz_facet_id_max_len - 1, "%s:%s", "tizen:pkg-key-hash",
+                        author_cert_hash);
+       _INFO("");
+
+       if (strcmp(b64_hash_pubkey, tz_facet_id) == 0) {
+               _INFO("[%s]", pkgid);
+               certInfo->pkgId = _SAFE_DUP(pkgid);
+               _INFO("return");
+
+               pkgmgrinfo_pkginfo_destroy_certinfo(cert_handle);
+               /*pkgmgrinfo_pkginfo_destroy_pkginfo(handle);*/
+
+               return -1;
+       } else {
+               return 0;
+       }
+
+       _INFO("Before return");
+
+       pkgmgrinfo_pkginfo_destroy_certinfo(cert_handle);
+       /*pkgmgrinfo_pkginfo_destroy_pkginfo(handle);*/
+       _INFO("");
+}
+
+char*
+AsmCrypto::getAppId(char *appIdPubKey)
+{
+       int ret = -1;
+
+       certHandle *certInfo = (certHandle*)calloc(1, sizeof(certHandle));
+       certInfo->b64_hash_pubKey = _SAFE_DUP(appIdPubKey);
+
+       /*TODO implement getUid function*/
+       _INFO("");
+       ret = pkgmgrinfo_pkginfo_get_list(AsmCrypto::onPkgList, (void *)certInfo);
+       if (ret != PMINFO_R_OK) {
+               _ERR("");
+               return NULL;
+       }
+
+       if(certInfo->pkgId != NULL)
+               _INFO("AsmCrypto::getAppId:: pkgId = [%s]", certInfo->pkgId);
+       else {
+               _INFO("AsmCrypto::getAppId:: pkgId NULL");
+               /*TODO For requests coming from remote device, we can not use pkgmgr to
+               * find out App-Id, instead Client Device's ASM must send it explicitly
+               */
+               char *appIdRemote = (char*)calloc(128, sizeof(char));
+               snprintf(appIdRemote, 127, "%s", "Remote Device");
+               return appIdRemote;
+       }
+       return certInfo->pkgId;
+}
+
+unsigned char*
+AsmCrypto::signRSA(const unsigned char *m, unsigned char *pri_key)
+{
+       _BEGIN;
+
+       BIO *bio = NULL;
+       RSA *rsa = NULL;
+       unsigned int sign_len = 0;
+       unsigned char *sign = NULL;
+
+       //int ret = -1;
+
+       OpenSSL_add_all_algorithms();
+       bio = BIO_new_mem_buf(pri_key, -1);
+       if(bio == NULL)
+       {
+               _ERR("BIO_new_mem_buf failed");
+               goto error;
+       }
+
+       rsa = PEM_read_bio_RSAPrivateKey(bio, NULL, NULL, NULL);
+       if(rsa == NULL)
+       {
+               _ERR("BIO_new_mem_buf failed");
+               goto error;
+       }
+//    if(len > (unsigned int)RSA_size(rsa))
+//    {
+//        _ERR("msg is too long failed");
+//        goto error;
+//    }
+
+       sign = (unsigned char *)calloc(1, (1024*128));
+       if(RSA_sign(NID_sha1, m, strlen((char *)m), sign, &sign_len, rsa) != 1)
+       {
+               _ERR("msg is too long failed \n");
+               goto error;
+       }
+
+       _END;
+       return sign;
+
+error:
+       if(rsa)
+       {
+               RSA_free(rsa);
+               rsa = NULL;
+       }
+       if(bio)
+       {
+               BIO_free(bio);
+               bio = NULL;
+       }
+       return NULL;
+}
+
+unsigned char*
+AsmCrypto::fidoSignWithKey(const unsigned char *msg, int msg_len,
+                                                                                 const unsigned char *private_key,
+                                                  int priv_key_len, int *sig_len)
+{
+       _INFO("fidoSignWithKey start");
+       OpenSSL_add_all_algorithms();
+
+       _INFO("FIDO MGF1 PSS padding:");
+
+       BIO *bio = NULL;
+       RSA *rsa = NULL;
+
+       _INFO("");
+       bio = BIO_new_mem_buf((unsigned char *)private_key, priv_key_len);
+       if (bio == NULL) {
+               _ERR("BIO_new_mem_buf failed");
+               return NULL;
+       }
+
+       _INFO("");
+       rsa = PEM_read_bio_RSAPrivateKey(bio, NULL, NULL, NULL);
+       if(rsa == NULL) {
+               _ERR("BIO_new_mem_buf failed");
+               return NULL;
+       }
+
+       _INFO("");
+
+       EVP_PKEY *pkey = EVP_PKEY_new();
+
+       _INFO("");
+       int ret = EVP_PKEY_set1_RSA(pkey, rsa);
+       _INFO("EVP_PKEY_set1_RSA = [%d]", ret);
+       if (ret == 0) {
+               _ERR("EVP_PKEY_set1_RSA failed");
+               return NULL;
+       }
+
+
+
+       EVP_MD_CTX *mdctx = NULL;
+
+       mdctx = EVP_MD_CTX_create();
+       if (mdctx == NULL) {
+                _ERR("EVP_MD_CTX_create failed");
+
+                return NULL;
+       }
+
+       EVP_PKEY_CTX *pctx = NULL;
+       ret = EVP_DigestSignInit(mdctx, &pctx, EVP_sha256(), NULL, pkey);
+       _INFO("EVP_DigestSignInit=[%d]", ret);
+
+       ret = EVP_PKEY_CTX_set_rsa_padding(pctx, RSA_PKCS1_PSS_PADDING);
+       _INFO("EVP_PKEY_CTX_set_rsa_padding=[%d]", ret);
+       EVP_PKEY_CTX_set_rsa_mgf1_md(pctx, EVP_sha256());
+       EVP_PKEY_CTX_set_rsa_pss_saltlen(pctx, 32);
+
+       EVP_DigestSignUpdate(mdctx, msg, msg_len);
+
+       size_t sig_len_loc = 0;
+       EVP_DigestSignFinal(mdctx, NULL, &sig_len_loc);
+       unsigned char *sig = (unsigned char *)OPENSSL_malloc(sizeof(unsigned char) * (sig_len_loc));
+       EVP_DigestSignFinal(mdctx, sig, &sig_len_loc);
+
+       *sig_len = sig_len_loc;
+       return sig;
+
+}
+
+unsigned char*
+AsmCrypto::fidoSign(const unsigned char *msg, int msg_len, const char *private_key_file,
+                                       const char *pwd, int *sig_len)
+{
+       _INFO("SignWithPrivateKeyFile start [%s]", private_key_file);
+       OpenSSL_add_all_algorithms();
+
+       FILE *fp;
+       EVP_PKEY *pkey = NULL;
+
+       fp = fopen(private_key_file, "r");
+       if (fp == NULL) {
+               _ERR("Failed to open private key file");
+               return NULL;
+       }
+
+       pkey = PEM_read_PrivateKey(fp, &pkey, NULL, (void *)pwd);
+
+       fclose(fp);
+
+       if (pkey == NULL) {
+               return NULL;
+       }
+
+       //RSA *pRsaKey = EVP_PKEY_get1_RSA(pkey);
+
+       _INFO("FIDO MGF1 PSS padding:");
+
+       EVP_MD_CTX *mdctx = NULL;
+
+       mdctx = EVP_MD_CTX_create();
+       if (mdctx == NULL) {
+                _ERR("EVP_MD_CTX_create failed");
+
+                return NULL;
+       }
+
+       EVP_PKEY_CTX *pctx = NULL;
+       int ret = EVP_DigestSignInit(mdctx, &pctx, EVP_sha256(), NULL, pkey);
+       _INFO("EVP_DigestSignInit=[%d]", ret);
+
+       ret = EVP_PKEY_CTX_set_rsa_padding(pctx, RSA_PKCS1_PSS_PADDING);
+       _INFO("EVP_PKEY_CTX_set_rsa_padding=[%d]", ret);
+       EVP_PKEY_CTX_set_rsa_mgf1_md(pctx, EVP_sha256());
+       EVP_PKEY_CTX_set_rsa_pss_saltlen(pctx, 32);
+
+       EVP_DigestSignUpdate(mdctx, msg, msg_len);
+
+       size_t sig_len_loc = 0;
+       EVP_DigestSignFinal(mdctx, NULL, &sig_len_loc);
+       unsigned char *sig = (unsigned char *)OPENSSL_malloc(sizeof(unsigned char) * (sig_len_loc));
+       EVP_DigestSignFinal(mdctx, sig, &sig_len_loc);
+
+       *sig_len = sig_len_loc;
+       return sig;
+}
diff --git a/common/datatypes/auth/AuthnrTypes.h b/common/datatypes/auth/AuthnrTypes.h
new file mode 100644 (file)
index 0000000..887a477
--- /dev/null
@@ -0,0 +1,403 @@
+/*
+ * Copyright (c) 2014 - 2015 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 __AUTHNR_TYPES_H__
+#define __AUTHNR_TYPES_H__
+
+#include <tizen.h>
+#include <string>
+#include <glib.h>
+#include <vector>
+#include <stdint.h>
+
+#define AUTH_TYPE_HAS_SETTINGS 0x0010
+
+typedef enum
+{
+       UAF_CMD_STATUS_OK = 0x00,
+       UAF_CMD_STATUS_ERR_UNKNOWN = 0x01,
+       UAF_CMD_STATUS_ACCESS_DENIED = 0x02,
+       UAF_CMD_STATUS_USER_NOT_ENROLLED = 0x03,
+       UAF_CMD_STATUS_CANNOT_RENDER_TRANSACTION_CONTENT = 0x04,
+       UAF_CMD_STATUS_USER_CANCELLED = 0x05,
+       UAF_CMD_STATUS_CMD_NOT_SUPPORTED = 0x06,
+       UAF_CMD_STATUS_ATTESTATION_NOT_SUPPORTED = 0x07
+}UAF_AUTHNR_STATUS_CODE;
+
+typedef enum {
+       TLV_ASSRT_TYPE_REG,
+       TLV_ASSRT_TYPE_AUTH
+} tlv_assertion_type_e;
+
+/** Authenticator algorithms */
+typedef enum
+{
+       UAF_ALG_SIGN_SECP256R1_ECDSA_SHA256_RAW = 0x01,
+       UAF_ALG_SIGN_SECP256R1_ECDSA_SHA256_DER = 0x02,
+       UAF_ALG_SIGN_RSASSA_PSS_SHA256_RAW = 0x03,
+       UAF_ALG_SIGN_RSASSA_PSS_SHA256_DER = 0x04,
+       UAF_ALG_SIGN_SECP256K1_ECDSA_SHA256_RAW = 0x05,
+       UAF_ALG_SIGN_SECP256K1_ECDSA_SHA256_DER = 0x06
+}AUTHENTICATOR_ALGORITHM;
+
+/** Public key representation format */
+typedef enum
+{
+       UAF_ALG_KEY_ECC_X962_RAW = 0x100,
+       UAF_ALG_KEY_ECC_X962_DER = 0x101,
+       UAF_ALG_KEY_RSA_2048_PSS_RAW = 0x102,
+       UAF_ALG_KEY_RSA_2048_PSS_DER = 0x103,
+}PUBLIC_KEY_FORMAT;
+
+typedef enum
+{
+       AUTHNR_2ND_FACTOR = 0x0001,
+       AUTHNR_ROAMING = 0x0002,
+       AUTHNR_STORE_KEYHANDLES_INSIDE = 0x0004,
+       AUTHNR_HAS_BUILTIN_ENROLL_VERIFY_UI = 0x0008,
+       AUTHNR_HAS_BUILTIN_SETTINGS_UI = 0x0010,
+       AUTHNR_REQUIRE_TAG_APPID = 0x0020,
+       AUTHNR_AT_LEAST_ONE_USER_ENROLLED = 0x0040
+}AUTHENTICATOR_TYPE;
+
+typedef enum
+{
+       USER_VERIFY_PRESENCE = 0x01,
+       USER_VERIFY_FINGERPRINT = 0x02,
+       USER_VERIFY_PASSCODE = 0x04,
+       USER_VERIFY_VOICEPRINT = 0x08,
+       USER_VERIFY_FACEPRINT = 0x10,
+       USER_VERIFY_LOCATION = 0x20,
+       USER_VERIFY_EYEPRINT = 0x40,
+       USER_VERIFY_PATTERN = 0x80,
+       USER_VERIFY_HANDPRINT = 0x100,
+       USER_VERIFY_NONE = 0x200,
+       USER_VERIFY_ALL = 0x400
+}USER_VERIFICATION_METHOD;
+
+typedef enum
+{
+       KEY_PROTECTION_SOFTWARE = 0x01,
+       KEY_PROTECTION_HARDWARE = 0x02,
+       KEY_PROTECTION_TEE = 0x04,
+       KEY_PROTECTION_SECURE_ELEMENT = 0x08,
+       KEY_PROTECTION_REMOTE_HANDLE = 0x10
+}KEY_PROTECTION_TYPE;
+
+/** Matcher protection types */
+typedef enum
+{
+       MATCHER_PROTECTION_SOFTWARE = 0x01,
+       MATCHER_PROTECTION_TEE = 0x02,
+       MATCHER_PROTECTION_ON_CHIP = 0x04
+}MATCHER_PROTECTION_TYPE;
+
+typedef enum
+{
+       TRANSACTION_CONFIRMATION_DISPLAY_ANY = 0x01,
+       TRANSACTION_CONFIRMATION_DISPLAY_PRIVILEGED_SOFTWARE = 0x02,
+       TRANSACTION_CONFIRMATION_DISPLAY_TEE = 0x04,
+       TRANSACTION_CONFIRMATION_DISPLAY_HARDWARE = 0x08,
+       TRANSACTION_CONFIRMATION_DISPLAY_REMOTE = 0x10
+}TRANSACTION_CONFIRMATION_DISPLAY_TYPE;
+
+typedef enum {
+       ATTACHMENT_HINT_INTERNAL = 0x01,
+       ATTACHMENT_HINT_EXTERNAL = 0x02,
+       ATTACHMENT_HINT_WIRED = 0x04,
+       ATTACHMENT_HINT_WIRELESS = 0x08,
+       ATTACHMENT_HINT_NFC = 0x10,
+       ATTACHMENT_HINT_BLUETOOTH = 0x20,
+       ATTACHMENT_HINT_NETWORK = 0x40,
+       ATTACHMENT_HINT_READY = 0x80,
+       ATTACHMENT_HINT_WIFI_DIRECT = 0x100
+} attachment_hint_e;
+
+
+typedef struct _Buffer {
+       unsigned int len;
+       uint8_t *data;
+} Buffer;
+
+/*Plugin symbol handlers*/
+typedef int (*plugin_init)(void);/*fido_auth_plugin_init*/
+typedef bool (*plugin_is_connected)(void);/*fido_auth_plugin_is_connected*/
+typedef attachment_hint_e (*plugin_get_attachment_hint)(void);/*fido_auth_plugin_get_attachment_hint*/
+typedef char* (*plugin_get_title)(void);/*fido_auth_plugin_get_title*/
+typedef char* (*plugin_get_description)(void);/*fido_auth_plugin_get_description*/
+typedef int (*plugin_de_init)(void);/*fido_auth_plugin_de_init*/
+
+typedef struct _plugin_conn_handle_s {
+       plugin_init init;
+       plugin_is_connected is_connected;
+       plugin_get_attachment_hint attach_hint;
+       plugin_get_title title;
+       plugin_get_description description;
+       plugin_de_init de_init;
+} plugin_conn_handle_s;
+
+
+typedef int (*plugin_get_assertion_scheme)(char **scheme);/*fido_auth_plugin_get_assertion_scheme*/
+typedef Buffer* (*plugin_encode_assertion)(int tag, const void *data);/*fido_auth_plugin_encode_assertion*/
+typedef void* (*plugin_decode_assertion)(unsigned char *assrt);/*fido_auth_plugin_decode_assertion*/
+
+typedef struct _plugin_assrt_handle_s {
+       plugin_get_assertion_scheme get_scheme;
+       plugin_encode_assertion encode;
+       plugin_decode_assertion decode;
+} plugin_assrt_handle_s;
+
+
+typedef int (*plugin_fido_command_process)(unsigned char *assert_req,
+                                                                                  unsigned char **assrt_resp);/*fido_auth_plugin_command_process*/
+
+typedef struct _plugin_process_handle_s {
+       plugin_fido_command_process process;
+} plugin_process_handle_s;
+
+
+typedef int (*plugin_is_uv_required)(void);/*fido_auth_plugin_is_uv_required*/
+typedef int (*plugin_is_enrolled)(const char *args);/*fido_auth_plugin_is_enrolled*/
+typedef int (*plugin_enroll)(const char *args);/*fido_auth_plugin_enroll*/
+typedef int (*plugin_verify)(const char *opt, const char *fch, char **verif_token);/*fido_auth_plugin_verify*/
+
+typedef struct _plugin_user_op_handle_s {
+       plugin_is_uv_required is_uv_reqd;
+       plugin_is_enrolled is_enrolled;
+       plugin_enroll enroll;
+       plugin_verify verify;
+} plugin_user_op_handle_s;
+
+
+typedef int (*plugin_hash)(const char *ip, char **op);/*fido_auth_plugin_hash*/
+
+typedef struct _plugin_hash_handle_s {
+       plugin_hash hash;
+} plugin_hash_handle_s;
+
+
+typedef struct _transaction_s {
+       char *tr;/*TODO*/
+} transaction_s;
+
+typedef int (*plugin_confirm_account)(GList *acc_list, char **selected_acc);/*fido_auth_plugin_confirm_account*/
+typedef int (*plugin_confirm_tc)(const transaction_s *tr);/*fido_auth_plugin_confirm_tc*/
+
+typedef struct _plugin_ui_op_handle_s {
+       plugin_confirm_account confirm_account;
+       plugin_confirm_tc confirm_tc;
+} plugin_ui_op_handle_s;
+
+
+
+typedef struct _auth_plugin_handle_s {
+       plugin_conn_handle_s *conn;
+       plugin_assrt_handle_s *assrt;
+       plugin_process_handle_s *process;
+       plugin_user_op_handle_s *user;
+       plugin_hash_handle_s *hash;
+       plugin_ui_op_handle_s *ui;
+       int id;
+} auth_plugin_handle_s;
+
+/**
+ * https://fidoalliance.org/specs/fido-uaf-v1.0-ps-20141208/fido-uaf-authnr-cmds-v1.0-ps-20141208.html#getinfo-command
+ */
+typedef struct _GetInfoReq {
+       int tag;
+} GetInfoReq;
+
+typedef struct _GetAuthInfoResp {
+       int statusCode;
+       int apiVersion;
+       GList *authList;/*List of AuthenticatorInfo */
+       /*Below members are not returned by the GetInfo authenticator commands, they are filled later*/
+       attachment_hint_e attach_hint;
+       char *title;
+       char *description;
+       char *icon;
+
+} GetAuthInfoResp;
+
+/*
+ * https://fidoalliance.org/specs/fido-uaf-v1.0-ps-20141208/fido-uaf-authnr-cmds-v1.0-ps-20141208.html#register-command
+ */
+typedef struct _RegisterReq {
+       int authIdx;
+       char *appId;
+       Buffer *fch;
+       char *userName;
+       int attType;
+       Buffer *khAccessToken;
+       char *userVToken;
+} RegisterReq;
+
+/*
+ * https://fidoalliance.org/specs/fido-uaf-v1.0-ps-20141208/fido-uaf-authnr-cmds-v1.0-ps-20141208.html#command-structure-2
+ */
+typedef struct _AuthenticateReq {
+
+       int authIdx;
+       char *appId;
+       Buffer *fch;
+       char *tc;
+       Buffer *khATok;
+       char *userVToken;
+       GList *khHList;/*List of char* */
+
+} AuthenticateReq;
+
+/*
+ * https://fidoalliance.org/specs/fido-uaf-v1.0-ps-20141208/fido-uaf-authnr-cmds-v1.0-ps-20141208.html#command-structure-3
+ */
+typedef struct _DeregReq {
+       int authIdx;
+       char *appId;
+       char *keyId;
+       Buffer *khATok;
+} DeregReq;
+
+typedef struct _AssertionInfo {
+       int authVersion;
+       int authMode;
+       int signatureAlgAndEncoding;
+       int publicKeyAlgAndEncoding;
+} AssertionInfo;
+
+typedef struct _Counters {
+       int regCounter;
+       int signCounter;
+} Counters;
+
+typedef struct _Krd {
+       char *aaid;
+       AssertionInfo *assrtInfo;
+       Buffer *fch;
+       Buffer *keyId;
+       Counters *counter;
+       Buffer *pubKey;
+} Krd;
+
+typedef struct _AttestationBasicFull {
+       Buffer *sig;
+       Buffer *cert;
+} AttestationBasicFull;
+
+typedef struct _AttestationBasicSurrogate {
+       Buffer *sig;
+} AttestationBasicSurrogate;
+
+typedef struct _RegAssertion {
+       Krd *krd;
+       /*Only one of them can be valid, other must be set null*/
+       AttestationBasicFull *attFull;
+       AttestationBasicSurrogate *attSur;
+} RegAssertion;
+
+typedef struct _RegisterResp {
+       int statusCode;
+       RegAssertion *regAssertion;
+       Buffer *kh;
+} RegisterResp;
+
+typedef struct _UserNameKeyHandle {
+       char *userName;
+       Buffer *kh;
+} UserNameKeyHandle;
+
+typedef struct _SigData {
+       char *aaid;
+       AssertionInfo *assrtInfo;
+       Buffer *authNonce;
+       Buffer *fch;
+       Buffer *tcHash;
+       Buffer *keyId;
+       Counters *counter;
+} SigData;
+
+typedef struct __AuthAssertion {
+       SigData *sigData;
+       Buffer *sig;
+} AuthAssertion;
+
+typedef struct _AuthenticateResp {
+       int statusCode;
+       GList *uKhList; /*List of UserNameKeyHandle*/
+       AuthAssertion *authAssertion;
+} AuthenticateResp;
+
+typedef struct _DeregResp {
+       int statusCode;
+} DeregResp;
+
+
+typedef struct _AuthnrMetaData {
+
+       int authenticatorType;
+       int maxKeyHandles;
+       int userVerification;
+       int keyProtection;
+       int matcherProtection;
+       int transactionConfirmationDisplay;
+       int authenticationAlg;
+} AuthenticatorMetaData;
+
+/*
+ * https://fidoalliance.org/specs/fido-uaf-v1.0-ps-20141208/fido-uaf-asm-api-v1.0-ps-20141208.html#dictionary-authenticatorinfo-members
+ */
+typedef struct __DisplayTc {
+
+       int width;
+       int height;
+       int bitDepth;
+       int colorType;
+       int compression;
+       int filter;
+       int interlace;
+       char *plte;
+} DisplayTc;
+
+typedef struct _AuthnrInfo {
+       char *__devId;
+       int __authenticatorIndex;
+       char *__aaid;
+       bool __isSecondFactorOnly;
+       bool __isRoamingAuthenticator;
+       bool __isUserEnrolled;
+       AuthenticatorMetaData *__meta;
+       char *__tcDispConType;
+       GList *__tcDisplayPNGCharacteristics;/*DisplayTc list*/
+       char *__assertionScheme;
+       GList *__attestationTypes;/*int list*/
+       GList *__extList;/*string list*/
+} AuthenticatorInfo;
+
+typedef enum {
+       UAF_ASM_STATUS_OK = 0x00,
+       UAF_ASM_STATUS_ERROR = 0x01,
+       UAF_ASM_STATUS_ACCESS_DENIED = 0x02,
+       UAF_ASM_STATUS_USER_CANCELLED = 0x03
+} uaf_asm_status_e;
+
+typedef enum {
+       AUTH_TYPE_BOUND,
+       AUTH_TYPE_ROAMING,
+       AUTH_TYPE_ALL
+} auth_type_e;
+
+#endif /*__AUTHNR_TYPES_H__*/
+
diff --git a/common/datatypes/inc/AsmAuthRequest.h b/common/datatypes/inc/AsmAuthRequest.h
new file mode 100644 (file)
index 0000000..03456e9
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2014 - 2015 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 __ASM_AUTH_REQ_H__
+#define __ASM_AUTH_REQ_H__
+
+#include <string>
+#include <vector>
+
+class DisplayChar;
+
+class Transaction {
+
+public:
+       std::string getTransContent(void);
+
+public:
+       std::string __contentType;
+       std::string __content;
+       DisplayChar *__display;
+};
+
+/*
+ * https://fidoalliance.org/specs/fido-uaf-v1.0-ps-20141208/fido-uaf-asm-api-v1.0-ps-20141208.html#dictionary-authenticatein-members
+ */
+class AsmAuthRequest {
+
+public:
+       ~AsmAuthRequest(void);
+
+       std::string getAppId(void);
+       std::vector<std::string> getKeyIds(void);
+       std::vector<Transaction*> getTCs(void);
+       std::string getFCH(void);
+
+private:
+       AsmAuthRequest(void);
+
+       std::string __appID;
+       std::vector<std::string> __keyIdList;
+       std::string __fc;
+       std::vector<Transaction*> __trList;
+
+       friend class JsonUtil;
+};
+
+#endif //__ASM_AUTH_REQ_H__
diff --git a/common/datatypes/inc/AsmAuthResponse.h b/common/datatypes/inc/AsmAuthResponse.h
new file mode 100644 (file)
index 0000000..ee03bc3
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014 - 2015 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 __ASM_AUTH_RESP_H__
+#define __ASM_AUTH_RESP_H__
+
+#include <string>
+#include <vector>
+#include "AuthenticateState.h"
+
+/*
+ * https://fidoalliance.org/specs/fido-uaf-v1.0-ps-20141208/fido-uaf-asm-api-v1.0-ps-20141208.html#dictionary-authenticateout-members
+ */
+class AsmAuthResponse {
+
+public:
+       ~AsmAuthResponse(void);
+
+       std::string getAssertion(void);
+       std::string getAssertionScheme(void);
+
+private:
+       AsmAuthResponse(void);
+
+private:
+       std::string __assertion;
+       std::string __assertionScheme;
+
+       friend class AuthenticateState;
+
+};
+
+#endif //__ASM_AUTH_RESP_H__
diff --git a/common/datatypes/inc/AsmDeregRequest.h b/common/datatypes/inc/AsmDeregRequest.h
new file mode 100644 (file)
index 0000000..5587f78
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014 - 2015 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 __ASM_DEREG_REQ_H__
+#define __ASM_DEREG_REQ_H__
+
+#include <string>
+#include <vector>
+
+/*
+ * https://fidoalliance.org/specs/fido-uaf-v1.0-ps-20141208/fido-uaf-asm-api-v1.0-ps-20141208.html#dictionary-deregisterin-members
+ */
+class AsmDeregRequest {
+
+public:
+       ~AsmDeregRequest(void);
+
+       std::string getAppId(void);
+       std::string getKeyId(void);
+
+private:
+       AsmDeregRequest(void);
+
+       std::string __appId;
+       std::string __keyId;
+
+       friend class JsonUtil;
+};
+
+#endif //__ASM_DEREG_REQ_H__
diff --git a/common/datatypes/inc/AsmDeregResponse.h b/common/datatypes/inc/AsmDeregResponse.h
new file mode 100644 (file)
index 0000000..803288f
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014 - 2015 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 __ASM_DEREG_RESP_H__
+#define __ASM_DEREG_RESP_H__
+
+#include <string>
+#include <vector>
+
+class AsmDeregResponse {
+
+public:
+       ~AsmDeregResponse(void);
+
+private:
+       AsmDeregResponse(void);
+
+};
+
+#endif //__ASM_DEREG_RESP_H__
diff --git a/common/datatypes/inc/AsmGetInfoRequest.h b/common/datatypes/inc/AsmGetInfoRequest.h
new file mode 100644 (file)
index 0000000..d0b4063
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2014 - 2015 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 ASMGETINFOREQUEST_H
+#define ASMGETINFOREQUEST_H
+
+class AsmGetInfoRequest {
+
+public:
+       ~AsmGetInfoRequest(void);
+
+private:
+       AsmGetInfoRequest(void);
+};
+
+#endif // ASMGETINFOREQUEST_H
diff --git a/common/datatypes/inc/AsmGetRegsRequest.h b/common/datatypes/inc/AsmGetRegsRequest.h
new file mode 100644 (file)
index 0000000..aba6a4f
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2014 - 2015 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.
+ *
+ */
diff --git a/common/datatypes/inc/AsmGetRegsResponse.h b/common/datatypes/inc/AsmGetRegsResponse.h
new file mode 100644 (file)
index 0000000..29bcf3a
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014 - 2015 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 __ASM_GET_REGS_RESP_H__
+#define __ASM_GET_REGS_RESP_H__
+
+#include <string>
+#include <vector>
+
+class GetRegsState;
+
+class AppRegistration {
+
+public:
+       ~AppRegistration(void);
+       std::string getAppId(void);
+       std::vector<std::string> getKeyIdList(void);
+
+
+private:
+       AppRegistration(void);
+
+private:
+       std::string __appId;
+       std::vector<std::string> __keyIdList;
+
+       friend class GetRegsState;
+};
+
+
+/*
+ * https://fidoalliance.org/specs/fido-uaf-v1.0-ps-20141208/fido-uaf-asm-api-v1.0-ps-20141208.html#dictionary-getregistrationsout-members
+ */
+class AsmGetRegsResponse {
+
+public:
+       ~AsmGetRegsResponse(void);
+
+       std::vector<AppRegistration> getAppRegList(void);
+
+private:
+       AsmGetRegsResponse(void);
+
+private:
+       std::vector<AppRegistration> __appRegList;
+       friend class GetRegsState;
+
+};
+
+#endif //__ASM_GET_REGS_RESP_H__
diff --git a/common/datatypes/inc/AsmOpenSettingsRequest.h b/common/datatypes/inc/AsmOpenSettingsRequest.h
new file mode 100644 (file)
index 0000000..aba6a4f
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2014 - 2015 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.
+ *
+ */
diff --git a/common/datatypes/inc/AsmOpenSettingsResponse.h b/common/datatypes/inc/AsmOpenSettingsResponse.h
new file mode 100644 (file)
index 0000000..aba6a4f
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2014 - 2015 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.
+ *
+ */
diff --git a/common/datatypes/inc/AsmRegRequest.h b/common/datatypes/inc/AsmRegRequest.h
new file mode 100644 (file)
index 0000000..69374a1
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014 - 2015 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 __ASM_REG_REQ_H__
+#define __ASM_REG_REQ_H__
+
+#include <tizen.h>
+#include <string>
+#include "JsonUtil.h"
+
+/*
+ * https://fidoalliance.org/specs/fido-uaf-v1.0-ps-20141208/fido-uaf-asm-api-v1.0-ps-20141208.html#dictionary-registerin-members
+ */
+class AsmRegRequest {
+
+public:
+       ~AsmRegRequest(void);
+
+       std::string getServerChallenge(void);
+       std::string getAppId(void);
+       std::string getUserName(void);
+       std::string getFinalChallenge(void);
+       int getAttestationType(void);
+
+private:
+       AsmRegRequest(void);
+
+private:
+       std::string __sCh;
+       std::string __appID;
+       std::string __userName;
+       std::string __fc;
+       int                     __attType;
+
+       friend class JsonUtil;
+};
+
+#endif // __ASM_REG_REQ_H__
diff --git a/common/datatypes/inc/AsmRegResponse.h b/common/datatypes/inc/AsmRegResponse.h
new file mode 100644 (file)
index 0000000..8d58f88
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014 - 2015 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 __ASM_REG_RESP_H__
+#define __ASM_REG_RESP_H__
+
+#include <string>
+#include <vector>
+
+/*
+ * https://fidoalliance.org/specs/fido-uaf-v1.0-ps-20141208/fido-uaf-asm-api-v1.0-ps-20141208.html#dictionary-registerout-members
+ */
+class AsmRegResponse {
+
+public:
+       ~AsmRegResponse(void);
+
+       std::string getAssertion(void);
+       std::string getAssertionScheme(void);
+
+private:
+       AsmRegResponse(void);
+
+private:
+       std::string __assertion;
+       std::string __assertionScheme;
+
+       friend class RegisterState;
+
+};
+
+#endif //__ASM_REG_RESP_H__
diff --git a/common/datatypes/inc/AsmRequest.h b/common/datatypes/inc/AsmRequest.h
new file mode 100644 (file)
index 0000000..61072ee
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2014 - 2015 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 __ASM_REQ_H__
+#define __ASM_REQ_H__
+
+#include <string>
+#include <vector>
+
+class JsonUtil;
+
+/**
+ * https://fidoalliance.org/specs/fido-uaf-v1.0-ps-20141208/fido-uaf-protocol-v1.0-ps-20141208.html#version-interface
+ */
+class AsmVersion {
+
+public:
+       ~AsmVersion(void);
+
+       int getMajor(void);
+       int getMinor(void);
+
+private:
+       AsmVersion(void);
+       int __major;
+       int __minor;
+
+       friend class JsonUtil;
+};
+
+/*
+ * https://fidoalliance.org/specs/fido-uaf-v1.0-ps-20141208/fido-uaf-protocol-v1.0-ps-20141208.html#dictionary-extension-members
+ */
+class Extension {
+
+public:
+       ~Extension(void);
+
+private:
+       Extension(void);
+
+private:
+       std::string __id;
+       std::string __data;
+       bool __failIfUnknown;
+};
+
+/**
+* https://fidoalliance.org/specs/fido-uaf-v1.0-ps-20141208/fido-uaf-asm-api-v1.0-ps-20141208.html#dictionary-asmrequest-members
+*/
+class AsmRequest {
+
+public:
+       ~AsmRequest(void);
+
+       AsmVersion* getAsmVersion(void);
+       std::string getRequesttype(void);
+       int getAuthIndex(void);
+       void* getArgs(void);
+       /*Additional param to make it easy to create asm json response*/
+       void setCallerId(const std::string& callerId);
+       std::string getCallerId(void);
+
+       void *getCustomRequest(void);
+
+private:
+       AsmRequest(void);
+
+//     int setAsmVersion(const AsmVersion& ver);
+//     int setAuthIndex(int idx);
+//     int setArgs(const std::string& reqType, void *args);
+//     int addExtension(const Extension& ext);
+
+private:
+       std::string __requestType;
+       AsmVersion *__asmVersion;
+       int __authenticatorIndex;
+       void *__args;
+       std::vector<Extension*> extList;
+       std::string __callerId;
+
+       /*Auth Req: RegisterReq, AuthenticateReq, SignReq*/
+       void *__customRequest;
+
+       friend class JsonUtil;
+       friend class RoamingUtil;
+};
+
+#endif
diff --git a/common/datatypes/inc/AsmResponse.h b/common/datatypes/inc/AsmResponse.h
new file mode 100644 (file)
index 0000000..55cc379
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014 - 2015 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 __ASM_RESP_H__
+#define __ASM_RESP_H__
+
+#include <string>
+#include <vector>
+
+class Extension;
+class RegisterState;
+class AuthenticateState;
+class GetRegsState;
+
+/*
+ * https://fidoalliance.org/specs/fido-uaf-v1.0-ps-20141208/fido-uaf-asm-api-v1.0-ps-20141208.html#dictionary-asmresponse-members
+ */
+class AsmResponse {
+
+public:
+       ~AsmResponse(void);
+
+       int getStatusCode(void);
+       void* getResponseData(void);
+       std::vector<Extension*>* getExtensionList(void);
+
+private:
+       AsmResponse(void);
+
+private:
+       int __statusCode;
+       void *__respData;
+       std::vector<Extension*> *__extList;
+
+       friend class RegisterState;
+       friend class AuthenticateState;
+       friend class GetRegsState;
+};
+
+#endif //__ASM_RESP_H__
diff --git a/common/datatypes/inc/GetInfoResponse.h b/common/datatypes/inc/GetInfoResponse.h
new file mode 100644 (file)
index 0000000..dbecb09
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014 - 2015 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 __ASM_GET_INFO_RESP_H__
+#define __ASM_GET_INFO_RESP_H__
+
+#include <string>
+#include <vector>
+
+#include "AuthnrTypes.h"
+
+/*
+ * https://fidoalliance.org/specs/fido-uaf-v1.0-ps-20141208/fido-uaf-asm-api-v1.0-ps-20141208.html#dictionary-getinfoout-members
+ */
+class GetInfoResponse {
+
+public:
+       ~GetInfoResponse(void);
+
+       std::vector<AuthenticatorInfo*>* getAuthnrList(void);
+
+private:
+       GetInfoResponse(void);
+
+private:
+       std::vector<AuthenticatorInfo*> *__authList;
+
+};
+
+#endif //__ASM_GET_INFO_RESP_H__
diff --git a/common/datatypes/src/AsmAuthRequest.cpp b/common/datatypes/src/AsmAuthRequest.cpp
new file mode 100644 (file)
index 0000000..4779a14
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AsmAuthRequest.h"
+#include <vector>
+
+std::string
+Transaction::getTransContent(void)
+{
+       return __content;
+}
+
+AsmAuthRequest::~AsmAuthRequest(void)
+{
+
+}
+
+std::string
+AsmAuthRequest::getAppId(void)
+{
+       return __appID;
+}
+
+std::vector<std::string>
+AsmAuthRequest::getKeyIds(void)
+{
+       return __keyIdList;
+}
+
+std::vector<Transaction*>
+AsmAuthRequest::getTCs(void)
+{
+       return __trList;
+}
+
+std::string
+AsmAuthRequest::getFCH(void)
+{
+       return __fc;
+}
+
+AsmAuthRequest::AsmAuthRequest(void)
+{
+
+}
diff --git a/common/datatypes/src/AsmAuthResponse.cpp b/common/datatypes/src/AsmAuthResponse.cpp
new file mode 100644 (file)
index 0000000..9313cd8
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AsmAuthResponse.h"
+#include <vector>
+
+AsmAuthResponse::~AsmAuthResponse(void)
+{
+
+}
+
+std::string
+AsmAuthResponse::getAssertion(void)
+{
+       return __assertion;
+}
+
+std::string
+AsmAuthResponse::getAssertionScheme(void)
+{
+       return __assertionScheme;
+}
+
+AsmAuthResponse::AsmAuthResponse(void)
+{
+
+}
+
diff --git a/common/datatypes/src/AsmDeregRequest.cpp b/common/datatypes/src/AsmDeregRequest.cpp
new file mode 100644 (file)
index 0000000..8771ec7
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AsmDeregRequest.h"
+#include <vector>
+
+AsmDeregRequest::~AsmDeregRequest(void)
+{
+
+}
+
+std::string
+AsmDeregRequest::getAppId(void)
+{
+       return __appId;
+}
+
+std::string
+AsmDeregRequest::getKeyId(void)
+{
+       return __keyId;
+}
+
+AsmDeregRequest::AsmDeregRequest(void)
+{
+
+}
diff --git a/common/datatypes/src/AsmDeregResponse.cpp b/common/datatypes/src/AsmDeregResponse.cpp
new file mode 100644 (file)
index 0000000..aba6a4f
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2014 - 2015 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.
+ *
+ */
diff --git a/common/datatypes/src/AsmGetRegsRequest.cpp b/common/datatypes/src/AsmGetRegsRequest.cpp
new file mode 100644 (file)
index 0000000..aba6a4f
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2014 - 2015 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.
+ *
+ */
diff --git a/common/datatypes/src/AsmGetRegsResponse.cpp b/common/datatypes/src/AsmGetRegsResponse.cpp
new file mode 100644 (file)
index 0000000..50f1330
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AsmGetRegsResponse.h"
+#include "GetRegsState.h"
+#include <vector>
+
+AppRegistration::~AppRegistration(void)
+{
+
+}
+
+std::string
+AppRegistration::getAppId(void)
+{
+       return __appId;
+}
+
+std::vector<std::string>
+AppRegistration::getKeyIdList(void)
+{
+       return __keyIdList;
+}
+
+
+AppRegistration::AppRegistration(void)
+{
+
+}
+
+AsmGetRegsResponse::~AsmGetRegsResponse(void)
+{
+
+}
+
+std::vector<AppRegistration>
+AsmGetRegsResponse::getAppRegList(void)
+{
+       return __appRegList;
+}
+
+AsmGetRegsResponse::AsmGetRegsResponse(void)
+{
+
+}
diff --git a/common/datatypes/src/AsmOpenSettingsRequest.cpp b/common/datatypes/src/AsmOpenSettingsRequest.cpp
new file mode 100644 (file)
index 0000000..aba6a4f
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2014 - 2015 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.
+ *
+ */
diff --git a/common/datatypes/src/AsmOpenSettingsResponse.cpp b/common/datatypes/src/AsmOpenSettingsResponse.cpp
new file mode 100644 (file)
index 0000000..aba6a4f
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2014 - 2015 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.
+ *
+ */
diff --git a/common/datatypes/src/AsmRegRequest.cpp b/common/datatypes/src/AsmRegRequest.cpp
new file mode 100644 (file)
index 0000000..1de41de
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AsmRegRequest.h"
+#include <vector>
+
+AsmRegRequest::~AsmRegRequest(void)
+{
+
+}
+
+std::string
+AsmRegRequest::getServerChallenge(void)
+{
+       return __sCh;
+}
+
+std::string
+AsmRegRequest::getAppId(void)
+{
+       return __appID;
+}
+
+std::string
+AsmRegRequest::getUserName(void)
+{
+       return __userName;
+}
+
+std::string
+AsmRegRequest::getFinalChallenge(void)
+{
+       return __fc;
+}
+
+int
+AsmRegRequest::getAttestationType(void)
+{
+       return __attType;
+}
+
+
+AsmRegRequest::AsmRegRequest(void)
+{
+
+}
+
+
+
diff --git a/common/datatypes/src/AsmRegResponse.cpp b/common/datatypes/src/AsmRegResponse.cpp
new file mode 100644 (file)
index 0000000..9f95b55
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AsmRegResponse.h"
+#include <vector>
+
+AsmRegResponse::AsmRegResponse(void)
+{
+
+}
+
+AsmRegResponse::~AsmRegResponse(void)
+{
+
+}
+
+std::string
+AsmRegResponse::getAssertion(void)
+{
+       return __assertion;
+}
+
+std::string
+AsmRegResponse::getAssertionScheme(void)
+{
+       return __assertionScheme;
+}
diff --git a/common/datatypes/src/AsmRequest.cpp b/common/datatypes/src/AsmRequest.cpp
new file mode 100644 (file)
index 0000000..0047d9f
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AsmRequest.h"
+#include "AsmRegRequest.h"
+#include "AsmAuthRequest.h"
+#include "AsmDeregRequest.h"
+#include <vector>
+
+AsmRequest::AsmRequest(void)
+{
+       __requestType = -1;
+       __asmVersion = NULL;
+       __authenticatorIndex = -1;
+       __args = NULL;
+       __customRequest = NULL;
+}
+
+AsmRequest::~AsmRequest(void)
+{
+       delete __asmVersion;
+       if (__args != NULL) {
+               if (__requestType == "Register") {
+                       delete static_cast<AsmRegRequest*>(__args);
+               }
+               if (__requestType == "Authenticate") {
+                       delete static_cast<AsmAuthRequest*>(__args);
+               }
+               if (__requestType == "Deregister") {
+                       delete static_cast<AsmDeregRequest*>(__args);
+               }
+       }
+
+}
+
+AsmVersion *
+AsmRequest::getAsmVersion(void)
+{
+       return __asmVersion;
+}
+
+std::string
+AsmRequest::getRequesttype(void)
+{
+       return __requestType;
+}
+
+int
+AsmRequest::getAuthIndex(void)
+{
+       return __authenticatorIndex;
+}
+
+void*
+AsmRequest::getArgs(void)
+{
+       return __args;
+}
+
+void
+AsmRequest::setCallerId(const std::string& callerId)
+{
+       __callerId = callerId;
+}
+
+std::string
+AsmRequest::getCallerId(void)
+{
+       return __callerId;
+}
+
+void*
+AsmRequest::getCustomRequest(void)
+{
+       return __customRequest;
+}
+
+AsmVersion::~AsmVersion(void)
+{
+
+}
+
+int
+AsmVersion::getMajor(void)
+{
+       return __major;
+}
+
+int
+AsmVersion::getMinor(void)
+{
+       return __minor;
+}
+
+AsmVersion::AsmVersion(void)
+{
+
+}
diff --git a/common/datatypes/src/AsmResponse.cpp b/common/datatypes/src/AsmResponse.cpp
new file mode 100644 (file)
index 0000000..6e221c3
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AsmResponse.h"
+#include "RegisterState.h"
+#include "AuthenticateState.h"
+#include "GetRegsState.h"
+#include <vector>
+#include "RegisterState.h"
+#include "AuthenticateState.h"
+#include "GetRegsState.h"
+
+AsmResponse::AsmResponse(void)
+{
+
+}
+
+AsmResponse::~AsmResponse(void)
+{
+
+}
+
+int
+AsmResponse::getStatusCode(void)
+{
+       return __statusCode;
+}
+
+void*
+AsmResponse::getResponseData(void)
+{
+       return __respData;
+}
+
+std::vector<Extension*>*
+AsmResponse::getExtensionList(void)
+{
+       return __extList;
+}
diff --git a/common/datatypes/src/AuthnrTypes.cpp b/common/datatypes/src/AuthnrTypes.cpp
new file mode 100644 (file)
index 0000000..aba6a4f
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2014 - 2015 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.
+ *
+ */
diff --git a/common/dbus_interfaces/CMakeLists.txt b/common/dbus_interfaces/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3920e77
--- /dev/null
@@ -0,0 +1,39 @@
+
+SET(FIDO_ASM_DBUS fido-asm-dbus)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(FIDO_ASM_DBUS_PKGS REQUIRED
+               dlog
+               glib-2.0
+               gio-unix-2.0
+               gobject-2.0
+               capi-base-common
+               json-glib-1.0
+               openssl
+)
+
+FOREACH(flag ${FIDO_ASM_DBUS_PKGS_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
+SET(CMAKE_LDFLAGS "-Wl,-zdefs")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
+ADD_DEFINITIONS("-DSLP_DEBUG")
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_SOURCE_DIR}/common/fido-client-ipc-stub.c ${CMAKE_SOURCE_DIR}/common/fido-client-ipc-stub.h
+WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/common/
+COMMAND gdbus-codegen --interface-prefix org.tizen. --generate-c-code fido-client-ipc-stub ${CMAKE_SOURCE_DIR}/common/dbus_interfaces/fido-asm.xml
+COMMENT "Generating FIDO GDBus stubs........................")
+
+ADD_LIBRARY(${FIDO_ASM_DBUS} STATIC ${CMAKE_SOURCE_DIR}/common/fido-client-ipc-stub.c)
+ADD_DEPENDENCIES(${FIDO_ASM_DBUS} ${CMAKE_SOURCE_DIR}/common/fido-client-ipc-stub.h.h)
+ADD_DEPENDENCIES(${FIDO_ASM_DBUS} ${CMAKE_SOURCE_DIR}/common/fido-client-ipc-stub.h.c)
+
+
+TARGET_LINK_LIBRARIES(${FIDO_ASM_DBUS} ${FIDO_COMMON_PKGS_LDFLAGS})
diff --git a/common/dbus_interfaces/fido-asm.xml b/common/dbus_interfaces/fido-asm.xml
new file mode 100644 (file)
index 0000000..c9666b0
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<node name="/org/tizen/fidoasm">
+  <interface name="org.tizen.fidoasm">
+    <method name="asm_request">
+       <arg type="s" name="uaf_request_json" direction="in" />
+       <arg type="i" name="tizen_error_code" direction="out" />
+       <arg type="s" name="uaf_response_json" direction="out" />
+    </method>
+    <method name="ra_request">
+       <arg type="s" name="ra_request_tlv" direction="in" />
+       <arg type="i" name="error" direction="out" />
+       <arg type="s" name="ra_response_tlv" direction="out" />
+    </method>
+    <method name="asm_ui_confirm_tc">
+       <arg type="s" name="nonce" direction="in" />
+       <arg type="i" name="error" direction="in" />
+    </method>
+    <method name="asm_ui_confirm_acc">
+       <arg type="s" name="nonce" direction="in" />
+       <arg type="i" name="error" direction="in" />
+       <arg type="s" name="account" direction="in" />
+    </method>
+    <method name="auth_ui_result">
+       <arg type="i" name="auth_ui_type" direction="in" />
+       <arg type="s" name="nonce" direction="in" />
+       <arg type="i" name="error" direction="in" />
+       <arg type="s" name="token" direction="in" />
+    </method>
+  </interface>
+</node>
diff --git a/common/fido-ra-acl-server.dat b/common/fido-ra-acl-server.dat
new file mode 100644 (file)
index 0000000..80088b2
Binary files /dev/null and b/common/fido-ra-acl-server.dat differ
diff --git a/common/jsonutil/inc/JsonUtil.h b/common/jsonutil/inc/JsonUtil.h
new file mode 100644 (file)
index 0000000..4efc013
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2014 - 2015 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 JSONUTIL_H_
+#define JSONUTIL_H_
+
+#include "AsmRequest.h"
+#include "AuthnrTypes.h"
+#include <glib.h>
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+#include <glib/gmacros.h>
+#endif
+#include <json-glib/json-glib.h>
+#include <string.h>
+#include <vector>
+#include "IAuthStub.h"
+
+class IAuthStub;
+class AsmResponse;
+
+class JsonUtil {
+
+public:
+       static AsmRequest* parseAsmRequestJson(const char *json);
+
+       static char* composeAsmGetInfoResponse(int statusCode,
+                                                                       std::vector<GetAuthInfoResp*> *getInfoList);
+       static char* composeAsmRegisterResponse(AsmResponse *regResp);
+       static char* composeAsmAuthenticateResponse(AsmResponse *authResp);
+       static char* composeAsmGetRegsResponse(AsmResponse *regResp);
+
+       static char* composeEnrollUiRequest(const char *appId, const char *aaid);
+
+private:
+       typedef enum _ReqType {
+               REQ_TYPE_INVALID,
+               REQ_TYPE_GET_INFO,
+               REQ_TYPE_REG,
+               REQ_TYPE_AUTH,
+               REQ_TYPE_DE_REG,
+               REQ_TYPE_GET_REGS,
+               REQ_TYPE_OPEN_SETTINGS
+       } ReqType;
+
+       static ReqType getReqType(const std::string& op);
+
+       static void* parseAsmRequestArgReg(JsonObject *argObj);
+       static void* parseAsmRequestArgAuth(JsonObject *argObj);
+       static void* parseAsmRequestArgDeReg(JsonObject *argObj);
+
+       static std::string getString(JsonObject *obj, const char *key);
+       static int getInt(JsonObject *obj, const char *key);
+       static void addJsonObjectAuthInfo(JsonBuilder *builder, GetAuthInfoResp *getInfoResp);
+
+       static void addString(JsonBuilder *builder, const char *key, const char *val);
+       static void addInt(JsonBuilder *builder, const char *key, int val);
+       static void addBool(JsonBuilder *builder, const char *key, bool val);
+
+       static JsonBuilder* initComposer(int statusCode);
+       static char* finishComposer(JsonBuilder *builder);
+
+};
+
+
+
+#endif /* JSONUTIL_H_ */
diff --git a/common/jsonutil/src/JsonUtil.cpp b/common/jsonutil/src/JsonUtil.cpp
new file mode 100644 (file)
index 0000000..4a6b6c8
--- /dev/null
@@ -0,0 +1,677 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "JsonUtil.h"
+#include "AsmRequest.h"
+#include "AsmHelper.h"
+#include "AsmRegRequest.h"
+#include "AsmAuthRequest.h"
+#include "AsmDeregRequest.h"
+#include "AsmResponse.h"
+#include "GetInfoResponse.h"
+#include "AsmRegResponse.h"
+#include "AsmAuthResponse.h"
+#include "AsmGetRegsResponse.h"
+
+#include <string.h>
+
+#define chunk_size 100
+
+static void
+__print_big_string(const char *str)
+{
+       int len = strlen(str);
+       int i = 0;
+       for (; i < len; i+= chunk_size)
+       {
+               char sub_str[chunk_size + 2] = {0, };
+               strncpy(sub_str, str + i, chunk_size);
+               _INFO("log : [%s]", sub_str);
+       }
+
+}
+
+#define GET_ROOT_NODE(json) \
+       JsonParser *parser = NULL;\
+       GError *parse_err = NULL;\
+       JsonNode *root = NULL;\
+       \
+       parser = json_parser_new();\
+       CATCH_IF_FAIL(parser != NULL);\
+       \
+       json_parser_load_from_data(parser, json, -1, &parse_err);\
+       CATCH_IF_FAIL(parse_err == NULL);\
+       \
+       root = json_parser_get_root(parser);\
+       CATCH_IF_FAIL(root != NULL);
+
+JsonUtil::ReqType
+JsonUtil::getReqType(const std::string &op)
+{
+       if (op == "GetInfo")
+               return JsonUtil::REQ_TYPE_GET_INFO;
+
+       if (op == "Register")
+               return JsonUtil::REQ_TYPE_REG;
+
+       if (op == "Authenticate")
+               return JsonUtil::REQ_TYPE_AUTH;
+
+       if (op == "Deregister")
+               return JsonUtil::REQ_TYPE_DE_REG;
+
+       if (op == "GetRegistrations")
+               return JsonUtil::REQ_TYPE_GET_REGS;
+
+       if (op == "OpenSettings")
+               return JsonUtil::REQ_TYPE_OPEN_SETTINGS;
+
+       return JsonUtil::REQ_TYPE_INVALID;
+}
+
+std::string
+JsonUtil::getString(JsonObject *obj, const char *key)
+{
+       RET_IF_FAIL(obj != NULL, "");
+
+       const char *val = json_object_get_string_member(obj, key);
+       if (val != NULL) {
+               std::string valStr((const char *)val, strlen(val));
+               return valStr;
+       }
+
+       return "";
+}
+
+int
+JsonUtil::getInt(JsonObject *obj, const char *key)
+{
+       RET_IF_FAIL(obj != NULL, -1);
+
+       if (json_object_has_member(obj, key) == false) {
+               return -1;
+       }
+
+       return json_object_get_int_member(obj, key);
+}
+
+void*
+JsonUtil::parseAsmRequestArgReg(JsonObject *argObj)
+{
+       RET_IF_FAIL(argObj != NULL, NULL);
+
+       AsmRegRequest *asmRegReq = new AsmRegRequest();
+       asmRegReq->__appID = getString(argObj, "appID");
+       asmRegReq->__userName = getString(argObj, "username");
+       asmRegReq->__fc = getString(argObj, "finalChallenge");
+       asmRegReq->__attType = getInt(argObj, "attestationType");
+
+       return asmRegReq;
+}
+
+void*
+JsonUtil::parseAsmRequestArgAuth(JsonObject *argObj)
+{
+       _BEGIN;
+       RET_IF_FAIL(argObj != NULL, NULL);
+
+       AsmAuthRequest *asmAuthReq = new AsmAuthRequest();
+       asmAuthReq->__appID = getString(argObj, "appID");
+       asmAuthReq->__fc = getString(argObj, "finalChallenge");
+
+       JsonArray *keyArr = json_object_get_array_member(argObj, "keyIDs");
+       if (keyArr != NULL) {
+               int keyArrLen = json_array_get_length(keyArr);
+
+               int i = 0;
+               for (; i < keyArrLen; i++) {
+
+                       const char *keyId = json_array_get_string_element(keyArr, i);
+                       if (keyId != NULL) {
+                               _INFO("keyId is = [%s]", keyId);
+                               std::string keyIdStr(keyId, strlen(keyId));
+                               asmAuthReq->__keyIdList.push_back(keyIdStr);
+                       }
+               }
+       }
+
+       /*Transaction*/
+       JsonArray *tcArr = json_object_get_array_member(argObj, "transaction");
+       if (tcArr != NULL) {
+               int tcArrLen = json_array_get_length(tcArr);
+
+               int i = 0;
+               for (; i < tcArrLen; i++) {
+
+                       JsonObject *tcObj = json_array_get_object_element(tcArr, i);
+                       if (tcObj != NULL) {
+
+                               std::string conTypeStr = getString(tcObj, "contentType");
+                               std::string conStr = getString(tcObj, "content");
+                               /*TODO: Add tcDisplayPNGCharacteristics when ASM UI is capable of image display*/
+
+                               if ((conTypeStr.empty() == false)
+                                               && (conStr.empty() == false)) {
+
+                                       Transaction *tc = new Transaction();
+
+                                       tc->__contentType = conTypeStr;
+                                       tc->__content = conStr;
+
+                                       asmAuthReq->__trList.push_back(tc);
+                                       _INFO("");
+                               }
+                       }
+               }
+       }
+
+       _END;
+       return asmAuthReq;
+}
+
+void*
+JsonUtil::parseAsmRequestArgDeReg(JsonObject *argObj)
+{
+       RET_IF_FAIL(argObj != NULL, NULL);
+
+       AsmDeregRequest *asmDeRegReq = new AsmDeregRequest();
+       asmDeRegReq->__appId = getString(argObj, "appID");
+       asmDeRegReq->__keyId = getString(argObj, "keyID");
+
+       return asmDeRegReq;
+}
+
+AsmRequest*
+JsonUtil::parseAsmRequestJson(const char *json)
+{
+       RET_IF_FAIL(json != NULL, NULL);
+
+       std::string reqTypeVal;
+       ReqType reqType = REQ_TYPE_INVALID;
+       JsonObject *verObj = NULL;
+       int major = -1;
+       int minor = -1;
+       AsmRequest *asmReq = NULL;
+       AsmVersion *ver = NULL;
+       JsonObject *argObj = NULL;
+       JsonObject *rootObj = NULL;
+
+       GET_ROOT_NODE(json);
+
+       rootObj = json_node_get_object(root);
+       CATCH_IF_FAIL(rootObj != NULL);
+
+       reqTypeVal = getString(rootObj, "requestType");
+
+       reqType = getReqType(reqTypeVal);
+       CATCH_IF_FAIL(reqType != REQ_TYPE_INVALID);
+
+       verObj = json_object_get_object_member(rootObj, "asmVersion");
+       CATCH_IF_FAIL(verObj != NULL);
+
+       major = json_object_get_int_member(verObj, "major");
+       minor = json_object_get_int_member(verObj, "minor");
+
+       /*TODO extension*/
+
+       asmReq = new AsmRequest();
+       asmReq->__requestType = reqTypeVal;
+
+       ver = new AsmVersion();
+       ver->__major = major;
+       ver->__minor = minor;
+
+       asmReq->__asmVersion = ver;
+
+       if (reqType == REQ_TYPE_GET_INFO) {
+               if (parser != NULL)
+                       g_object_unref(parser);
+
+               return asmReq;
+       }
+
+
+       asmReq->__authenticatorIndex = json_object_get_int_member(rootObj, "authenticatorIndex");
+
+       if(reqType == REQ_TYPE_GET_REGS) {
+               if (parser != NULL)
+                       g_object_unref(parser);
+
+               return asmReq;
+       }
+
+       argObj = json_object_get_object_member(rootObj, "args");
+
+       switch (reqType) {
+
+       case REQ_TYPE_REG:
+               asmReq->__args = parseAsmRequestArgReg(argObj);
+               break;
+
+       case REQ_TYPE_AUTH:
+               asmReq->__args = parseAsmRequestArgAuth(argObj);
+               break;
+
+       case REQ_TYPE_DE_REG:
+               asmReq->__args = parseAsmRequestArgDeReg(argObj);
+               break;
+
+       default:
+               asmReq->__args = NULL;
+               break;
+       }
+
+       if (parser != NULL)
+               g_object_unref(parser);
+
+       return asmReq;
+
+CATCH:
+       if (parser != NULL)
+               g_object_unref(parser);
+
+       return NULL;
+}
+
+void
+JsonUtil::addString(JsonBuilder *builder, const char *key, const char *val)
+{
+       if ((builder == NULL) || (key == NULL) || (val == NULL))
+               return;
+
+       json_builder_set_member_name(builder, key);
+       json_builder_add_string_value(builder, val);
+}
+
+void
+JsonUtil::addInt(JsonBuilder *builder, const char *key, int val)
+{
+       if ((builder == NULL) || (key == NULL))
+               return;
+
+       json_builder_set_member_name(builder, key);
+       json_builder_add_int_value(builder, val);
+}
+
+void
+JsonUtil::addBool(JsonBuilder *builder, const char *key, bool val)
+{
+       if ((builder == NULL) || (key == NULL))
+               return;
+
+       json_builder_set_member_name(builder, key);
+       json_builder_add_boolean_value(builder, val);
+}
+
+void
+JsonUtil::addJsonObjectAuthInfo(JsonBuilder *builder, GetAuthInfoResp *getInfoResp)
+{
+       if ((builder == NULL) || (getInfoResp == NULL))
+               return;
+
+       RET_IF_FAIL_VOID(getInfoResp != NULL);
+
+       GList *authList = getInfoResp->authList;
+       if ((authList == NULL) || (g_list_length(authList) <= 0))
+               return;
+
+       GList *authListIter = g_list_first(authList);
+       /*Supports one authenticator per authenticator*/
+       while (authListIter != NULL) {
+
+               AuthenticatorInfo *authInfo = (AuthenticatorInfo *)(authListIter->data);
+
+               /*AuthenticatorInfo*/
+               json_builder_begin_object(builder);
+
+               addInt(builder, "authenticatorIndex", authInfo->__authenticatorIndex);
+
+               /*asmVersions array*/
+               json_builder_set_member_name(builder, "asmVersions");
+               json_builder_begin_array(builder);
+
+               /*asmVersion object*/
+               json_builder_begin_object(builder);
+
+               json_builder_set_member_name(builder, "major");
+               json_builder_add_int_value(builder, 1);
+
+               json_builder_set_member_name(builder, "minor");
+               json_builder_add_int_value(builder, 0);
+
+               /*asmVersion object*/
+               json_builder_end_object(builder);
+
+               /*asmVersions array*/
+               json_builder_end_array(builder);
+
+               json_builder_set_member_name(builder, "isUserEnrolled");
+               json_builder_add_boolean_value(builder, authInfo->__isUserEnrolled);
+
+
+               json_builder_set_member_name(builder, "hasSettings");
+               if ((AUTH_TYPE_HAS_SETTINGS & authInfo->__meta->authenticatorType) != 0)
+                       json_builder_add_boolean_value(builder, true);
+               else
+                       json_builder_add_boolean_value(builder, false);
+
+               if (authInfo->__aaid != NULL) {
+                       addString(builder, "aaid", authInfo->__aaid);
+               }
+
+               if (authInfo->__assertionScheme != NULL) {
+                       addString(builder, "assertionScheme", authInfo->__assertionScheme);
+               }
+
+               GList *attTypeList = authInfo->__attestationTypes;
+               if (attTypeList != NULL) {
+
+                       GList *attTypeListIter = g_list_first(attTypeList);
+
+                       if (g_list_length(attTypeListIter) > 0) {
+
+                               json_builder_set_member_name(builder, "attestationTypes");
+                               json_builder_begin_array(builder);
+
+                               while (attTypeListIter != NULL) {
+                                       int att = GPOINTER_TO_INT(attTypeListIter->data);
+                                       json_builder_add_int_value(builder, att);
+
+                                       attTypeListIter = attTypeListIter->next;
+                               }
+                               /*attestationTypes*/
+                               json_builder_end_array(builder);
+                       }
+               }
+
+               GList *extList = authInfo->__extList;
+               if(extList != NULL) {
+
+                       if(g_list_length(extList) > 0) {
+
+                               json_builder_set_member_name(builder, "supportedExtensionIDs");
+                               json_builder_begin_array(builder);
+
+                               GList *extListIter = g_list_first(extList);
+
+                               while(extListIter != NULL) {
+                                       char *extId = (char*)extListIter->data;
+                                       json_builder_add_string_value(builder, extId);
+
+                                       extListIter = extListIter->next;
+                               }
+                               /*supportedExtensionIDs*/
+                               json_builder_end_array(builder);
+                       }
+               }
+
+               addInt(builder, "authenticationAlgorithm", authInfo->__meta->authenticationAlg);
+
+               addInt(builder, "userVerification", authInfo->__meta->userVerification);
+
+               addInt(builder, "keyProtection", authInfo->__meta->keyProtection);
+
+               addInt(builder, "matcherProtection", authInfo->__meta->matcherProtection);
+
+               int attHint = getInfoResp->attach_hint;
+               if (attHint != -1)
+                       addInt(builder, "attachmentHint", attHint);
+
+
+               addBool(builder, "isSecondFactorOnly", authInfo->__isSecondFactorOnly);
+
+               addBool(builder, "isRoamingAuthenticator", authInfo->__isRoamingAuthenticator);
+
+               addInt(builder, "tcDisplay", authInfo->__meta->transactionConfirmationDisplay);
+
+               _INFO("JsonUtil::addJsonObjectAuthInfo:: TC CONTENT DISPLAY TYPE = [%s]", authInfo->__tcDispConType);
+               addString(builder, "tcDisplayContentType", authInfo->__tcDispConType);
+
+               /*TODO tcDisplayPNGCharacteristics*/
+
+               addString(builder, "title", getInfoResp->title);
+
+               addString(builder, "description", getInfoResp->description);
+
+               addString(builder, "icon", getInfoResp->icon);
+
+
+               /*AuthenticatorInfo*/
+               json_builder_end_object(builder);
+
+               authListIter = authListIter->next;
+       }
+
+               return;
+}
+
+JsonBuilder*
+JsonUtil::initComposer(int statusCode)
+{
+       _BEGIN;
+       JsonBuilder *builder = json_builder_new();
+
+       json_builder_begin_object(builder);
+
+       json_builder_set_member_name(builder, "statusCode");
+       json_builder_add_int_value(builder, statusCode);
+
+       _END;
+       return builder;
+}
+
+char*
+JsonUtil::finishComposer(JsonBuilder *builder)
+{
+       JsonNode *root_builder = json_builder_get_root(builder);
+
+       JsonGenerator *gen = json_generator_new();
+       json_generator_set_root(gen, root_builder);
+
+       json_node_free(root_builder);
+       g_object_unref(builder);
+
+       gsize len = 0;
+       char *json = json_generator_to_data(gen, &len);
+       if (json != NULL) {
+               _INFO("compose Asm Response success");
+
+               if (gen != NULL)
+                       g_object_unref(gen);
+
+               _INFO("finishComposer = ");
+               __print_big_string(json);
+               return json;
+       }
+
+       _INFO("compose Asm Response failed");
+       g_object_unref(gen);
+
+       return NULL;
+}
+
+char*
+JsonUtil::composeAsmGetInfoResponse(int statusCode,
+                                                                       std::vector<GetAuthInfoResp*> *getInfoList)
+{
+       _INFO("composeAsmGetInfoResponse::start");
+
+       /*TODO*/
+       JsonBuilder *builder = initComposer(statusCode);
+
+       if ((getInfoList != NULL) &&
+                       (getInfoList->size() > 0)) {
+
+               _INFO("Auth Stub List is not NULL");
+
+               json_builder_set_member_name(builder, "responseData");
+               json_builder_begin_object(builder);
+
+
+               json_builder_set_member_name(builder, "Authenticators");
+               json_builder_begin_array(builder);
+
+               std::vector<GetAuthInfoResp*>::iterator infoListIter = getInfoList->begin();
+
+               for (; infoListIter != getInfoList->end(); ++infoListIter) {
+                       GetAuthInfoResp *info = *infoListIter;
+                       addJsonObjectAuthInfo(builder, info);
+               }
+
+               /*Authenticators*/
+               json_builder_end_array(builder);
+
+               /*responseData*/
+               json_builder_end_object(builder);
+       }
+
+
+       json_builder_end_object(builder);
+
+       _INFO("composeAsmGetInfoResponse::end");
+       return finishComposer(builder);
+}
+
+char*
+JsonUtil::composeAsmRegisterResponse(AsmResponse *regResp)
+{
+       _BEGIN;
+       JsonBuilder *builder = NULL;
+
+       if (regResp != NULL)
+               builder = initComposer(regResp->getStatusCode());
+       else
+               builder = initComposer(UAF_ASM_STATUS_ACCESS_DENIED);
+
+       if (regResp != NULL) {
+               json_builder_set_member_name(builder, "responseData");
+               json_builder_begin_object(builder);
+
+               AsmRegResponse *respData = static_cast<AsmRegResponse*>(regResp->getResponseData());
+
+               const char *assertion = respData->getAssertion().c_str();
+               const char *assScheme = respData->getAssertionScheme().c_str();
+               _INFO("assertion is [%s]", assertion);
+               _INFO("assScheme is [%s]", assScheme);
+
+               addString(builder, "assertion", respData->getAssertion().c_str());
+               addString(builder, "assertionScheme", respData->getAssertionScheme().c_str());
+
+               /*responseData*/
+               json_builder_end_object(builder);
+       }
+       json_builder_end_object(builder);
+
+       _END;
+       return finishComposer(builder);
+}
+
+char*
+JsonUtil::composeAsmAuthenticateResponse(AsmResponse *authResp)
+{
+       _BEGIN;
+
+       JsonBuilder *builder = NULL;
+
+       if (authResp != NULL)
+               builder = initComposer(authResp->getStatusCode());
+       else
+               builder = initComposer(UAF_ASM_STATUS_ACCESS_DENIED);
+
+       if (authResp != NULL) {
+               json_builder_set_member_name(builder, "responseData");
+               json_builder_begin_object(builder);
+
+               AsmAuthResponse *respData = static_cast<AsmAuthResponse*>(authResp->getResponseData());
+
+               addString(builder, "assertion", respData->getAssertion().c_str());
+               addString(builder, "assertionScheme", respData->getAssertionScheme().c_str());
+
+               /*responseData*/
+               json_builder_end_object(builder);
+       }
+       json_builder_end_object(builder);
+
+       _END;
+       return finishComposer(builder);
+}
+
+char*
+JsonUtil::composeAsmGetRegsResponse(AsmResponse *regResp)
+{
+       _BEGIN;
+       JsonBuilder *builder = NULL;
+
+       if (regResp != NULL)
+               builder = initComposer(regResp->getStatusCode());
+       else
+               builder = initComposer(UAF_ASM_STATUS_ACCESS_DENIED);
+
+       if (regResp != NULL) {
+
+               json_builder_set_member_name(builder, "responseData");
+               json_builder_begin_object(builder);
+
+               AsmGetRegsResponse *respData = (AsmGetRegsResponse*)(regResp->getResponseData());
+
+               json_builder_set_member_name(builder, "appRegs");
+               json_builder_begin_array(builder);
+
+               std::vector<AppRegistration> appRegList = respData->getAppRegList();
+
+               if(appRegList.empty() == false) {
+                       std::vector<AppRegistration>::iterator iter = appRegList.begin();
+                       for (; iter != appRegList.end(); ++iter) {
+
+                               json_builder_begin_object(builder);
+
+                               AppRegistration appReg = *iter;
+
+                               std::string appID = appReg.getAppId();
+                               if (appID.empty() == false) {
+                                       addString(builder, "appID", appID.c_str());
+                               }
+
+                               std::vector<std::string> keyIdList = appReg.getKeyIdList();
+                               if (keyIdList.size() > 0) {
+
+                                       json_builder_set_member_name(builder, "keyIDs");
+                                       json_builder_begin_array(builder);
+
+                                       std::vector<std::string>::const_iterator iter = keyIdList.begin();
+                                       for (; iter != keyIdList.end(); ++iter) {
+                                               json_builder_add_string_value(builder, (*iter).c_str());
+                                       }
+                                       /*keyIDs*/
+                                       json_builder_end_array(builder);
+                               }
+
+                               /*appReg*/
+                               json_builder_end_object(builder);
+                       }
+               }
+               /*appRegs*/
+               json_builder_end_array(builder);
+
+               /*responseData*/
+               json_builder_end_object(builder);
+       }
+
+       json_builder_end_object(builder);
+       _END;
+       return finishComposer(builder);
+}
diff --git a/common/uafv1tlvutil/inc/AttBasicFullTlvEncoder.h b/common/uafv1tlvutil/inc/AttBasicFullTlvEncoder.h
new file mode 100644 (file)
index 0000000..b5e95be
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014 - 2015 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 ATTBASICFULLTLVENCODER_H
+#define ATTBASICFULLTLVENCODER_H
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+#include "IntTlvEncoder.h"
+#include "StringTlvEncoder.h"
+#include "BufferTlvEncoder.h"
+
+class AttBasicFullTlvEncoder : public ITlvEncoder {
+
+public:
+       AttBasicFullTlvEncoder(void);
+       /*I/p: RegisterResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegisterResp*/
+       virtual void* decode(const unsigned char *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder  __strTlvEncoder;
+       BufferTlvEncoder __buffTlvEncoder;
+};
+
+#endif // ATTBASICFULLTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/AttBasicSurrTlvEncoder.h b/common/uafv1tlvutil/inc/AttBasicSurrTlvEncoder.h
new file mode 100644 (file)
index 0000000..d5eebcb
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014 - 2015 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 ATTBASICSURRTLVENCODER_H
+#define ATTBASICSURRTLVENCODER_H
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+#include "IntTlvEncoder.h"
+#include "StringTlvEncoder.h"
+#include "BufferTlvEncoder.h"
+
+class AttBasicSurrTlvEncoder : public ITlvEncoder {
+
+public:
+       AttBasicSurrTlvEncoder(void);
+       /*I/p: RegisterResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegisterResp*/
+       virtual void* decode(const unsigned char *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder  __strTlvEncoder;
+       BufferTlvEncoder __buffTlvEncoder;
+};
+
+#endif // ATTBASICSURRTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/AuthAssertionInfoTlvEncoder.h b/common/uafv1tlvutil/inc/AuthAssertionInfoTlvEncoder.h
new file mode 100644 (file)
index 0000000..ba96538
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014 - 2015 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 AUTHASSERTIONINFOTLVENCODER_H
+#define AUTHASSERTIONINFOTLVENCODER_H
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+
+class AuthAssertionInfoTlvEncoder
+{
+
+public:
+       AuthAssertionInfoTlvEncoder(void);
+       /*I/p: RegisterResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegisterResp*/
+       virtual void* decode(const unsigned char *rawData);
+};
+
+#endif // AUTHASSERTIONINFOTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/AuthCountersInfoTlvEncoder.h b/common/uafv1tlvutil/inc/AuthCountersInfoTlvEncoder.h
new file mode 100644 (file)
index 0000000..7fa855a
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014 - 2015 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 AUTHCOUNTERSINFOTLVENCODER_H
+#define AUTHCOUNTERSINFOTLVENCODER_H
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+
+class AuthCountersInfoTlvEncoder
+{
+
+public:
+       AuthCountersInfoTlvEncoder(void);
+       /*I/p: RegisterResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegisterResp*/
+       virtual void* decode(const unsigned char *rawData);
+};
+
+#endif // AUTHCOUNTERSINFOTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/BufferTlvEncoder.h b/common/uafv1tlvutil/inc/BufferTlvEncoder.h
new file mode 100644 (file)
index 0000000..f50d653
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014 - 2015 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 BUFFERTLVENCODER_H
+#define BUFFERTLVENCODER_H
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+
+class BufferTlvEncoder : public ITlvEncoder
+{
+
+public:
+       BufferTlvEncoder(void);
+
+       /*I/P : tlv_s*/
+       virtual Buffer *encode(const void *intTlv);
+
+       virtual void *decode(const unsigned char *rawData);
+};
+
+#endif // BUFFERTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/DeRegReqTlvEncoder.h b/common/uafv1tlvutil/inc/DeRegReqTlvEncoder.h
new file mode 100644 (file)
index 0000000..b2ade74
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014 - 2015 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 DEREGREQTLVENCODER_H
+#define DEREGREQTLVENCODER_H
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+#include "IntTlvEncoder.h"
+#include "StringTlvEncoder.h"
+#include "BufferTlvEncoder.h"
+
+class DeRegReqTlvEncoder : public ITlvEncoder {
+
+public:
+       DeRegReqTlvEncoder(void);
+       /*I/p: RegisterResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegisterResp*/
+       virtual void* decode(const unsigned char *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder __strTlvEncoder;
+       BufferTlvEncoder __buffTlvEncoder;
+};
+
+#endif // DEREGREQTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/DeRegRespTlvEncoder.h b/common/uafv1tlvutil/inc/DeRegRespTlvEncoder.h
new file mode 100644 (file)
index 0000000..63aa04e
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014 - 2015 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 DEREGRESPTLVENCODER_H
+#define DEREGRESPTLVENCODER_H
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+#include "IntTlvEncoder.h"
+#include "StringTlvEncoder.h"
+#include "BufferTlvEncoder.h"
+
+class DeRegRespTlvEncoder : public ITlvEncoder {
+
+public:
+       DeRegRespTlvEncoder(void);
+       /*I/p: RegisterResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegisterResp*/
+       virtual void* decode(const unsigned char *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder __strTlvEncoder;
+       BufferTlvEncoder __buffTlvEncoder;
+};
+
+#endif // DEREGRESPTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/GetInfoReqTlvEncoder.h b/common/uafv1tlvutil/inc/GetInfoReqTlvEncoder.h
new file mode 100644 (file)
index 0000000..61ebf2e
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014 - 2015 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 GETINFO_REQ_TLV_ENCODER_H_
+#define GETINFO_REQ_TLV_ENCODER_H_
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+#include <tizen.h>
+#include "TlvData.h"
+
+
+class GetInfoReqTlvEncoder : public ITlvEncoder {
+
+public:
+       GetInfoReqTlvEncoder(void);
+       virtual ~GetInfoReqTlvEncoder(void);
+
+       /*I/p: Authenticator Specific data struct, O/p: TLV raw data*/
+       virtual Buffer* encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: Authenticator Specific data struct*/
+       virtual void* decode(const unsigned char *rawData);
+
+};
+
+#endif /* GETINFO_REQ_TLV_ENCODER_H_ */
diff --git a/common/uafv1tlvutil/inc/GetInfoRespTlvEncoder.h b/common/uafv1tlvutil/inc/GetInfoRespTlvEncoder.h
new file mode 100644 (file)
index 0000000..a22819f
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2014 - 2015 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 GETINFORESPTLVENCODER_H
+#define GETINFORESPTLVENCODER_H
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+#include "IntTlvEncoder.h"
+#include "StringTlvEncoder.h"
+
+class AuthMetaTlvEncoder : public ITlvEncoder
+{
+
+public:
+       AuthMetaTlvEncoder(void);
+
+       virtual Buffer* encode(const void *authData);
+
+       virtual void* decode(const uint8_t *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder __strTlvEncoder;
+};
+
+class TcDispPNGChTlvEncoder : public ITlvEncoder
+{
+
+public:
+       TcDispPNGChTlvEncoder(void);
+
+       virtual Buffer* encode(const void *authData);
+
+       virtual void* decode(const uint8_t *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder __strTlvEncoder;
+};
+
+
+class AuthInfoTlvEncoder : public ITlvEncoder
+{
+
+public:
+       AuthInfoTlvEncoder(void);
+
+       virtual Buffer *encode(const void *authData);
+
+       virtual void* decode(const unsigned char *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder __strTlvEncoder;
+       AuthMetaTlvEncoder __authMetaTlvEncoder;
+       TcDispPNGChTlvEncoder __tcDispPNGChTlvEncoder;
+};
+
+class GetInfoRespTlvEncoder : public ITlvEncoder
+{
+
+public:
+       GetInfoRespTlvEncoder(void);
+       /*I/p: GetAuthInfoResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: Authenticator Specific data struct*/
+       virtual void* decode(const unsigned char *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       AuthInfoTlvEncoder __authInfoEncoder;
+       AuthMetaTlvEncoder __authMetaTlvEncoder;
+       TcDispPNGChTlvEncoder __tcDispPNGChTlvEncoder;
+};
+
+#endif // GETINFORESPTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/ITlvEncoder.h b/common/uafv1tlvutil/inc/ITlvEncoder.h
new file mode 100644 (file)
index 0000000..517d2a7
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2014 - 2015 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 ITLV_ENCODER_H_
+#define ITLV_ENCODER_H_
+
+#include <string>
+#include "Tlv.h"
+
+class ITlvEncoder {
+
+public:
+       virtual ~ITlvEncoder(void){}
+
+       /*I/p: Authenticator Specific data struct, O/p: TLV raw data*/
+       virtual Buffer* encode(const void *authData) = 0;
+
+       /*I/p: TLV raw data, O/p: Authenticator Specific data struct*/
+       virtual void* decode(const uint8_t *rawData) = 0;
+};
+
+#endif /* ITLV_ENCODER_H_ */
diff --git a/common/uafv1tlvutil/inc/IntTlvEncoder.h b/common/uafv1tlvutil/inc/IntTlvEncoder.h
new file mode 100644 (file)
index 0000000..aeadd20
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014 - 2015 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 INTTLVENCODER_H
+#define INTTLVENCODER_H
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+
+class IntTlvEncoder : public ITlvEncoder
+{
+
+public:
+       IntTlvEncoder(void);
+
+       /*I/P : tlv_s*/
+       virtual Buffer *encode(const void *intTlv);
+
+       virtual void *decode(const unsigned char *rawData);
+};
+
+#endif // INTTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/RegAssertionInfoTlvEncoder.h b/common/uafv1tlvutil/inc/RegAssertionInfoTlvEncoder.h
new file mode 100644 (file)
index 0000000..00572c6
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014 - 2015 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 REGASSERTIONINFOTLVENCODER_H
+#define REGASSERTIONINFOTLVENCODER_H
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+#include "IntTlvEncoder.h"
+#include "StringTlvEncoder.h"
+
+class RegAssertionInfoTlvEncoder : public ITlvEncoder {
+
+public:
+       RegAssertionInfoTlvEncoder(void);
+       /*I/p: RegisterResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegisterResp*/
+       virtual void* decode(const unsigned char *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder  __strTlvEncoder;
+};
+
+#endif // REGASSERTIONINFOTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/RegAuthAssertionTlvEncoder.h b/common/uafv1tlvutil/inc/RegAuthAssertionTlvEncoder.h
new file mode 100644 (file)
index 0000000..0319b64
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014 - 2015 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 REGAUTHASSERTIONTLVENCODER_H
+#define REGAUTHASSERTIONTLVENCODER_H
+
+#include "AttBasicFullTlvEncoder.h"
+#include "AttBasicSurrTlvEncoder.h"
+#include "Uafv1KrdTlvEncoder.h"
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+#include "IntTlvEncoder.h"
+#include "StringTlvEncoder.h"
+#include "BufferTlvEncoder.h"
+
+class RegAuthAssertionTlvEncoder : public ITlvEncoder {
+
+public:
+       RegAuthAssertionTlvEncoder(void);
+       /*I/p: RegisterResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegisterResp*/
+       virtual void* decode(const unsigned char *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder  __strTlvEncoder;
+       BufferTlvEncoder __buffTlvEncoder;
+       Uafv1KrdTlvEncoder __uafv1KrdTlvEncoder;
+       AttBasicFullTlvEncoder __attBasicFullTlvEncoder;
+       AttBasicSurrTlvEncoder __attBasicSurrTlvEncoder;
+};
+
+#endif // REGAUTHASSERTIONTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/RegCountersInfoTlvEncoder.h b/common/uafv1tlvutil/inc/RegCountersInfoTlvEncoder.h
new file mode 100644 (file)
index 0000000..c79449d
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2014 - 2015 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 REGCOUNTERSINFOTLVENCODER_H
+#define REGCOUNTERSINFOTLVENCODER_H
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+
+class RegCountersInfoTlvEncoder {
+
+public:
+       RegCountersInfoTlvEncoder(void);
+       /*I/p: RegisterResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegisterResp*/
+       virtual void* decode(const unsigned char *rawData);
+};
+
+#endif // REGCOUNTERSINFOTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/RegReqTlvEncoder.h b/common/uafv1tlvutil/inc/RegReqTlvEncoder.h
new file mode 100644 (file)
index 0000000..23f5183
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014 - 2015 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 REGREQTLVENCODER_H
+#define REGREQTLVENCODER_H
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+#include "IntTlvEncoder.h"
+#include "StringTlvEncoder.h"
+#include "BufferTlvEncoder.h"
+
+class RegAssertionTlvEncoder : public ITlvEncoder {
+
+public:
+       RegAssertionTlvEncoder(void);
+       /*I/p: RegAssertion, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegAssertion */
+       virtual void* decode(const unsigned char *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder  __strTlvEncoder;
+       BufferTlvEncoder __buffTlvEncoder;
+};
+
+#endif // REGREQTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/RegRespTlvEncoder.h b/common/uafv1tlvutil/inc/RegRespTlvEncoder.h
new file mode 100644 (file)
index 0000000..7eb239d
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014 - 2015 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 REGRESPTLVENCODER_H
+#define REGRESPTLVENCODER_H
+
+#include "RegAssertionInfoTlvEncoder.h"
+#include "RegCountersInfoTlvEncoder.h"
+#include "AttBasicFullTlvEncoder.h"
+#include "AttBasicSurrTlvEncoder.h"
+#include "Uafv1KrdTlvEncoder.h"
+#include "RegAuthAssertionTlvEncoder.h"
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+#include "IntTlvEncoder.h"
+#include "StringTlvEncoder.h"
+#include "BufferTlvEncoder.h"
+
+class RegRespTlvEncoder : public ITlvEncoder {
+
+public:
+       RegRespTlvEncoder(void);
+       /*I/p: RegisterResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegisterResp*/
+       virtual void* decode(const unsigned char *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder  __strTlvEncoder;
+       BufferTlvEncoder __buffTlvEncoder;
+       AttBasicFullTlvEncoder __attBasicFullTlvEncoder;
+       AttBasicSurrTlvEncoder __attBasicSurrTlvEncoder;
+       Uafv1KrdTlvEncoder __uafv1KrdTlvEncoder;
+       RegAssertionInfoTlvEncoder __assertionInfo;
+       RegCountersInfoTlvEncoder __countersInfo;
+       RegAuthAssertionTlvEncoder __regAuthAssertion;
+};
+
+#endif // REGRESPTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/SignAuthAssertionTlvEncoder.h b/common/uafv1tlvutil/inc/SignAuthAssertionTlvEncoder.h
new file mode 100644 (file)
index 0000000..5660f38
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014 - 2015 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 SIGNAUTHASSERTIONTLVENCODER_H
+#define SIGNAUTHASSERTIONTLVENCODER_H
+
+#include "SignedDataTlvEncoder.h"
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+#include "IntTlvEncoder.h"
+#include "StringTlvEncoder.h"
+#include "BufferTlvEncoder.h"
+
+class SignAuthAssertionTlvEncoder : public ITlvEncoder {
+
+public:
+       SignAuthAssertionTlvEncoder(void);
+       /*I/p: RegisterResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegisterResp*/
+       virtual void* decode(const unsigned char *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder  __strTlvEncoder;
+       BufferTlvEncoder __buffTlvEncoder;
+       SignedDataTlvEncoder __sigDataTlvEncoder;
+};
+
+#endif //SIGNAUTHASSERTIONTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/SignReqTlvEncoder.h b/common/uafv1tlvutil/inc/SignReqTlvEncoder.h
new file mode 100644 (file)
index 0000000..ecd68c1
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014 - 2015 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 SIGNREQTLVENCODER_H
+#define SIGNREQTLVENCODER_H
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+#include "IntTlvEncoder.h"
+#include "StringTlvEncoder.h"
+#include "BufferTlvEncoder.h"
+
+class SignReqTlvEncoder : public ITlvEncoder {
+
+public:
+       SignReqTlvEncoder(void);
+       /*I/p: RegisterResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegisterResp*/
+       virtual void* decode(const unsigned char *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder  __strTlvEncoder;
+       BufferTlvEncoder __buffTlvEncoder;
+};
+
+#endif // SIGNREQTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/SignRespTlvEncoder.h b/common/uafv1tlvutil/inc/SignRespTlvEncoder.h
new file mode 100644 (file)
index 0000000..b713bda
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014 - 2015 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 SIGNRESPTLVENCODER_H
+#define SIGNRESPTLVENCODER_H
+
+#include "AuthAssertionInfoTlvEncoder.h"
+#include "AuthCountersInfoTlvEncoder.h"
+#include "SignedDataTlvEncoder.h"
+#include "SignAuthAssertionTlvEncoder.h"
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+#include "IntTlvEncoder.h"
+#include "StringTlvEncoder.h"
+#include "BufferTlvEncoder.h"
+
+class UserNameKhTlvEncoder : public ITlvEncoder {
+
+public:
+       UserNameKhTlvEncoder(void);
+       /*I/p: RegisterResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegisterResp*/
+       virtual void* decode(const unsigned char *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder  __strTlvEncoder;
+       BufferTlvEncoder __buffTlvEncoder;
+};
+
+class SignRespTlvEncoder : public ITlvEncoder {
+
+public:
+       SignRespTlvEncoder(void);
+       /*I/p: RegisterResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegisterResp*/
+       virtual void* decode(const unsigned char *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder  __strTlvEncoder;
+       BufferTlvEncoder __buffTlvEncoder;
+       UserNameKhTlvEncoder __uKhTlvEncoder;
+       SignedDataTlvEncoder __sigDataTlvEncoder;
+       SignAuthAssertionTlvEncoder __signAuthAssertionInfo;
+       AuthAssertionInfoTlvEncoder __assertionInfo;
+       AuthCountersInfoTlvEncoder __counterInfo;
+};
+
+#endif //SIGNRESPTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/SignedDataTlvEncoder.h b/common/uafv1tlvutil/inc/SignedDataTlvEncoder.h
new file mode 100644 (file)
index 0000000..b13de53
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014 - 2015 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 SIGNEDDATATLVENCODER_H
+#define SIGNEDDATATLVENCODER_H
+
+#include "AuthAssertionInfoTlvEncoder.h"
+#include "AuthCountersInfoTlvEncoder.h"
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+#include "IntTlvEncoder.h"
+#include "StringTlvEncoder.h"
+#include "BufferTlvEncoder.h"
+
+class SignedDataTlvEncoder : public ITlvEncoder {
+
+public:
+       SignedDataTlvEncoder(void);
+       /*I/p: RegisterResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegisterResp*/
+       virtual void* decode(const unsigned char *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder  __strTlvEncoder;
+       BufferTlvEncoder __buffTlvEncoder;
+       AuthAssertionInfoTlvEncoder __assertionInfo;
+       AuthCountersInfoTlvEncoder __counterInfo;
+};
+
+#endif //SIGNEDDATATLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/StringTlvEncoder.h b/common/uafv1tlvutil/inc/StringTlvEncoder.h
new file mode 100644 (file)
index 0000000..a149851
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014 - 2015 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 STRTLVENCODER_H
+#define STRTLVENCODER_H
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+
+class StringTlvEncoder : public ITlvEncoder
+{
+
+public:
+       StringTlvEncoder(void);
+
+       /*I/P : tlv_s*/
+       virtual Buffer *encode(const void *strTlv);
+
+       virtual void* decode(const uint8_t *rawData);
+};
+
+#endif // STRTLVENCODER_H
diff --git a/common/uafv1tlvutil/inc/Tlv.h b/common/uafv1tlvutil/inc/Tlv.h
new file mode 100644 (file)
index 0000000..32723b2
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2014 - 2015 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 TLV_H
+#define TLV_H
+
+#include <stdlib.h>
+#include <tizen.h>
+#include <stdint.h>
+#include <glib.h>
+#include "AuthnrTypes.h"
+
+const int TAG_UAFV1_GETINFO_CMD  = 0x3401;
+const int TAG_UAFV1_GETINFO_CMD_RESPONSE = 0x3601;
+const int TAG_UAFV1_REGISTER_CMD       = 0x3402;
+const int TAG_UAFV1_REGISTER_CMD_RESPONSE      = 0x3602;
+const int TAG_UAFV1_SIGN_CMD   = 0x3403;
+const int TAG_UAFV1_SIGN_CMD_RESPONSE  = 0x3603;
+const int TAG_UAFV1_DEREGISTER_CMD     = 0x3404;
+const int TAG_UAFV1_DEREGISTER_CMD_RESPONSE    = 0x3604;
+const int TAG_UAFV1_OPEN_SETTINGS_CMD  = 0x3406;
+const int TAG_UAFV1_OPEN_SETTINGS_CMD_RESPONSE = 0x3606;
+
+const int TAG_API_VERSION      = 0x280E;
+const int TAG_STATUS_CODE      = 0x2808;
+const int TAG_AUTHENTICATOR_INFO       = 0x3811;
+const int TAG_AUTHENTICATOR_INDEX      = 0x280D;
+const int TAG_AAID     = 0x2E0B;
+const int TAG_AUTHENTICATOR_METADATA   = 0x2809;
+const int TAG_ASSERTION_SCHEME = 0x280A;
+const int TAG_TC_DISPLAY_PNG_CHARACTERISTICS   = 0x280B;
+const int TAG_TC_DISPLAY_CONTENT_TYPE  = 0x280C;
+const int TAG_AUTHENTICATOR_ASSERTION  = 0x280F;
+const int TAG_TRANSACTION_CONTENT      = 0x2810;
+const int TAG_SUPPORTED_EXTENSION_ID   = 0x2812;
+
+const int TAG_UAFV1_REG_ASSERTION      = 0x3E01;
+const int TAG_UAFV1_AUTH_ASSERTION     = 0x3E02;
+const int TAG_UAFV1_KRD        = 0x3E03;
+const int TAG_UAFV1_SIGNED_DATA        = 0x3E04;
+const int TAG_ATTESTATION_CERT = 0x2E05;
+const int TAG_SIGNATURE        = 0x2E06;
+const int TAG_ATTESTATION_BASIC_FULL   = 0x3E07;
+const int TAG_ATTESTATION_BASIC_SURROGATE      = 0x3E08;
+const int TAG_KEYID    = 0x2E09;
+const int TAG_FINAL_CHALLENGE  = 0x2E0A;
+//const int TAG_AAID   = 0x2E0B;
+const int TAG_PUB_KEY  = 0x2E0C;
+const int TAG_COUNTERS = 0x2E0D;
+const int TAG_ASSERTION_INFO   = 0x2E0E;
+const int TAG_AUTHENTICATOR_NONCE      = 0x2E0F;
+const int TAG_TRANSACTION_CONTENT_HASH = 0x2E10;
+const int TAG_EXTENSION        = 0x3E11;
+const int TAG_EXTENSION_ID     = 0x2E13;
+const int TAG_EXTENSION_DATA   = 0x2E14;
+
+const int TAG_KEYHANDLE        = 0x2801;
+const int TAG_USERNAME_AND_KEYHANDLE   = 0x3802;
+const int TAG_USERVERIFY_TOKEN = 0x2803;
+const int TAG_APPID    = 0x2804;
+const int TAG_KEYHANDLE_ACCESS_TOKEN   = 0x2805;
+const int TAG_USERNAME = 0x2806;
+const int TAG_ATTESTATION_TYPE = 0x2807;
+
+
+typedef struct __attribute__((packed))_tlv {
+       uint16_t tag;
+       uint16_t len;
+       uint8_t *val;
+} tlv_s;
+
+Buffer* tlv_to_buffer(tlv_s *tlv);
+
+tlv_s* tlv_decode(const uint8_t *tlv_buffer_in);
+
+int tlv_get_int_by_reverse_endian(const unsigned char *tlv_buffer_in, int bytes);
+
+typedef struct _tlv_builder {
+       GQueue *stack;
+       tlv_s *root;
+} tlv_builder_s;
+
+
+/*TLV builder APIs*/
+tlv_builder_s* tlv_builder_create(void);
+
+tlv_builder_s* tlv_builder_start_composite(tlv_builder_s* builder, int tag);
+
+tlv_builder_s* tlv_builder_add_int8(tlv_builder_s* builder, int tag, uint8_t val);
+tlv_builder_s* tlv_builder_add_int16(tlv_builder_s* builder, int tag, uint16_t val);
+tlv_builder_s* tlv_builder_add_string(tlv_builder_s* builder, int tag, char *val);
+tlv_builder_s* tlv_builder_add_buffer(tlv_builder_s* builder, int tag, Buffer *val);
+
+tlv_builder_s* tlv_builder_end_composite(tlv_builder_s* builder);
+
+Buffer* tlv_builder_get_buffer(tlv_builder_s* builder);
+
+/*TLV builder APIs*/
+
+#endif // TLV_H
diff --git a/common/uafv1tlvutil/inc/TlvData.h b/common/uafv1tlvutil/inc/TlvData.h
new file mode 100644 (file)
index 0000000..ad2fe94
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014 - 2015 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 TLV_DATA_H_
+#define TLV_DATA_H_
+
+#include <string.h>
+#include <tizen.h>
+#include <map>
+#include "ITlvEncoder.h"
+
+typedef enum {
+       EID_UAFV1_GETINFO_REQ,
+       EID_UAFV1_GETINFO_RESP,
+       EID_UAFV1_REGISTER_REQ,
+       EID_UAFV1_REGISTER_RESP,
+       EID_UAFV1_REG_ASSERTION_RESP,
+       EID_UAFV1_REG_ASSERTION_KRD_RESP,
+       EID_UAFV1_SIGN_REQ,
+       EID_UAFV1_SIGN_RESP,
+       EID_UAFV1_SIGN_ASSERTION_RESP,
+       EID_UAFV1_SIGN_DATA_RESP,
+       EID_UAFV1_DEREG_REQ,
+       EID_UAFV1_DEREG_RESP,
+       EID_UAFV1_OPEN_SETTINGS_REQ,
+       EID_UAFV1_OPEN_SETTINGS_RESP
+} EncoderId;
+
+class TlvEncoderFactory
+{
+public:
+       static ITlvEncoder* getTlvEncoderById(int id);
+private:
+       TlvEncoderFactory(void);
+       static std::map<int, ITlvEncoder*>* loadAllEncoders(void);
+
+private:
+       static std::map<int, ITlvEncoder*> *__encoderTable;
+};
+
+template <class T>
+class TlvEncodable {
+public:
+       TlvEncodable(void)
+       {
+               __authData = NULL;
+       }
+
+       TlvEncodable(const T *authData) : __authData(authData){}
+
+       virtual ~TlvEncodable(void){}
+
+       int setEncoder(int encId)
+       {
+               __encoder = TlvEncoderFactory::getTlvEncoderById(encId);
+               if (__encoder == NULL)
+                       return -1;
+
+               return 0;
+       }
+
+       Buffer* encode(void)
+       {
+               return __encoder->encode(__authData);
+       }
+
+       T* decode(const unsigned char *encData)
+       {
+               return static_cast<T*>(__encoder->decode(encData));
+       }
+
+private:
+       const T *__authData;
+       ITlvEncoder *__encoder;
+};
+
+#endif /* TLV_DATA_H_ */
diff --git a/common/uafv1tlvutil/inc/Uafv1KrdTlvEncoder.h b/common/uafv1tlvutil/inc/Uafv1KrdTlvEncoder.h
new file mode 100644 (file)
index 0000000..271acae
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014 - 2015 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 UAFV1KRDTLVENCODER_H
+#define UAFV1KRDTLVENCODER_H
+
+#include "RegAssertionInfoTlvEncoder.h"
+#include "RegCountersInfoTlvEncoder.h"
+
+#include <tizen.h>
+#include "TlvData.h"
+#include "ITlvEncoder.h"
+#include "IntTlvEncoder.h"
+#include "StringTlvEncoder.h"
+#include "BufferTlvEncoder.h"
+
+class Uafv1KrdTlvEncoder : public ITlvEncoder {
+
+public:
+       Uafv1KrdTlvEncoder(void);
+       /*I/p: RegisterResp, O/p: TLV raw data*/
+       virtual Buffer *encode(const void *authData);
+
+       /*I/p: TLV raw data, O/p: RegisterResp*/
+       virtual void* decode(const unsigned char *rawData);
+
+private:
+       IntTlvEncoder __intTlvEncoder;
+       StringTlvEncoder  __strTlvEncoder;
+       BufferTlvEncoder __buffTlvEncoder;
+       RegAssertionInfoTlvEncoder __assertionInfo;
+       RegCountersInfoTlvEncoder __countersInfo;
+};
+
+#endif // UAFV1KRDTLVENCODER_H
diff --git a/common/uafv1tlvutil/src/AttBasicFullTlvEncoder.cpp b/common/uafv1tlvutil/src/AttBasicFullTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..617ba9d
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AttBasicFullTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+#include "stdio.h"
+
+AttBasicFullTlvEncoder::AttBasicFullTlvEncoder(void)
+{
+
+}
+
+Buffer *
+AttBasicFullTlvEncoder::encode(const void *authData)
+{
+       _BEGIN;
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       AttestationBasicFull *getAttBasicFullInfo = (AttestationBasicFull*)authData;
+
+       tlv_builder_s *builder = tlv_builder_create();
+
+       /*1.3(choice 1) TAG_ATTESTATION_BASIC_FULL*/
+       tlv_builder_start_composite(builder, TAG_ATTESTATION_BASIC_FULL);
+
+       /*1.3.2 TAG_SIGNATURE*/
+       tlv_builder_add_buffer(builder, TAG_SIGNATURE, getAttBasicFullInfo->sig);
+
+       /*1.3.3 TAG_ATTESTATION_CERT */
+       tlv_builder_add_buffer(builder, TAG_ATTESTATION_CERT, getAttBasicFullInfo->cert);
+
+       /*1.3(choice 1) end*/
+       tlv_builder_end_composite(builder);
+
+       _END;
+       return tlv_builder_get_buffer(builder);
+}
+
+void *
+AttBasicFullTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("AttBasicFullTlvEncoder::decode start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+       RET_IF_FAIL(root->tag == TAG_ATTESTATION_BASIC_FULL, NULL);
+
+       int rawIter = 2 + 2;
+       int endIter = rawIter + root->len;
+
+       AttestationBasicFull *getAttBasicFullInfo = ALLOC(AttestationBasicFull);
+
+       tlv_s *child = tlv_decode(rawData + rawIter);
+       RET_IF_FAIL(child != NULL, NULL);
+
+       bool foundMember = false;
+
+       while(1) {
+
+               switch(child->tag) {
+
+                       case TAG_SIGNATURE:
+                               _INFO("");
+                               getAttBasicFullInfo->sig = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       case TAG_ATTESTATION_CERT:
+                               _INFO("");
+                               getAttBasicFullInfo->cert = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       default:
+                               _INFO("");
+                               foundMember = false;
+                               break;
+               }
+
+               _INFO("");
+               rawIter = rawIter + 2 + 2 + child->len;
+               if(rawIter >= endIter)
+                       break;
+
+               child = tlv_decode(rawData + rawIter);
+               RET_IF_FAIL(child != NULL, NULL);
+       }
+
+       if(foundMember == false) {
+               free(getAttBasicFullInfo);
+               return NULL;
+       }
+
+       _INFO("AttBasicFullTlvEncoder::decode end");
+       return getAttBasicFullInfo;
+}
diff --git a/common/uafv1tlvutil/src/AttBasicSurrTlvEncoder.cpp b/common/uafv1tlvutil/src/AttBasicSurrTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..606be95
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AttBasicSurrTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+#include "stdio.h"
+
+AttBasicSurrTlvEncoder::AttBasicSurrTlvEncoder(void)
+{
+
+}
+
+Buffer *
+AttBasicSurrTlvEncoder::encode(const void *authData)
+{
+       _BEGIN;
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       AttestationBasicSurrogate *getAttSurrInfo = (AttestationBasicSurrogate*)authData;
+
+       tlv_builder_s *builder = tlv_builder_create();
+
+       /*1.3(choice 2) TAG_ATTESTATION_BASIC_SURROGATE*/
+       tlv_builder_start_composite(builder, TAG_ATTESTATION_BASIC_SURROGATE);
+
+       /*1.3.2 TAG_SIGNATURE*/
+       tlv_builder_add_buffer(builder, TAG_SIGNATURE, getAttSurrInfo->sig);
+
+       /*1.3(choice 2) end*/
+       tlv_builder_end_composite(builder);
+
+       _END;
+       return tlv_builder_get_buffer(builder);
+}
+
+void *
+AttBasicSurrTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("AttBasicSurrTlvEncoder::decode start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+       RET_IF_FAIL(root->tag == TAG_ATTESTATION_BASIC_SURROGATE, NULL);
+
+       int rawIter = 2 + 2;
+       int endIter = rawIter + root->len;
+
+       AttestationBasicSurrogate *getAttBasicSurrInfo = ALLOC(AttestationBasicSurrogate);
+
+       tlv_s *child = tlv_decode(rawData + rawIter);
+       RET_IF_FAIL(child != NULL, NULL);
+
+       bool foundMember = false;
+
+       while(1) {
+
+               switch(child->tag) {
+
+                       case TAG_SIGNATURE:
+                               getAttBasicSurrInfo->sig = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       default:
+                               foundMember = false;
+                               break;
+               }
+
+               rawIter = rawIter + 2 + 2 + child->len;
+               if(rawIter >= endIter)
+                       break;
+
+               child = tlv_decode(rawData + rawIter);
+               RET_IF_FAIL(child != NULL, NULL);
+       }
+
+       if(foundMember == false) {
+               free(getAttBasicSurrInfo);
+               return NULL;
+       }
+
+       _INFO("AttBasicSurrTlvEncoder::decode end");
+       return getAttBasicSurrInfo;
+}
diff --git a/common/uafv1tlvutil/src/AuthAssertionInfoTlvEncoder.cpp b/common/uafv1tlvutil/src/AuthAssertionInfoTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..32cb888
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AuthAssertionInfoTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+AuthAssertionInfoTlvEncoder::AuthAssertionInfoTlvEncoder(void)
+{
+
+}
+
+Buffer *
+AuthAssertionInfoTlvEncoder::encode(const void *authData)
+{
+       _INFO("AuthAssertionInfoTlvEncoder::encode start");
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       AssertionInfo *getAssertionInfo = (AssertionInfo*)authData;
+
+       int getAssertionInfoLen = 2 * sizeof(uint8_t);
+
+       getAssertionInfoLen += 1 * sizeof(uint8_t);
+
+       getAssertionInfoLen += 2 * sizeof(uint8_t);
+
+       Buffer *getAssertionInfoBuff = ALLOC(Buffer);
+       getAssertionInfoBuff->len = getAssertionInfoLen;
+       getAssertionInfoBuff->data = NALLOC(getAssertionInfoLen, uint8_t);
+       uint8_t *iter = getAssertionInfoBuff->data;
+
+       *iter = getAssertionInfo->authVersion & 0xFF;
+       iter++;
+       *iter = (getAssertionInfo->authVersion >> 8) & 0xFF;
+       iter++;
+
+       *iter = getAssertionInfo->authMode & 0xFF;
+       iter++;
+
+       *iter = getAssertionInfo->signatureAlgAndEncoding & 0xFF;
+       iter++;
+       *iter = (getAssertionInfo->signatureAlgAndEncoding >> 8) & 0xFF;
+       iter++;
+
+       _INFO("AuthAssertionInfoTlvEncoder::encode end");
+       return getAssertionInfoBuff;
+}
+
+void *
+AuthAssertionInfoTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("AuthAssertionInfoTlvEncoder::decode start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+
+       uint8_t rawIter = 0;
+       uint8_t endIter = rawIter + root->len;
+       uint8_t *root_val = root->val;
+
+       AssertionInfo *getAssertionInfo = ALLOC(AssertionInfo);
+
+       getAssertionInfo->authVersion = tlv_get_int_by_reverse_endian(root_val, 2);
+       _INFO("authVersion [%d]", getAssertionInfo->authVersion);
+       rawIter += 2;
+       CATCH_IF_FAIL(rawIter < endIter);
+
+       getAssertionInfo->authMode = tlv_get_int_by_reverse_endian(root_val + rawIter, 1);
+       _INFO("authMode [%d]", getAssertionInfo->authMode);
+       rawIter += 1;
+       CATCH_IF_FAIL(rawIter < endIter);
+
+       getAssertionInfo->signatureAlgAndEncoding = tlv_get_int_by_reverse_endian(root_val + rawIter, 2);
+       _INFO("signatureAlgAndEncoding [%d]", getAssertionInfo->signatureAlgAndEncoding);
+       rawIter += 2;
+
+CATCH:
+       _INFO("AuthAssertionInfoTlvEncoder::decode end");
+       return getAssertionInfo;
+}
diff --git a/common/uafv1tlvutil/src/AuthCountersInfoTlvEncoder.cpp b/common/uafv1tlvutil/src/AuthCountersInfoTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..463d3c3
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AuthCountersInfoTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+AuthCountersInfoTlvEncoder::AuthCountersInfoTlvEncoder(void)
+{
+
+}
+
+Buffer *
+AuthCountersInfoTlvEncoder::encode(const void *authData)
+{
+       _INFO("AuthCountersInfoTlvEncoder::encode start");
+       Counters *getCounterInfo = (Counters*)authData;
+
+       int getCounterInfoLen = 4 * sizeof(uint8_t);
+
+       Buffer *getCounterInfoBuff = ALLOC(Buffer);
+       getCounterInfoBuff->len = getCounterInfoLen;
+       getCounterInfoBuff->data = NALLOC(getCounterInfoLen, uint8_t);
+       uint8_t *iter = getCounterInfoBuff->data;
+
+       *iter = getCounterInfo->signCounter & 0xFF;
+       iter++;
+       *iter = (getCounterInfo->signCounter >> 8) & 0xFF;
+       iter++;
+       *iter = (getCounterInfo->signCounter >> 16) & 0xFF;
+       iter++;
+       *iter = (getCounterInfo->signCounter >> 24) & 0xFF;
+       iter++;
+
+       _INFO("AuthCountersInfoTlvEncoder::encode end");
+       return getCounterInfoBuff;
+}
+
+void *
+AuthCountersInfoTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("AuthCountersInfoTlvEncoder::decode start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+
+       uint8_t rawIter = 0;
+       uint8_t *root_val = root->val;
+
+       Counters *getCountersInfo = ALLOC(Counters);
+
+       getCountersInfo->signCounter = tlv_get_int_by_reverse_endian(root_val, 4);
+       _INFO("signCounter [%d]", getCountersInfo->signCounter);
+       rawIter += 2;
+
+       _INFO("AuthCountersInfoTlvEncoder::decode end");
+       return getCountersInfo;
+}
diff --git a/common/uafv1tlvutil/src/BufferTlvEncoder.cpp b/common/uafv1tlvutil/src/BufferTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..e5d5d98
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "BufferTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+BufferTlvEncoder::BufferTlvEncoder(void)
+{
+
+}
+
+Buffer *
+BufferTlvEncoder::encode(const void *strTlv)
+{
+       return NULL;
+}
+
+void*
+BufferTlvEncoder::decode(const uint8_t *rawData)
+{
+       _INFO("BufferTlvEncoder start");
+
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *tlv  = tlv_decode(rawData);
+       RET_IF_FAIL(tlv != NULL, NULL);
+
+       Buffer *getBuffInfo = ALLOC(Buffer);
+
+       getBuffInfo->data = tlv->val;
+       getBuffInfo->len = tlv->len;
+
+       _INFO("BufferTlvEncoder end");
+       return getBuffInfo;
+}
diff --git a/common/uafv1tlvutil/src/DeRegReqTlvEncoder.cpp b/common/uafv1tlvutil/src/DeRegReqTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..d471d4e
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "DeRegReqTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+DeRegReqTlvEncoder::DeRegReqTlvEncoder(void)
+{
+
+}
+
+Buffer *
+DeRegReqTlvEncoder::encode(const void *authData)
+{
+       _INFO("DeRegReqTlvEncoder::encode start");
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       DeregReq *getDeRegReqInfo = (DeregReq*)authData;
+
+       _INFO("");
+       tlv_builder_s *builder = tlv_builder_create();
+
+       _INFO("");
+       /*1. TAG_UAFV1_DEREGISTER_CMD*/
+       tlv_builder_start_composite(builder, TAG_UAFV1_DEREGISTER_CMD);
+
+       _INFO("");
+       /*1.2 TAG_AUTHENTICATOR_INDEX*/
+       tlv_builder_add_int8(builder, TAG_AUTHENTICATOR_INDEX, getDeRegReqInfo->authIdx);
+
+       _INFO("");
+       /*1.3 TAG_APPID*/
+       tlv_builder_add_string(builder, TAG_APPID, getDeRegReqInfo->appId);
+
+       _INFO("");
+       /*1.4 TAG_KEYID*/
+       tlv_builder_add_string(builder, TAG_KEYID, getDeRegReqInfo->keyId);
+
+       _INFO("");
+       /*1.5 TAG_KEYHANDLE_ACCESS_TOKEN*/
+       tlv_builder_add_buffer(builder, TAG_KEYHANDLE_ACCESS_TOKEN, getDeRegReqInfo->khATok);
+
+       _INFO("");
+       /*1. end*/
+       tlv_builder_end_composite(builder);
+
+       _INFO("DeRegReqTlvEncoder::encode end");
+       return tlv_builder_get_buffer(builder);
+}
+
+void *
+DeRegReqTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("DeRegReqTlvEncoder::decode start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+       RET_IF_FAIL(root->tag == TAG_UAFV1_DEREGISTER_CMD, NULL);
+
+       int rawIter = 2 + 2;
+       int endIter = rawIter + root->len;
+
+       tlv_s *child = tlv_decode(rawData + rawIter);
+       RET_IF_FAIL(child != NULL, NULL);
+
+       DeregReq *getDeRegReqInfo = ALLOC(DeregReq);
+
+       bool foundMember = false;
+
+       while(1) {
+
+               switch(child->tag) {
+
+               case TAG_AUTHENTICATOR_INDEX:
+                       getDeRegReqInfo->authIdx = *(int*)__intTlvEncoder.decode(rawData + rawIter);
+                       _INFO("authIdx [%d]", getDeRegReqInfo->authIdx);
+                       foundMember = true;
+                       break;
+
+               case TAG_APPID:
+                       getDeRegReqInfo->appId = (char*)__strTlvEncoder.decode(rawData + rawIter);
+                       _INFO("appId [%s]", getDeRegReqInfo->appId);
+                       foundMember = true;
+                       break;
+
+               case TAG_KEYID:
+                       getDeRegReqInfo->keyId = (char*)__strTlvEncoder.decode(rawData + rawIter);
+                       _INFO("keyId [%s]", getDeRegReqInfo->keyId);
+                       foundMember = true;
+                       break;
+
+               case TAG_KEYHANDLE_ACCESS_TOKEN:
+                       getDeRegReqInfo->khATok = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                       _INFO("keyHandleAccessToken [%s]", getDeRegReqInfo->khATok);
+                       foundMember = true;
+                       break;
+
+               default:
+                       foundMember = false;
+                       break;
+               }
+
+               rawIter = rawIter + 2 + 2 + child->len;
+               if(rawIter >= endIter)
+                       break;
+
+               child = tlv_decode(rawData + rawIter);
+               RET_IF_FAIL(child != NULL, NULL);
+       }
+
+       if(foundMember == false) {
+               free(getDeRegReqInfo);
+               return NULL;
+       }
+
+       _INFO("DeRegReqTlvEncoder::decode end");
+       return getDeRegReqInfo;
+}
diff --git a/common/uafv1tlvutil/src/DeRegRespTlvEncoder.cpp b/common/uafv1tlvutil/src/DeRegRespTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..f74e3c3
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "DeRegRespTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+DeRegRespTlvEncoder::DeRegRespTlvEncoder(void)
+{
+
+}
+
+Buffer *
+DeRegRespTlvEncoder::encode(const void *authData)
+{
+       _INFO("DeRegRespTlvEncoder::encode start");
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       DeregResp *getDeRegRespInfo = (DeregResp*)authData;
+
+       tlv_builder_s *builder = tlv_builder_create();
+
+       /*1. TAG_UAFV1_DEREGISTER_CMD_RESPONSE*/
+       tlv_builder_start_composite(builder, TAG_UAFV1_DEREGISTER_CMD_RESPONSE);
+
+       /*1.2 TAG_STATUS_CODE*/
+       tlv_builder_add_int16(builder, TAG_STATUS_CODE, getDeRegRespInfo->statusCode);
+
+       /*1. end*/
+       tlv_builder_end_composite(builder);
+
+       _INFO("DeRegRespTlvEncoder::encode end");
+       return tlv_builder_get_buffer(builder);
+}
+
+void *
+DeRegRespTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("DeRegRespTlvEncoder::decode start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+       RET_IF_FAIL(root->tag == TAG_UAFV1_DEREGISTER_CMD_RESPONSE, NULL);
+
+       DeregResp *getDeRegRespInfo = ALLOC(DeregResp);
+
+       int rawIter = 2 + 2;
+
+       tlv_s *child = tlv_decode(rawData + rawIter);
+       RET_IF_FAIL(child != NULL, NULL);
+
+       bool foundMember = false;
+
+       if(child->tag == TAG_STATUS_CODE) {
+               getDeRegRespInfo->statusCode = *(int*)__intTlvEncoder.decode(rawData + rawIter);
+               _INFO("statusCode [%d]", getDeRegRespInfo->statusCode);
+               foundMember = true;
+       }
+
+       if(foundMember == false) {
+               free(getDeRegRespInfo);
+               return NULL;
+       }
+
+       _INFO("DeRegRespTlvEncoder::decode end");
+       return getDeRegRespInfo;
+}
diff --git a/common/uafv1tlvutil/src/GetInfoReqTlvEncoder.cpp b/common/uafv1tlvutil/src/GetInfoReqTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..19dfd5f
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2014 - 2015 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 <GetInfoReqTlvEncoder.h>
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+GetInfoReqTlvEncoder::~GetInfoReqTlvEncoder(void)
+{
+}
+
+Buffer *
+GetInfoReqTlvEncoder::encode(const void *authData)
+{
+       _INFO("GetInfoReqTlvEncoder::encode start");
+
+       tlv_s *tlv = (tlv_s*)(calloc(1, sizeof(tlv_s)));
+       tlv->tag = TAG_UAFV1_GETINFO_CMD;
+       tlv->len = 0;
+
+       _INFO("GetInfoReqTlvEncoder::encode end");
+       return tlv_to_buffer(tlv);
+}
+
+void*
+GetInfoReqTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("GetInfoReqTlvEncoder::decode start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+       RET_IF_FAIL(root->tag == TAG_UAFV1_GETINFO_CMD, NULL);
+
+       GetInfoReq *getInfoReqInfo = ALLOC(GetInfoReq);
+       getInfoReqInfo->tag = TAG_UAFV1_GETINFO_CMD;
+
+       _INFO("GetInfoReqTlvEncoder::decode end");
+       return getInfoReqInfo;
+}
+
+GetInfoReqTlvEncoder::GetInfoReqTlvEncoder(void)
+{
+}
+
diff --git a/common/uafv1tlvutil/src/GetInfoRespTlvEncoder.cpp b/common/uafv1tlvutil/src/GetInfoRespTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..a08074f
--- /dev/null
@@ -0,0 +1,678 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "GetInfoRespTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+#define GET_INT_FROM_BUFFER(val, ptr) do {\
+       if ((ptr == NULL)) {\
+               val = -1;\
+       }\
+       else {\
+               val = *((int *)(ptr));\
+       }\
+} while (0)
+
+#define GET_STR_FROM_BUFFER(val, ptr) do {\
+       if ((ptr == NULL)) {\
+               val = NULL;\
+       }\
+       else {\
+               val = (char *)(ptr);\
+       }\
+} while (0)
+
+#define CREATE_INT_TLV_BUFF(tagName, lenVal, valData, iter, rootBuff) do {\
+       tlv_s *tlv = (tlv_s*)calloc(1, sizeof(tlv_s)); \
+       tlv->tag = tagName; \
+       tlv->len = lenVal; \
+       tlv->val = (uint8_t*)calloc(1, sizeof(uint8_t));\
+       *(tlv->val) = valData; \
+\
+       Buffer *tlvBuff = __intTlvEncoder.encode(tlv); \
+       rootBuff->len += tlvBuff->len; \
+       memcpy(iter, tlvBuff->data, tlvBuff->len); \
+       iter += tlvBuff->len; \
+       } while (0)
+
+#define CREATE_STR_TLV_BUFF(tagName, lenVal, valData, iter, rootBuff) do {\
+               if (valData != NULL) {\
+                       tlv_s *tlv = (tlv_s*)calloc(1, sizeof(tlv_s)); \
+                       tlv->tag = tagName; \
+                       tlv->len = lenVal; \
+                       tlv->val = (uint8_t *)valData; \
+                       \
+                       Buffer *tlvBuff = __strTlvEncoder.encode(tlv); \
+                       rootBuff->len += tlvBuff->len; \
+                       memcpy(iter, tlvBuff->data, tlvBuff->len); \
+                       iter += tlvBuff->len; \
+               }\
+       } while (0)
+
+AuthMetaTlvEncoder::AuthMetaTlvEncoder(void)
+{
+
+}
+
+Buffer *
+AuthMetaTlvEncoder::encode(const void *authData)
+{
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       AuthenticatorMetaData *meta = (AuthenticatorMetaData*)authData;
+
+       int metabuffLen = 2 * sizeof(uint8_t);
+
+       metabuffLen += sizeof(uint8_t);
+
+       metabuffLen += 4 * sizeof(uint8_t);
+
+       metabuffLen += 2 * sizeof(uint8_t);
+
+       metabuffLen += 2 * sizeof(uint8_t);
+
+       metabuffLen += 2 * sizeof(uint8_t);
+
+       metabuffLen += 2 * sizeof(uint8_t);
+
+       Buffer *metaBuff = ALLOC(Buffer);
+       metaBuff->len = metabuffLen;
+       metaBuff->data = NALLOC(metaBuff->len, uint8_t);
+       uint8_t *iter = metaBuff->data;
+
+
+
+       /*AuthenticatorType 2*/
+       *iter = meta->authenticatorType & 0xFF;
+       iter++;
+       *iter = (meta->authenticatorType >> 8) & 0xFF;
+       iter++;
+
+       /*MaxKeyHandles 1*/
+       *iter = meta->maxKeyHandles & 0xFF;
+       iter++;
+
+       /*UserVerification 4*/
+       *iter = meta->userVerification & 0xFF;
+       iter++;
+       *iter = (meta->userVerification >> 8) & 0xFF;
+       iter++;
+       *iter = (meta->userVerification >> 16) & 0xFF;
+       iter++;
+       *iter = (meta->userVerification >> 24) & 0xFF;
+       iter++;
+
+       /*KeyProtection 2*/
+       *iter = meta->keyProtection & 0xFF;
+       iter++;
+       *iter = (meta->keyProtection >> 8) & 0xFF;
+       iter++;
+
+       /*matcherProtection 2*/
+       *iter = meta->matcherProtection & 0xFF;
+       iter++;
+       *iter = (meta->matcherProtection >> 8) & 0xFF;
+       iter++;
+
+       /*TransactionConfirmationDisplay 2*/
+       *iter = meta->transactionConfirmationDisplay & 0xFF;
+       iter++;
+       *iter = (meta->transactionConfirmationDisplay >> 8) & 0xFF;
+       iter++;
+
+       /*AuthenticationAlg 2*/
+       *iter = meta->authenticationAlg & 0xFF;
+       iter++;
+       *iter = (meta->authenticationAlg >> 8) & 0xFF;
+       iter++;
+
+       return metaBuff;
+}
+
+void*
+AuthMetaTlvEncoder::decode(const uint8_t *rawData)
+{
+       _INFO("AuthMetaTlvEncoder start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *tlv  = tlv_decode(rawData);
+       RET_IF_FAIL(tlv != NULL, NULL);
+
+       _INFO("AuthMetaTlvEncoder after root decode");
+
+       uint8_t rawIter = 0;
+       uint8_t end_iter = tlv->len;
+       uint8_t *tlv_val = tlv->val;
+
+       AuthenticatorMetaData *meta = (AuthenticatorMetaData*)calloc(1, sizeof(AuthenticatorMetaData));
+
+       meta->authenticatorType = tlv_get_int_by_reverse_endian(tlv_val, 2);
+       _INFO("authenticatorType [%d]", meta->authenticatorType);
+       rawIter += 2;
+       CATCH_IF_FAIL(rawIter < end_iter);
+
+       meta->maxKeyHandles = tlv_get_int_by_reverse_endian(tlv_val + rawIter, 1);
+       _INFO("maxKeyHandles [%d]", meta->maxKeyHandles);
+       rawIter += 1;
+       CATCH_IF_FAIL(rawIter < end_iter);
+
+       meta->userVerification = tlv_get_int_by_reverse_endian(tlv_val + rawIter, 4);
+       _INFO("userVerification [%d]", meta->userVerification);
+       rawIter += 4;
+       CATCH_IF_FAIL(rawIter < end_iter);
+
+       meta->keyProtection = tlv_get_int_by_reverse_endian(tlv_val + rawIter, 2);
+       _INFO("keyProtection [%d]", meta->keyProtection);
+       rawIter += 2;
+       CATCH_IF_FAIL(rawIter < end_iter);
+
+       meta->matcherProtection = tlv_get_int_by_reverse_endian(tlv_val+ rawIter, 2);
+       _INFO("matcherProtection [%d]", meta->matcherProtection);
+       rawIter += 2;
+       CATCH_IF_FAIL(rawIter < end_iter);
+
+       meta->transactionConfirmationDisplay = tlv_get_int_by_reverse_endian(tlv_val + rawIter, 2);
+       _INFO("transactionConfirmationDisplay [%d]", meta->transactionConfirmationDisplay);
+       rawIter += 2;
+       CATCH_IF_FAIL(rawIter < end_iter);
+
+       meta->authenticationAlg = tlv_get_int_by_reverse_endian(tlv_val + rawIter, 2);
+       _INFO("authenticationAlg [%d]", meta->authenticationAlg);
+       rawIter += 2;
+
+
+CATCH:
+       _INFO("AuthMetaTlvEncoder end");
+       return meta;
+}
+
+TcDispPNGChTlvEncoder::TcDispPNGChTlvEncoder(void)
+{
+
+}
+
+Buffer *
+TcDispPNGChTlvEncoder::encode(const void *authData)
+{
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       DisplayTc *disp = (DisplayTc*)authData;
+
+       int tcDispBuffLen = 4*sizeof(uint8_t);
+
+       tcDispBuffLen += 4*sizeof(uint8_t);
+
+       tcDispBuffLen += 1*sizeof(uint8_t);
+
+       tcDispBuffLen += 1*sizeof(uint8_t);
+
+       tcDispBuffLen += 1*sizeof(uint8_t);
+
+       tcDispBuffLen += 1*sizeof(uint8_t);
+
+       tcDispBuffLen += 1*sizeof(uint8_t);
+
+       tcDispBuffLen += strlen(disp->plte);
+
+       Buffer *tcDispBuff = ALLOC(Buffer);
+       tcDispBuff->len = tcDispBuffLen;
+       tcDispBuff->data = NALLOC(tcDispBuffLen, uint8_t);
+       uint8_t *iter = tcDispBuff->data;
+
+       /*1. Width*/
+       *iter = (disp->width) & 0xFF;
+       iter++;
+       *iter = (disp->width >> 8) & 0xFF;
+       iter++;
+       *iter = (disp->width >> 16) & 0xFF;
+       iter++;
+       *iter = (disp->width >> 24) & 0xFF;
+       iter++;
+
+       /*2. Height*/
+       *iter = (disp->height) & 0xFF;
+       iter++;
+       *iter = (disp->height >> 8) & 0xFF;
+       iter++;
+       *iter = (disp->height >> 16) & 0xFF;
+       iter++;
+       *iter = (disp->height >> 24) & 0xFF;
+       iter++;
+
+       /*3.BitDepth*/
+       *iter = (disp->bitDepth) & 0xFF;
+       iter++;
+
+       /*4. ColorType*/
+       *iter = (disp->colorType) & 0xFF;
+       iter++;
+
+       /*5. Compression*/
+       *iter = (disp->compression) & 0xFF;
+       iter++;
+
+       /*6. Filter*/
+       *iter = (disp->filter) & 0xFF;
+       iter++;
+
+       /*7. Interlace*/
+       *iter = (disp->interlace) & 0xFF;
+       iter++;
+
+       /*8. PLTE*/
+       memcpy(iter, disp->plte, strlen(disp->plte));
+       iter += strlen(disp->plte);
+
+       return tcDispBuff;
+}
+
+void*
+TcDispPNGChTlvEncoder::decode(const uint8_t *rawData)
+{
+       _INFO("TcDispPNGChTlvEncoder start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s* root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+
+       uint8_t rawIter = 0;
+       uint8_t endIter = root->len;
+       uint8_t *root_val = root->val;
+
+       DisplayTc *getTcDsipPngChInfo = ALLOC(DisplayTc);
+
+       getTcDsipPngChInfo->width = tlv_get_int_by_reverse_endian(root_val, 4);
+       _INFO("width [%d]", getTcDsipPngChInfo->width);
+       rawIter += 4;
+       CATCH_IF_FAIL(rawIter < endIter);
+
+       getTcDsipPngChInfo->height = tlv_get_int_by_reverse_endian(root_val + rawIter, 4);
+       _INFO("height [%d]", getTcDsipPngChInfo->height);
+       rawIter += 4;
+       CATCH_IF_FAIL(rawIter < endIter);
+
+       getTcDsipPngChInfo->bitDepth = tlv_get_int_by_reverse_endian(root_val + rawIter, 1);
+       _INFO("bitDepth [%d]", getTcDsipPngChInfo->bitDepth);
+       rawIter += 1;
+       CATCH_IF_FAIL(rawIter < endIter);
+
+       getTcDsipPngChInfo->colorType = tlv_get_int_by_reverse_endian(root_val + rawIter, 1);
+       _INFO("colorType [%d]", getTcDsipPngChInfo->colorType);
+       rawIter += 1;
+       CATCH_IF_FAIL(rawIter < endIter);
+
+       getTcDsipPngChInfo->compression = tlv_get_int_by_reverse_endian(root_val + rawIter, 1);
+       _INFO("compression [%d]", getTcDsipPngChInfo->compression);
+       rawIter += 1;
+       CATCH_IF_FAIL(rawIter < endIter);
+
+       getTcDsipPngChInfo->filter = tlv_get_int_by_reverse_endian(root_val + rawIter, 1);
+       _INFO("filter [%d]", getTcDsipPngChInfo->filter);
+       rawIter += 1;
+       CATCH_IF_FAIL(rawIter < endIter);
+
+       getTcDsipPngChInfo->interlace = tlv_get_int_by_reverse_endian(root_val + rawIter, 1);
+       _INFO("interlace [%d]", getTcDsipPngChInfo->interlace);
+       rawIter += 1;
+       CATCH_IF_FAIL(rawIter < endIter);
+
+       getTcDsipPngChInfo->plte = (char*)calloc(1, 128);
+       memcpy(getTcDsipPngChInfo->plte, root_val + rawIter, endIter-rawIter);
+       _INFO("plte [%s]", getTcDsipPngChInfo->plte);
+
+
+CATCH:
+       _INFO("TcDispPNGChTlvEncoder end");
+       return getTcDsipPngChInfo;
+}
+
+AuthInfoTlvEncoder::AuthInfoTlvEncoder(void)
+{
+
+}
+
+Buffer*
+AuthInfoTlvEncoder::encode(const void *authData)
+{
+       return NULL;
+}
+
+void*
+AuthInfoTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("AuthInfoTlvEncoder start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *tlv  = tlv_decode(rawData);
+       RET_IF_FAIL(tlv != NULL, NULL);
+
+       _INFO("AuthInfoTlvEncoder after root decode");
+
+       int rawIter = 2 + 2;
+       int end_iter = rawIter + tlv->len;
+       _INFO("AuthInfoTlvEncoder TOTAL LEN = [%d] bytes", end_iter);
+
+       tlv_s *child = tlv_decode(rawData + rawIter);
+       RET_IF_FAIL(child != NULL, NULL);
+       _INFO("AuthInfoTlvEncoder after child decode");
+
+
+       AuthenticatorInfo *authInfo = (AuthenticatorInfo*)calloc(1, sizeof(AuthenticatorInfo));
+       bool foundMember = false;
+
+       while (1) {
+
+               int attType = -1;
+               char *extId = NULL;
+
+               switch (child->tag) {
+
+               case TAG_AUTHENTICATOR_INDEX:
+                       GET_INT_FROM_BUFFER(authInfo->__authenticatorIndex, (__intTlvEncoder.decode(rawData + rawIter)));
+                       _INFO("__authenticatorIndex = [%d]", authInfo->__authenticatorIndex);
+                       foundMember = true;
+                       break;
+
+               case TAG_AAID:
+                       GET_STR_FROM_BUFFER(authInfo->__aaid, (__strTlvEncoder.decode(rawData + rawIter)));
+                       _INFO("AAID = [%s]", authInfo->__aaid);
+                       foundMember = true;
+                       break;
+
+               case TAG_AUTHENTICATOR_METADATA:
+                       authInfo->__meta = (AuthenticatorMetaData *)(__authMetaTlvEncoder.decode(rawData + rawIter));
+                       foundMember = true;
+                       break;
+
+               case TAG_TC_DISPLAY_CONTENT_TYPE:
+                       GET_STR_FROM_BUFFER(authInfo->__tcDispConType, (__strTlvEncoder.decode(rawData + rawIter)));
+                       _INFO("tcDispConType = [%s]", authInfo->__tcDispConType);
+                       foundMember = true;
+                       break;
+
+               case TAG_TC_DISPLAY_PNG_CHARACTERISTICS: {
+
+                       DisplayTc *getTcDispPNGChInfo = (DisplayTc*)(__tcDispPNGChTlvEncoder.decode(rawData + rawIter));
+                       if(getTcDispPNGChInfo != NULL) {
+                               authInfo->__tcDisplayPNGCharacteristics = g_list_append(authInfo->__tcDisplayPNGCharacteristics,
+                                                                                                                                               getTcDispPNGChInfo);
+                               getTcDispPNGChInfo = NULL;
+                       }
+                       foundMember = true;
+                       break;
+               }
+
+               case TAG_ASSERTION_SCHEME:
+                       GET_STR_FROM_BUFFER(authInfo->__assertionScheme, (__strTlvEncoder.decode(rawData + rawIter)));
+                       foundMember = true;
+                       break;
+
+               case TAG_ATTESTATION_TYPE:
+                       GET_INT_FROM_BUFFER(attType, (__intTlvEncoder.decode(rawData + rawIter)));
+                       if (attType != -1)
+                               authInfo->__attestationTypes = g_list_append(authInfo->__attestationTypes,
+                                                                                                                        GINT_TO_POINTER(attType));
+                       foundMember = true;
+                       break;
+
+               case TAG_SUPPORTED_EXTENSION_ID:
+                       GET_STR_FROM_BUFFER(extId, __strTlvEncoder.decode(rawData + rawIter));
+                       if (extId != NULL) {
+                               authInfo->__extList = g_list_append(authInfo->__extList,
+                                                                                                                        extId);
+                               extId = NULL;
+                       }
+                       foundMember = true;
+                       break;
+
+               default:
+                       foundMember = false;
+                       break;
+
+               }
+
+               rawIter = rawIter + 2 + 2 + child->len;
+               _INFO("AuthInfoTlvEncoder RAW ITER = [%d]", rawIter);
+               if (rawIter >= end_iter)
+                       break;
+
+               child = tlv_decode(rawData + rawIter);
+       }
+
+       if (foundMember == false) {
+               free(authInfo);
+               return NULL;
+       }
+
+       _INFO("AuthInfoTlvEncoder end");
+       return authInfo;
+}
+
+GetInfoRespTlvEncoder::GetInfoRespTlvEncoder(void)
+{
+
+}
+
+Buffer *
+GetInfoRespTlvEncoder::encode(const void *authData)
+{
+       _INFO("GetInfoRespTlvEncoder::encode start");
+
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       _INFO("GetInfoRespTlvEncoder::encode start with valid ip");
+
+       GetAuthInfoResp *getInfoResp  = (GetAuthInfoResp*)authData;
+
+       _INFO("GetInfoRespTlvEncoder::encode 1");
+
+       tlv_builder_s *builder = tlv_builder_create();
+       _INFO("GetInfoRespTlvEncoder::encode 2");
+       /*1. TAG_UAFV1_GETINFO_CMD_RESPONSE start*/
+       tlv_builder_start_composite(builder, TAG_UAFV1_GETINFO_CMD_RESPONSE);
+       _INFO("GetInfoRespTlvEncoder::encode 3");
+
+       /*1.2 TAG_STATUS_CODE*/
+       tlv_builder_add_int16(builder, TAG_STATUS_CODE, getInfoResp->statusCode);
+       _INFO("GetInfoRespTlvEncoder::encode 4");
+
+       /*1.3 TAG_API_VERSION*/
+       tlv_builder_add_int8(builder, TAG_API_VERSION, getInfoResp->apiVersion);
+       _INFO("GetInfoRespTlvEncoder::encode 5");
+
+
+       if (getInfoResp->authList != NULL) {
+
+               _INFO("GetInfoRespTlvEncoder::encode 6");
+               GList *authIter = g_list_first(getInfoResp->authList);
+               while (authIter != NULL) {
+                       _INFO("GetInfoRespTlvEncoder::encode 7");
+                       AuthenticatorInfo *auth = (AuthenticatorInfo*)(authIter->data);
+
+                       _INFO("GetInfoRespTlvEncoder::encode 8");
+                       /*1.4 TAG_AUTHENTICATOR_INFO*/
+                       tlv_builder_start_composite(builder, TAG_AUTHENTICATOR_INFO);
+
+                       _INFO("GetInfoRespTlvEncoder::encode 9");
+                       /*1.4.1 TAG_AUTHENTICATOR_INDEX*/
+                       tlv_builder_add_int8(builder, TAG_AUTHENTICATOR_INDEX, auth->__authenticatorIndex);
+
+                       _INFO("GetInfoRespTlvEncoder::encode 10");
+                       /*1.4.2 TAG_AAID*/
+                       tlv_builder_add_string(builder, TAG_AAID, auth->__aaid);
+
+                       if (auth->__meta != NULL) {
+                               _INFO("GetInfoRespTlvEncoder::encode 11");
+
+                               Buffer *metaBuff = __authMetaTlvEncoder.encode(auth->__meta);
+                               if (metaBuff != NULL) {
+
+                                       _INFO("GetInfoRespTlvEncoder::encode 12");
+                                       /*1.4.3 TAG_AUTHENTICATOR_METADATA*/
+                                       tlv_builder_add_buffer(builder, TAG_AUTHENTICATOR_METADATA, metaBuff);
+                               }
+                       }
+
+                       _INFO("GetInfoRespTlvEncoder::encode 13");
+                       /*1.4.4 TAG_TC_DISPLAY_CONTENT_TYPE*/
+                       if (auth->__tcDispConType != NULL)
+                               tlv_builder_add_string(builder, TAG_TC_DISPLAY_CONTENT_TYPE, auth->__tcDispConType);
+
+                       _INFO("GetInfoRespTlvEncoder::encode 14");
+                       /*1.4.5 TAG_TC_DISPLAY_PNG_CHARACTERSTICS*/
+                       /* TODO __tcDispPNGChTlvEncoder causing crash
+                       if(auth->__tcDisplayPNGCharacteristics != NULL) {
+
+                               GList *iter = g_list_first(auth->__tcDisplayPNGCharacteristics);
+                               while(iter != NULL) {
+                                       _INFO("GetInfoRespTlvEncoder::encode 15");
+                                       DisplayTc *disp = (DisplayTc*)(iter->data);
+
+                                       _INFO("GetInfoRespTlvEncoder::encode 16");
+                                       Buffer *tcDispBuff = __tcDispPNGChTlvEncoder.encode(disp);
+
+                                       _INFO("GetInfoRespTlvEncoder::encode 17");
+                                       tlv_builder_add_buffer(builder, TAG_TC_DISPLAY_PNG_CHARACTERISTICS, tcDispBuff);
+
+                                       iter = iter->next;
+                               }
+                       }*/
+
+                       _INFO("GetInfoRespTlvEncoder::encode 18");
+                       /*1.4.6 TAG_ASSERTION_SCHEME*/
+                       if (auth->__assertionScheme != NULL)
+                               tlv_builder_add_string(builder, TAG_ASSERTION_SCHEME, auth->__assertionScheme);
+
+
+                       _INFO("GetInfoRespTlvEncoder::encode 19");
+                       if (auth->__attestationTypes != NULL) {
+
+                               GList *attIter = g_list_first(auth->__attestationTypes);
+                               while (attIter != NULL) {
+                                       _INFO("GetInfoRespTlvEncoder::encode 20");
+                                       int att = GPOINTER_TO_INT(attIter->data);
+                                       /*1.4.7 TAG_ATTESTATION_TYPE*/
+                                       _INFO("GetInfoRespTlvEncoder::encode 21");
+                                       tlv_builder_add_int16(builder, TAG_ATTESTATION_TYPE, att);
+                                       attIter = attIter->next;
+                               }
+                       }
+
+                       _INFO("GetInfoRespTlvEncoder::encode 22");
+                       if(auth->__extList != NULL) {
+
+                               GList *extIter = g_list_first(auth->__extList);
+                               while(extIter != NULL) {
+                                       _INFO("GetInfoRespTlvEncoder::encode 23");
+                                       /*1.4.8 TAG_SUPPORTED_EXTENSION_ID*/
+                                       tlv_builder_add_string(builder, TAG_SUPPORTED_EXTENSION_ID, (char*)extIter->data);
+                                       extIter = extIter->next;
+                               }
+                       }
+
+                       _INFO("GetInfoRespTlvEncoder::encode 24");
+                       /*1.4 end*/
+                       tlv_builder_end_composite(builder);
+
+                       _INFO("GetInfoRespTlvEncoder::encode 25");
+                       authIter = authIter->next;
+               }
+       }
+
+       /*1 end*/
+       tlv_builder_end_composite(builder);
+       _INFO("GetInfoRespTlvEncoder::encode 26");
+
+       _INFO("GetInfoRespTlvEncoder::encode end");
+       return tlv_builder_get_buffer(builder);
+}
+
+void*
+GetInfoRespTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("GetInfoRespTlvEncoder::decode start");
+
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       _INFO("");
+
+       GetAuthInfoResp *getInfoResp = (GetAuthInfoResp*)calloc(1, sizeof(GetAuthInfoResp));
+
+       AuthenticatorInfo *auth = NULL;
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+
+       int rawIter = 2 + 2;
+       int end_iter = rawIter + root->len;
+       _INFO("GetInfoRespTlvEncoder TOTAL LEN = [%d] bytes", end_iter);
+
+       RET_IF_FAIL(root->tag == TAG_UAFV1_GETINFO_CMD_RESPONSE, NULL);
+
+       tlv_s *child = tlv_decode(rawData + rawIter);
+       RET_IF_FAIL(child != NULL, NULL);
+
+       bool foundMember = false;
+
+       while (1) {
+
+               switch (child->tag) {
+
+               case TAG_STATUS_CODE:
+                       getInfoResp->statusCode = *((int *)(__intTlvEncoder.decode(rawData + rawIter)));
+                       _INFO("statusCode = [%d]", getInfoResp->statusCode);
+                       foundMember = true;
+                       break;
+
+               case TAG_API_VERSION:
+                       getInfoResp->apiVersion = *((int *)(__intTlvEncoder.decode(rawData + rawIter)));
+                       _INFO("apiVersion = [%d]", getInfoResp->apiVersion);
+                       foundMember = true;
+                       break;
+
+               case TAG_AUTHENTICATOR_INFO:
+                       auth = (AuthenticatorInfo*)__authInfoEncoder.decode(rawData + rawIter);
+                       if (auth != NULL) {
+                               getInfoResp->authList = g_list_append(getInfoResp->authList, auth);
+                               auth = NULL;
+                       }
+                       foundMember = true;
+                       break;
+
+               default:
+                       foundMember = false;
+                       break;
+               }
+               _INFO("rawIter=[%d]", rawIter);
+               rawIter = rawIter + 2 + 2 + child->len;
+               if (rawIter >= end_iter)
+                       break;
+
+               child = tlv_decode(rawData + rawIter);
+       }
+
+       if (foundMember == false) {
+               free(getInfoResp);
+               return NULL;
+       }
+
+       _INFO("GetInfoRespTlvEncoder::decode end");
+
+       return getInfoResp;
+}
diff --git a/common/uafv1tlvutil/src/IntTlvEncoder.cpp b/common/uafv1tlvutil/src/IntTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..5c0f4b5
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "IntTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+IntTlvEncoder::IntTlvEncoder(void)
+{
+
+}
+
+Buffer *
+IntTlvEncoder::encode(const void *intTlv)
+{
+       return NULL;
+}
+
+void*
+IntTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("IntTlvEncoder start");
+
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *tlv  = tlv_decode(rawData);
+       RET_IF_FAIL(tlv != NULL, NULL);
+
+       int val = 0;
+       int i = 0;
+       for (i = 0; i < (tlv->len); i++) {
+
+               _INFO("tlv->val[i] = %d", tlv->val[i]);
+
+               int b_val = tlv->val[i] << (i * 8);
+
+               _INFO("b_val = %d", b_val);
+
+               val |= b_val;
+       }
+
+       _INFO("[%d]", val);
+
+       int *val_ptr = (int *)calloc(1, sizeof(int));
+       *val_ptr = val;
+
+       _INFO("IntTlvEncoder end");
+
+       return val_ptr;
+}
diff --git a/common/uafv1tlvutil/src/RegAssertionInfoTlvEncoder.cpp b/common/uafv1tlvutil/src/RegAssertionInfoTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..928c166
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "RegAssertionInfoTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+RegAssertionInfoTlvEncoder::RegAssertionInfoTlvEncoder(void)
+{
+
+}
+
+Buffer *
+RegAssertionInfoTlvEncoder::encode(const void *authData)
+{
+       _INFO("AssertionInfoTlvEncoder::encode start");
+
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       _INFO("AssertionInfoTlvEncoder::encode start with valid ip");
+
+       AssertionInfo *getAssertionInfo = (AssertionInfo*)authData;
+
+       int getAssertionInfoLen = 2 * sizeof(uint8_t);
+
+       getAssertionInfoLen += 1 * sizeof(uint8_t);
+
+       getAssertionInfoLen += 2 * sizeof(uint8_t);
+
+       getAssertionInfoLen += 2 * sizeof(uint8_t);
+
+       Buffer *getAssertionInfoBuff = ALLOC(Buffer);
+       getAssertionInfoBuff->len = getAssertionInfoLen;
+       getAssertionInfoBuff->data = NALLOC(getAssertionInfoLen, uint8_t);
+       uint8_t *iter = getAssertionInfoBuff->data;
+
+       /*1. AuthenticatorVersion*/
+       *iter = getAssertionInfo->authVersion & 0xFF;
+       iter++;
+       *iter = (getAssertionInfo->authVersion >> 8) & 0xFF;
+       iter++;
+
+       /*2. AuthenticationMode*/
+       *iter = getAssertionInfo->authMode & 0xFF;
+       iter++;
+
+       /*3. SignatureAlgAndEncoding*/
+       *iter = getAssertionInfo->signatureAlgAndEncoding & 0xFF;
+       iter++;
+       *iter = (getAssertionInfo->signatureAlgAndEncoding >> 8) & 0xFF;
+       iter++;
+
+       /*4. PublicKeyAlgAndEncoding*/
+       *iter = getAssertionInfo->publicKeyAlgAndEncoding & 0xFF;
+       iter++;
+       *iter = (getAssertionInfo->publicKeyAlgAndEncoding >> 8) & 0xFF;
+       iter++;
+
+       _INFO("AssertionInfoTlvEncoder::encode end");
+       return getAssertionInfoBuff;
+}
+
+void *
+RegAssertionInfoTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("RegAssertionInfoTlvEncoder::decode start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+
+       AssertionInfo *getAssertionInfo = ALLOC(AssertionInfo);
+
+       uint8_t rawIter = 0;
+       uint8_t endIter = rawIter + root->len;
+       uint8_t *root_val = root->val;
+
+       getAssertionInfo->authVersion = tlv_get_int_by_reverse_endian(root_val, 2);
+       _INFO("authVersion [%d]", getAssertionInfo->authVersion);
+       rawIter += 2;
+       CATCH_IF_FAIL(rawIter < endIter);
+
+       getAssertionInfo->authMode = tlv_get_int_by_reverse_endian(root_val + rawIter, 1);
+       _INFO("authMode [%d]", getAssertionInfo->authMode);
+       rawIter += 1;
+       CATCH_IF_FAIL(rawIter < endIter);
+
+       getAssertionInfo->signatureAlgAndEncoding = tlv_get_int_by_reverse_endian(root_val + rawIter, 2);
+       _INFO("signatureAlgAndEncoding [%d]", getAssertionInfo->signatureAlgAndEncoding);
+       rawIter += 2;
+       CATCH_IF_FAIL(rawIter < endIter);
+
+       getAssertionInfo->publicKeyAlgAndEncoding = tlv_get_int_by_reverse_endian(root_val + rawIter, 2);
+       rawIter += 2;
+       _INFO("publicKeyAlgAndEncoding [%d]", getAssertionInfo->publicKeyAlgAndEncoding);
+
+
+CATCH:
+       _INFO("RegAssertionInfoTlvEncoder::decode end");
+       return getAssertionInfo;
+}
diff --git a/common/uafv1tlvutil/src/RegAuthAssertionTlvEncoder.cpp b/common/uafv1tlvutil/src/RegAuthAssertionTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..80ed1af
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "RegAuthAssertionTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+#include "stdio.h"
+
+RegAuthAssertionTlvEncoder::RegAuthAssertionTlvEncoder(void)
+{
+
+}
+
+Buffer *
+RegAuthAssertionTlvEncoder::encode(const void *authData)
+{
+       _BEGIN;
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       tlv_builder_s *builder = tlv_builder_create();
+       RegAssertion *getRegAssertion = (RegAssertion*)authData;
+
+
+       /*1. TAG_UAFV1_REG_ASSERTION*/
+       tlv_builder_start_composite(builder, TAG_UAFV1_REG_ASSERTION);
+
+       if(getRegAssertion->krd != NULL) {
+               _INFO("");
+
+               Krd *getRegAssertionKrd = (Krd*)getRegAssertion->krd ;
+               Buffer *getRegAssertionKrdBuff = (Buffer*)__uafv1KrdTlvEncoder.encode(getRegAssertionKrd);
+
+               tlv_s *getRegAssertionKrdTlv = tlv_decode(getRegAssertionKrdBuff->data);
+
+               Buffer *regAssertionKrdBuff = ALLOC(Buffer);
+               regAssertionKrdBuff->len = getRegAssertionKrdTlv->len;
+               regAssertionKrdBuff->data = getRegAssertionKrdTlv->val;
+               tlv_builder_add_buffer(builder, TAG_UAFV1_KRD, regAssertionKrdBuff);
+       }
+
+       if(getRegAssertion->attFull != NULL) {
+
+               _INFO("");
+               AttestationBasicFull *getAttBasicFullInfo = (AttestationBasicFull*)getRegAssertion->attFull;
+               Buffer *getAttBasicFullBuffInfo = (Buffer*)__attBasicFullTlvEncoder.encode(getAttBasicFullInfo);
+
+               tlv_s *getAttBasicFullInfoTlv = tlv_decode(getAttBasicFullBuffInfo->data);
+
+               Buffer *attBasicFullBuff = ALLOC(Buffer);
+               attBasicFullBuff->len = getAttBasicFullInfoTlv->len;
+               attBasicFullBuff->data = getAttBasicFullInfoTlv->val;
+               tlv_builder_add_buffer(builder, TAG_ATTESTATION_BASIC_FULL, attBasicFullBuff);
+       }
+       else if(getRegAssertion->attSur != NULL) {
+
+               _INFO("");
+               AttestationBasicSurrogate *getAttSurrInfo = (AttestationBasicSurrogate*)getRegAssertion->attSur;
+               Buffer *getAttBasicSurrInfoBuff = (Buffer*)__attBasicSurrTlvEncoder.encode(getAttSurrInfo);
+
+               tlv_s *getAttBasicSurrInfoTlv = tlv_decode(getAttBasicSurrInfoBuff->data);
+
+               Buffer *attBasicSurrBuff = ALLOC(Buffer);
+               attBasicSurrBuff->len = getAttBasicSurrInfoTlv->len;
+               attBasicSurrBuff->data = getAttBasicSurrInfoTlv->val;
+               tlv_builder_add_buffer(builder, TAG_ATTESTATION_BASIC_SURROGATE, attBasicSurrBuff);
+       }
+       else {
+
+               _ERR("No option of AttestationBasic is set");
+               return NULL;
+       }
+
+       /*1. end*/
+       tlv_builder_end_composite(builder);
+
+       _END;
+       return tlv_builder_get_buffer(builder);
+}
+
+void *
+RegAuthAssertionTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("RegAuthAssertionTlvEncoder::decode start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+       RET_IF_FAIL(root->tag == TAG_UAFV1_REG_ASSERTION, NULL);
+
+       RegAssertion *getRegAssertionInfo = ALLOC(RegAssertion);
+
+       bool foundMember = false;
+
+
+       int rawIter = 2 + 2;
+       int endIter = rawIter + root->len;
+
+       tlv_s *child = tlv_decode(rawData + rawIter);
+       RET_IF_FAIL(child != NULL, NULL);
+
+       while(1) {
+
+               switch(child->tag) {
+
+               case TAG_UAFV1_KRD:
+                       _INFO("");
+                       getRegAssertionInfo->krd = (Krd*)__uafv1KrdTlvEncoder.decode(rawData + rawIter);
+                       foundMember = true;
+                       break;
+
+               case TAG_ATTESTATION_BASIC_FULL:
+                       _INFO("");
+                       getRegAssertionInfo->attFull = (AttestationBasicFull*)__attBasicFullTlvEncoder.decode(rawData + rawIter);
+                       foundMember = true;
+                       break;
+
+               case TAG_ATTESTATION_BASIC_SURROGATE:
+                       _INFO("");
+                       getRegAssertionInfo->attSur = (AttestationBasicSurrogate*)__attBasicSurrTlvEncoder.decode(rawData + rawIter);
+                       foundMember = true;
+                       break;
+
+               default:
+                       _INFO("");
+                       foundMember = false;
+                       break;
+               }
+
+               _INFO("");
+               rawIter = rawIter + 2 + 2 + child->len;
+               if(rawIter >= endIter)
+                       break;
+
+               _INFO("");
+               child = tlv_decode(rawData + rawIter);
+               RET_IF_FAIL(child != NULL, NULL);
+       }
+
+       _INFO("");
+       if(foundMember == false) {
+               _INFO("");
+               free(getRegAssertionInfo);
+               return NULL;
+       }
+
+       _INFO("RegAuthAssertionTlvEncoder::decode end");
+       return getRegAssertionInfo;
+}
diff --git a/common/uafv1tlvutil/src/RegCountersInfoTlvEncoder.cpp b/common/uafv1tlvutil/src/RegCountersInfoTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..d2ce9c7
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "RegCountersInfoTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+RegCountersInfoTlvEncoder::RegCountersInfoTlvEncoder(void)
+{
+
+}
+
+Buffer *
+RegCountersInfoTlvEncoder::encode(const void *authData)
+{
+       _INFO("CountersInfoTlvEncoder::encode start");
+
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       _INFO("CountersInfoTlvEncoder::encode start with valid ip");
+
+       Counters *getCountersInfo = (Counters*)authData;
+
+       int getCountersInfoLen = 4 * sizeof(uint8_t);
+
+       getCountersInfoLen += 4 * sizeof(uint8_t);
+
+       Buffer *getCountersInfoBuff = ALLOC(Buffer);
+       getCountersInfoBuff->len = getCountersInfoLen;
+       getCountersInfoBuff->data = NALLOC(getCountersInfoLen, uint8_t);
+       uint8_t *iter = getCountersInfoBuff->data;
+
+       /*1. SignCounter*/
+       *iter = getCountersInfo->signCounter & 0xFF;
+       iter++;
+       *iter = (getCountersInfo->signCounter >> 8) & 0xFF;
+       iter++;
+       *iter = (getCountersInfo->signCounter >> 16) & 0xFF;
+       iter++;
+       *iter = (getCountersInfo->signCounter >> 24) & 0xFF;
+       iter++;
+
+       /*2. RegCounter*/
+       *iter = getCountersInfo->regCounter & 0xFF;
+       iter++;
+       *iter = (getCountersInfo->regCounter >> 8) & 0xFF;
+       iter++;
+       *iter = (getCountersInfo->regCounter >> 16) & 0xFF;
+       iter++;
+       *iter = (getCountersInfo->regCounter >> 24) & 0xFF;
+       iter++;
+
+       _INFO("CountersInfoTlvEncoder::encode end");
+       return getCountersInfoBuff;
+}
+
+void *
+RegCountersInfoTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("RegCountersInfoTlvEncoder::decode end");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+
+       Counters *getCountersInfo = ALLOC(Counters);
+
+       uint8_t rawIter = 0;
+       uint8_t endIter = rawIter + root->len;
+       uint8_t *root_val = root->val;
+
+       getCountersInfo->signCounter = tlv_get_int_by_reverse_endian(root_val, 4);
+       _INFO("signCounter [%d]", getCountersInfo->signCounter);
+       rawIter += 4;
+       CATCH_IF_FAIL(rawIter < endIter);
+
+       getCountersInfo->regCounter = tlv_get_int_by_reverse_endian(root_val + rawIter, 4);
+       _INFO("regCounter [%d]", getCountersInfo->regCounter);
+       rawIter += 4;
+
+CATCH:
+       _INFO("RegCountersInfoTlvEncoder::decode end");
+       return getCountersInfo;
+}
diff --git a/common/uafv1tlvutil/src/RegReqTlvEncoder.cpp b/common/uafv1tlvutil/src/RegReqTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..9d75efa
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "RegReqTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+RegAssertionTlvEncoder::RegAssertionTlvEncoder(void)
+{
+
+}
+
+Buffer *
+RegAssertionTlvEncoder::encode(const void *authData)
+{
+
+       _INFO("RegAssertionTlvEncoder::encode start");
+
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       _INFO("RegAssertionTlvEncoder::encode start with valid ip");
+
+
+       RegisterReq *getRegReq = (RegisterReq*)authData;
+       _INFO("RegAssertionTlvEncoder::encode 2");
+
+       tlv_builder_s *builder = tlv_builder_create();
+       _INFO("RegAssertionTlvEncoder::encode 3");
+
+       tlv_builder_start_composite(builder, TAG_UAFV1_REGISTER_CMD);
+       _INFO("RegAssertionTlvEncoder::encode 4");
+
+       tlv_builder_add_int8(builder, TAG_AUTHENTICATOR_INDEX, getRegReq->authIdx);
+       _INFO("RegAssertionTlvEncoder::encode 5");
+
+       if(getRegReq->appId != NULL) {
+               tlv_builder_add_string(builder, TAG_APPID, getRegReq->appId);
+               _INFO("RegAssertionTlvEncoder::encode 6");
+       }
+
+       tlv_builder_add_buffer(builder, TAG_FINAL_CHALLENGE, getRegReq->fch);
+       _INFO("RegAssertionTlvEncoder::encode 7");
+
+       tlv_builder_add_string(builder, TAG_USERNAME, getRegReq->userName);
+       _INFO("RegAssertionTlvEncoder::encode 8");
+
+       tlv_builder_add_int16(builder, TAG_ATTESTATION_TYPE, getRegReq->attType);
+       _INFO("RegAssertionTlvEncoder::encode 9");
+
+       tlv_builder_add_buffer(builder, TAG_KEYHANDLE_ACCESS_TOKEN, getRegReq->khAccessToken);
+       _INFO("RegAssertionTlvEncoder::encode 10");
+
+       if(getRegReq->userVToken != NULL) {
+               tlv_builder_add_string(builder, TAG_USERVERIFY_TOKEN, getRegReq->userVToken);
+               _INFO("RegAssertionTlvEncoder::encode 11");
+       }
+
+       tlv_builder_end_composite(builder);
+       _INFO("RegAssertionTlvEncoder::encode 12");
+
+       return tlv_builder_get_buffer(builder);
+}
+
+void*
+RegAssertionTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("RegAssertionInfoTlvEncoder::decode start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s* root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+       RET_IF_FAIL(root->tag == TAG_UAFV1_REGISTER_CMD, NULL);
+
+       int rawIter = 2 + 2;
+       int endIter = rawIter + root->len;
+
+       tlv_s* child = tlv_decode(root->val);
+       RET_IF_FAIL(child != NULL, NULL);
+
+       bool foundMember = false;
+       RegisterReq *getRegReqInfo = ALLOC(RegisterReq);
+
+       while(1) {
+               switch(child->tag) {
+
+               case TAG_AUTHENTICATOR_INDEX:
+                       _INFO("");
+                       getRegReqInfo->authIdx = *(int*)__intTlvEncoder.decode(rawData + rawIter);
+                       _INFO("authIdx = [%d]", getRegReqInfo->authIdx);
+                       foundMember = true;
+                       break;
+
+               case TAG_APPID:
+                       _INFO("");
+                       getRegReqInfo->appId = (char*)__strTlvEncoder.decode(rawData + rawIter);
+                       _INFO("appId = [%d]", getRegReqInfo->appId);
+                       foundMember = true;
+                       break;
+
+               case TAG_FINAL_CHALLENGE:
+                       _INFO("");
+                       getRegReqInfo->fch = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                       _INFO("finalChallenge = [%s]", getRegReqInfo->fch);
+                       foundMember = true;
+                       break;
+
+               case TAG_USERNAME:
+                       _INFO("");
+                       getRegReqInfo->userName = (char*)__strTlvEncoder.decode(rawData + rawIter);
+                       _INFO("userName = [%s]", getRegReqInfo->userName);
+                       foundMember = true;
+                       break;
+
+               case TAG_ATTESTATION_TYPE:
+                       _INFO("");
+                       getRegReqInfo->attType = *(int*)__intTlvEncoder.decode(rawData + rawIter);
+                       _INFO("attType = [%d]", getRegReqInfo->attType);
+                       foundMember = true;
+                       break;
+
+               case TAG_KEYHANDLE_ACCESS_TOKEN:
+                       _INFO("");
+                       getRegReqInfo->khAccessToken = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                       _INFO("khAccessToken = [%s]", getRegReqInfo->khAccessToken->data);
+                       foundMember = true;
+                       break;
+
+               case TAG_USERVERIFY_TOKEN:
+                       _INFO("");
+                       getRegReqInfo->userVToken = (char*)__strTlvEncoder.decode(rawData + rawIter);
+                       _INFO("userVToken = [%s]", getRegReqInfo->userVToken);
+                       foundMember = true;
+                       break;
+
+               default:
+                       foundMember = false;
+                       break;
+               }
+
+               rawIter = rawIter + 2 + 2 + child->len;
+               if(rawIter >= endIter)
+                       break;
+
+               child = tlv_decode(rawData + rawIter);
+               RET_IF_FAIL(child != NULL, NULL);
+       }
+
+       if(foundMember == false) {
+               free(getRegReqInfo);
+               return NULL;
+       }
+
+       _INFO("RegAssertionInfoTlvEncoder::decode end");
+       return getRegReqInfo;
+}
diff --git a/common/uafv1tlvutil/src/RegRespTlvEncoder.cpp b/common/uafv1tlvutil/src/RegRespTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..639cbf8
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "RegRespTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+RegRespTlvEncoder::RegRespTlvEncoder(void)
+{
+
+}
+
+Buffer *
+RegRespTlvEncoder::encode(const void *authData)
+{
+       _INFO("RegRespTlvEncoder::encode start");
+
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       _INFO("RegRespTlvEncoder::encode start with valid ip");
+
+       RegisterResp *getRegResp = (RegisterResp*)authData;
+
+       tlv_builder_s *builder = tlv_builder_create();
+
+       /*1 TAG_UAFV1_REGISTER_CMD_RESPONSE*/
+       tlv_builder_start_composite(builder, TAG_UAFV1_REGISTER_CMD_RESPONSE);
+
+       /*1.2 TAG_STATUS_CODE*/
+       tlv_builder_add_int16(builder, TAG_STATUS_CODE, getRegResp->statusCode);
+
+       /*1.3 TAG_AUTHENTICATOR_ASSERTION*/
+       RegAssertion *getRegAssertion = NULL;
+       getRegAssertion = (RegAssertion*)getRegResp->regAssertion;
+       Buffer *getRegAssertionBuff = (Buffer*)__regAuthAssertion.encode(getRegAssertion);
+
+       tlv_builder_add_buffer(builder, TAG_AUTHENTICATOR_ASSERTION, getRegAssertionBuff);
+       /*1.3 end*/
+
+       /*1.4 TAG_KEYHANDLE*/
+       if(getRegResp->kh != NULL) {
+               tlv_builder_add_buffer(builder, TAG_KEYHANDLE, getRegResp->kh);
+       }
+
+       tlv_builder_end_composite(builder);
+
+       return tlv_builder_get_buffer(builder);
+}
+
+void*
+RegRespTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("RegRespTlvEncoder::decode start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       RegisterResp *getRegRespInfo = ALLOC(RegisterResp);
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+       RET_IF_FAIL(root->tag == TAG_UAFV1_REGISTER_CMD_RESPONSE, NULL);
+
+       int rawIter = 2 + 2;
+       int endIter = rawIter + root->len;
+
+       tlv_s *child = tlv_decode(root->val);
+       RET_IF_FAIL(child != NULL, NULL);
+
+       bool foundMember = false;
+
+       while(1) {
+
+               switch(child->tag) {
+
+                       case TAG_STATUS_CODE:
+                               _INFO("");
+                               getRegRespInfo->statusCode = *(int*)__intTlvEncoder.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       case TAG_AUTHENTICATOR_ASSERTION:
+                               _INFO("");
+                               getRegRespInfo->regAssertion = (RegAssertion*)__regAuthAssertion.decode(rawData + rawIter + 2 + 2);
+                               //TODO : ERROR CHECKING
+                               foundMember = true;
+                               break;
+
+                       case TAG_KEYHANDLE:
+                               _INFO("");
+                               getRegRespInfo->kh = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       default:
+                               _INFO("Unknown tag=[%d]", child->tag);
+                               foundMember = false;
+                               break;
+               }
+
+               _INFO("");
+               rawIter = rawIter + 2 + 2 + child->len;
+               if(rawIter >= endIter) {
+                       _INFO("");
+                       break;
+               }
+
+               _INFO("");
+               child = tlv_decode(rawData + rawIter);
+               RET_IF_FAIL(child != NULL, NULL);
+       }
+
+       _INFO("");
+       if(foundMember == false) {
+               _INFO("");
+               free(getRegRespInfo);
+               return NULL;
+       }
+
+       _INFO("RegRespTlvEncoder::decode end");
+       return getRegRespInfo;
+}
diff --git a/common/uafv1tlvutil/src/SignAuthAssertionTlvEncoder.cpp b/common/uafv1tlvutil/src/SignAuthAssertionTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..49bf21e
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "SignAuthAssertionTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+SignAuthAssertionTlvEncoder::SignAuthAssertionTlvEncoder(void)
+{
+
+}
+
+Buffer *
+SignAuthAssertionTlvEncoder::encode(const void *authData)
+{
+       _BEGIN;
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       AuthAssertion *getAuthAssertionInfo = (AuthAssertion*)authData;
+
+       tlv_builder_s *builder = tlv_builder_create();
+
+       /*1. TAG_UAFV1_AUTH_ASSERTION*/
+       tlv_builder_start_composite(builder, TAG_UAFV1_AUTH_ASSERTION);
+
+       if(getAuthAssertionInfo->sigData != NULL) {
+
+               /*1.2 TAG_UAFV1_SIGNED_DATA*/
+
+               SigData *getSigDataInfo = (SigData*)getAuthAssertionInfo->sigData;
+               Buffer *getSigDataInfoBuff = (Buffer*)__sigDataTlvEncoder.encode(getSigDataInfo);
+
+               tlv_s *getSigDataInfoTlv = tlv_decode(getSigDataInfoBuff->data);
+
+               Buffer *getSigDataBuff = ALLOC(Buffer);
+               getSigDataBuff->len = getSigDataInfoTlv->len;
+               getSigDataBuff->data = getSigDataInfoTlv->val;
+
+               tlv_builder_add_buffer(builder, TAG_UAFV1_SIGNED_DATA, getSigDataBuff);
+
+               /*1.2 end*/
+       }
+
+       /*1.3 TAG_SIGNATURE*/
+       tlv_builder_add_buffer(builder, TAG_SIGNATURE, getAuthAssertionInfo->sig);
+
+       /*1. end*/
+       tlv_builder_end_composite(builder);
+
+       _END;
+       return tlv_builder_get_buffer(builder);
+}
+
+void *
+SignAuthAssertionTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("SignAuthAssertionTlvEncoder::decode start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+       RET_IF_FAIL(root->tag == TAG_UAFV1_AUTH_ASSERTION, NULL);
+
+       int rawIter = 2 + 2;
+       AuthAssertion *getAuthAssInfo = ALLOC(AuthAssertion);
+
+
+       bool foundMember = false;
+
+
+       int endIter = rawIter + root->len;
+
+       tlv_s *child = tlv_decode(rawData + rawIter);
+       RET_IF_FAIL(child != NULL, NULL);
+
+       while(1) {
+
+               switch(child->tag) {
+
+               case TAG_UAFV1_SIGNED_DATA:
+                       getAuthAssInfo->sigData = (SigData*)__sigDataTlvEncoder.decode(rawData + rawIter);
+                       foundMember = true;
+                       break;
+
+               case TAG_SIGNATURE:
+                       getAuthAssInfo->sig = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                       foundMember = true;
+                       break;
+
+               default:
+                       foundMember = false;
+                       break;
+               }
+               rawIter = rawIter + 2 + 2 + child->len;
+               if(rawIter >= endIter)
+                       break;
+
+               child = tlv_decode(rawData + rawIter);
+               RET_IF_FAIL(child != NULL, NULL);
+       }
+
+       if(foundMember == false) {
+               free(getAuthAssInfo);
+               return NULL;
+       }
+
+       _INFO("SignAuthAssertionTlvEncoder::decode end");
+       return getAuthAssInfo;
+}
diff --git a/common/uafv1tlvutil/src/SignReqTlvEncoder.cpp b/common/uafv1tlvutil/src/SignReqTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..12f49e5
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "SignReqTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+SignReqTlvEncoder::SignReqTlvEncoder(void)
+{
+
+}
+
+Buffer *
+SignReqTlvEncoder::encode(const void *authData)
+{
+       _INFO("SignReqTlvEncoder::encode start");
+
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       _INFO("SignReqTlvEncoder::encode start with valid ip");
+
+       AuthenticateReq *getAuthReqInfo = (AuthenticateReq*)authData;
+
+
+       tlv_builder_s *builder = tlv_builder_create();
+
+       /*1. TAG_UAFV1_SIGN_CMD*/
+       tlv_builder_start_composite(builder, TAG_UAFV1_SIGN_CMD);
+
+       /*1.2 TAG_AUTHENTICATOR_INDEX*/
+       tlv_builder_add_int8(builder, TAG_AUTHENTICATOR_INDEX, getAuthReqInfo->authIdx);
+
+       if(getAuthReqInfo->appId != NULL) {
+
+               /*1.3 TAG_APPID*/
+               tlv_builder_add_string(builder, TAG_APPID, getAuthReqInfo->appId);
+       }
+
+       /*1.4 TAG_FINAL_CHALLENGE*/
+       tlv_builder_add_buffer(builder, TAG_FINAL_CHALLENGE, getAuthReqInfo->fch);
+
+       if(getAuthReqInfo->tc != NULL) {
+
+               /*1.5 TAG_TRANSACTION_CONTENT*/
+               tlv_builder_add_string(builder, TAG_TRANSACTION_CONTENT, getAuthReqInfo->tc);
+       }
+
+       /*1.6 TAG_KEYHANDLE_ACCESS_TOKEN*/
+       tlv_builder_add_buffer(builder, TAG_KEYHANDLE_ACCESS_TOKEN, getAuthReqInfo->khATok);
+
+       if(getAuthReqInfo->userVToken != NULL) {
+
+               /*1.7 TAG_USERVERIFY_TOKEN*/
+               tlv_builder_add_string(builder, TAG_USERVERIFY_TOKEN, getAuthReqInfo->userVToken);
+       }
+
+       if(getAuthReqInfo->khHList != NULL) {
+
+               GList *getKhInfoIter = g_list_first(getAuthReqInfo->khHList);
+
+               while(getKhInfoIter != NULL) {
+                       char *getKhInfo = (char*)(getKhInfoIter->data);
+
+                       /*1.8 TAG_KEYHANDLE*/
+                       tlv_builder_add_string(builder, TAG_KEYHANDLE, getKhInfo);
+
+                       getKhInfoIter = getKhInfoIter->next;
+               }
+       }
+
+       tlv_builder_end_composite(builder);
+
+       return tlv_builder_get_buffer(builder);
+}
+
+void *
+SignReqTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("SignReqTlvEncoder::decode start");
+
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+       RET_IF_FAIL(root->tag == TAG_UAFV1_SIGN_CMD, NULL);
+
+       int rawIter = 2 + 2;
+       int endIter = rawIter + root->len;
+
+       AuthenticateReq *getAuthReqInfo = NALLOC(1, AuthenticateReq);
+
+       tlv_s *child = tlv_decode(rawData + rawIter);
+       RET_IF_FAIL(child != NULL, NULL);
+
+       bool foundMember = false;
+
+       while(1) {
+
+               switch(child->tag) {
+
+                       case TAG_AUTHENTICATOR_INDEX:
+                               getAuthReqInfo->authIdx = *(int*)__intTlvEncoder.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       case TAG_APPID:
+                               getAuthReqInfo->appId = (char*)__strTlvEncoder.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       case TAG_FINAL_CHALLENGE:
+                               getAuthReqInfo->fch = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       case TAG_TRANSACTION_CONTENT:
+                               getAuthReqInfo->tc = (char*)__strTlvEncoder.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       case TAG_KEYHANDLE_ACCESS_TOKEN:
+                               getAuthReqInfo->khATok = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       case TAG_USERVERIFY_TOKEN:
+                               getAuthReqInfo->userVToken = (char*)__strTlvEncoder.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       case TAG_KEYHANDLE: {
+                               char *getKeyHandle = (char*)__strTlvEncoder.decode(rawData + rawIter);
+                               if(getKeyHandle != NULL) {
+                                               getAuthReqInfo->khHList = g_list_append(getAuthReqInfo->khHList, getKeyHandle);
+                                               getKeyHandle = NULL;
+                                       }
+                               foundMember = true;
+                               break;
+                               }
+
+                       default:
+                               foundMember = false;
+                               break;
+               }
+
+               rawIter = rawIter + 2 + 2 + child->len;
+               if(rawIter >= endIter)
+                       break;
+
+               child = tlv_decode(rawData + rawIter);
+               RET_IF_FAIL(child != NULL, NULL);
+       }
+
+       if(foundMember == false) {
+               free(getAuthReqInfo);
+               return NULL;
+       }
+
+       _INFO("SignReqTlvEncoder::decode end");
+       return getAuthReqInfo;
+}
diff --git a/common/uafv1tlvutil/src/SignRespTlvEncoder.cpp b/common/uafv1tlvutil/src/SignRespTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..98a71ad
--- /dev/null
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "SignRespTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+UserNameKhTlvEncoder::UserNameKhTlvEncoder(void)
+{
+
+}
+
+Buffer *
+UserNameKhTlvEncoder::encode(const void *authData)
+{
+       return NULL;
+}
+
+void *
+UserNameKhTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("UserNameKhTlvEncoder::decode start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(root->tag == TAG_USERNAME_AND_KEYHANDLE, NULL);
+       RET_IF_FAIL(root != NULL, NULL);
+
+       int rawIter = 2 + 2;
+       int endIter = rawIter + root->len;
+
+       UserNameKeyHandle *getUsnKhInfo = ALLOC(UserNameKeyHandle);
+
+       tlv_s *child = tlv_decode(rawData + rawIter);
+       RET_IF_FAIL(child != NULL, NULL);
+
+       bool foundMember = false;
+
+       while(1) {
+
+               switch(child->tag) {
+
+                       case TAG_USERNAME:
+                               getUsnKhInfo->userName = (char*)__strTlvEncoder.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       case TAG_KEYHANDLE:
+                               getUsnKhInfo->kh = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       default:
+                               foundMember = false;
+                               break;
+               }
+               rawIter = rawIter + 2 + 2 + child->len;
+               if(rawIter >= endIter)
+                       break;
+
+               child = tlv_decode(rawData + rawIter);
+               RET_IF_FAIL(child != NULL, NULL);
+       }
+
+       if(foundMember == false) {
+               free(getUsnKhInfo);
+               return NULL;
+       }
+
+       _INFO("UserNameKhTlvEncoder::decode end");
+       return getUsnKhInfo;
+}
+
+SignRespTlvEncoder::SignRespTlvEncoder(void)
+{
+
+}
+
+Buffer *
+SignRespTlvEncoder::encode(const void *authData)
+{
+       _INFO("SignRespTlvEncoder::encode start");
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       AuthenticateResp *getAuthRespInfo = (AuthenticateResp*)authData;
+
+       tlv_builder_s *builder = tlv_builder_create();
+
+       /*1. TAG_UAFV1_SIGN_CMD_RESPONSE*/
+       tlv_builder_start_composite(builder, TAG_UAFV1_SIGN_CMD_RESPONSE);
+
+       /*1.1 TAG_STATUS_CODE*/
+       tlv_builder_add_int16(builder, TAG_STATUS_CODE, getAuthRespInfo->statusCode);
+
+       if(getAuthRespInfo->uKhList != NULL) {
+
+               _INFO("SignRespTlvEncoder::uKhList");
+               GList *iter = g_list_first(getAuthRespInfo->uKhList);
+               while(iter != NULL) {
+                       /*1.3 TAG_USERNAME_AND_KEYHANDLE*/
+                       tlv_builder_start_composite(builder, TAG_USERNAME_AND_KEYHANDLE);
+
+                       UserNameKeyHandle *getUserKhInfo = (UserNameKeyHandle*)(iter->data);
+
+                       /*1.3.2 TAG_USERNAME*/
+                       tlv_builder_add_string(builder, TAG_USERNAME, getUserKhInfo->userName);
+
+                       /*1.3.3 TAG_KEYHANDLE*/
+                       tlv_builder_add_buffer(builder, TAG_KEYHANDLE, getUserKhInfo->kh);
+
+                       tlv_builder_end_composite(builder);
+
+                       iter = iter->next;
+               }
+       }
+       else if(getAuthRespInfo->authAssertion != NULL) {
+
+               _INFO("SignRespTlvEncoder::authAssertion");
+               /*1.3 TAG_AUTHENTICATOR_ASSERTION*/
+
+               AuthAssertion *getAuthAssertionInfo = (AuthAssertion*)getAuthRespInfo->authAssertion;
+               Buffer *getAuthAssertionInfoBuff = (Buffer*)__signAuthAssertionInfo.encode(getAuthAssertionInfo);
+
+               tlv_builder_add_buffer(builder, TAG_AUTHENTICATOR_ASSERTION, getAuthAssertionInfoBuff);
+
+               /*1.3 end*/
+       }
+       else {
+
+               _ERR("Neither UsernameKeyhandle List nor Authentication Assertion is set");
+               return NULL;
+       }
+
+       /*1. end*/
+       tlv_builder_end_composite(builder);
+
+       _INFO("SignRespTlvEncoder::encode end");
+       return tlv_builder_get_buffer(builder);
+}
+
+void *
+SignRespTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("SignRespTlvEncoder::decode start.");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(root->tag == TAG_UAFV1_SIGN_CMD_RESPONSE, NULL);
+       RET_IF_FAIL(root != NULL, NULL);
+
+       int rawIter = 2 + 2;
+       int endIter = rawIter + root->len;
+
+       AuthenticateResp *getAuthRespInfo = NALLOC(1, AuthenticateResp);
+
+       tlv_s *child = tlv_decode(rawData + rawIter);
+       RET_IF_FAIL(child != NULL, NULL);
+
+       bool foundMember = false;
+
+       while(1) {
+
+               switch(child->tag) {
+
+               case TAG_STATUS_CODE:
+                       getAuthRespInfo->statusCode = *(int*)__intTlvEncoder.decode(rawData + rawIter);
+                       foundMember = true;
+                       break;
+
+               case TAG_USERNAME_AND_KEYHANDLE: {
+                       _INFO("SignRespTlvEncoder::decode TAG_USERNAME_AND_KEYHANDLE");
+                       UserNameKeyHandle *uKhInfo = (UserNameKeyHandle*)__uKhTlvEncoder.decode(rawData + rawIter);
+                       if(uKhInfo != NULL) {
+                               getAuthRespInfo->uKhList = g_list_append(getAuthRespInfo->uKhList, uKhInfo);
+                               uKhInfo = NULL;
+                       }
+               }
+                       foundMember = true;
+                       break;
+
+               case TAG_AUTHENTICATOR_ASSERTION:
+                       _INFO("SignRespTlvEncoder::decode TAG_AUTHENTICATOR_ASSERTION");
+                       getAuthRespInfo->authAssertion = (AuthAssertion*)__signAuthAssertionInfo.decode(rawData + rawIter + 2 + 2);
+                       foundMember = true;
+                       break;
+
+               default:
+                       foundMember = false;
+                       break;
+               }
+               rawIter = rawIter + 2 + 2 + child->len;
+               if(rawIter >= endIter)
+                       break;
+
+               child = tlv_decode(rawData + rawIter);
+               RET_IF_FAIL(child != NULL, NULL);
+       }
+
+       if(foundMember == false) {
+               free(getAuthRespInfo);
+               return NULL;
+       }
+
+       _INFO("SignRespTlvEncoder::decode end");
+       return getAuthRespInfo;
+}
diff --git a/common/uafv1tlvutil/src/SignedDataTlvEncoder.cpp b/common/uafv1tlvutil/src/SignedDataTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..c147cce
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "SignedDataTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+SignedDataTlvEncoder::SignedDataTlvEncoder(void)
+{
+
+}
+
+Buffer *
+SignedDataTlvEncoder::encode(const void *authData)
+{
+       _BEGIN;
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       SigData *getSigDataInfo = (SigData*)authData;
+
+       tlv_builder_s *builder = tlv_builder_create();
+
+       /*1.2 TAG_UAFV1_SIGNED_DATA*/
+       tlv_builder_start_composite(builder, TAG_UAFV1_SIGNED_DATA);
+
+       /*1.2.2 TAG_AAID*/
+       tlv_builder_add_string(builder, TAG_AAID, getSigDataInfo->aaid);
+
+       if(getSigDataInfo->assrtInfo != NULL) {
+
+               Buffer *getAssertionInfoBuff = __assertionInfo.encode(getSigDataInfo->assrtInfo);
+               if(getAssertionInfoBuff != NULL) {
+
+                       /*1.2.3 TAG_ASSERTION_INFO*/
+                       tlv_builder_add_buffer(builder, TAG_ASSERTION_INFO, getAssertionInfoBuff);
+               }
+       }
+
+       /*1.2.4 TAG_AUTHENTICATOR_NONCE*/
+       tlv_builder_add_buffer(builder, TAG_AUTHENTICATOR_NONCE, getSigDataInfo->authNonce);
+
+       /*1.2.5 TAG_FINAL_CHALLENGE*/
+       tlv_builder_add_buffer(builder, TAG_FINAL_CHALLENGE, getSigDataInfo->fch);
+
+       /*1.2.6 TAG_TRANSACTION_CONTENT_HASH*/
+       tlv_builder_add_buffer(builder, TAG_TRANSACTION_CONTENT_HASH, getSigDataInfo->tcHash);
+
+       /*1.2.7 TAG_KEYID*/
+       tlv_builder_add_buffer(builder, TAG_KEYID, getSigDataInfo->keyId);
+
+       if(getSigDataInfo->counter != NULL) {
+
+               Buffer *getCounterInfoBuff = __counterInfo.encode(getSigDataInfo->counter);
+               if(getCounterInfoBuff != NULL) {
+
+                       /*1.2.8 TAG_COUNTERS*/
+                       tlv_builder_add_buffer(builder, TAG_COUNTERS, getCounterInfoBuff);
+               }
+       }
+
+       /*1.2 end*/
+       tlv_builder_end_composite(builder);
+
+       _END;
+       return tlv_builder_get_buffer(builder);
+}
+
+void *
+SignedDataTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("SignedDataTlvEncoder::decode start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *root = tlv_decode(rawData);
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       int rawIter = 2 + 2;
+       int endIter = rawIter + root->len;
+
+       tlv_s *child = tlv_decode(rawData + rawIter);
+       RET_IF_FAIL(child != NULL, NULL);
+
+       SigData *getSigDataInfo = ALLOC(SigData);
+
+       bool foundMember = false;
+
+       while(1) {
+
+               switch(child->tag) {
+
+               case TAG_AAID:
+                       getSigDataInfo->aaid = (char*)__strTlvEncoder.decode(rawData + rawIter);
+                       foundMember = true;
+                       break;
+
+               case TAG_ASSERTION_INFO:
+                       getSigDataInfo->assrtInfo = (AssertionInfo*)__assertionInfo.decode(rawData + rawIter);
+                       foundMember = true;
+                       break;
+
+               case TAG_AUTHENTICATOR_NONCE:
+                       getSigDataInfo->authNonce = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                       foundMember = true;
+                       break;
+
+               case TAG_FINAL_CHALLENGE:
+                       getSigDataInfo->fch = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                       foundMember = true;
+                       break;
+
+               case TAG_TRANSACTION_CONTENT_HASH:
+                       getSigDataInfo->tcHash = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                       foundMember = true;
+                       break;
+
+               case TAG_KEYID:
+                       getSigDataInfo->keyId = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                       foundMember = true;
+                       break;
+
+               case TAG_COUNTERS:
+                       getSigDataInfo->counter = (Counters*)__counterInfo.decode(rawData + rawIter);
+                       foundMember = true;
+                       break;
+
+               default:
+                       foundMember = false;
+                       break;
+               }
+
+               rawIter = rawIter + 2 + 2 + child->len;
+               if(rawIter >= endIter)
+                       break;
+
+               child = tlv_decode(rawData + rawIter);
+               RET_IF_FAIL(child != NULL, NULL);
+       }
+
+       if(foundMember == false) {
+               free(getSigDataInfo);
+               return NULL;
+       }
+       _INFO("SignedDataTlvEncoder::decode ebd");
+       return getSigDataInfo;
+}
diff --git a/common/uafv1tlvutil/src/StringTlvEncoder.cpp b/common/uafv1tlvutil/src/StringTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..3427146
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "StringTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+StringTlvEncoder::StringTlvEncoder(void)
+{
+
+}
+
+Buffer *
+StringTlvEncoder::encode(const void *strTlv)
+{
+       return NULL;
+}
+
+void*
+StringTlvEncoder::decode(const uint8_t *rawData)
+{
+       _INFO("StringTlvEncoder start");
+
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s *tlv  = tlv_decode(rawData);
+       RET_IF_FAIL(tlv != NULL, NULL);
+
+       tlv->val = (uint8_t*)realloc(tlv->val, tlv->len + 1);
+       char *val = (char *)tlv->val;
+       val[tlv->len] = '\0';
+
+       _INFO("[%s]", val);
+
+       _INFO("StringTlvEncoder end");
+       return val;
+}
diff --git a/common/uafv1tlvutil/src/Tlv.cpp b/common/uafv1tlvutil/src/Tlv.cpp
new file mode 100644 (file)
index 0000000..7f79dc0
--- /dev/null
@@ -0,0 +1,263 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "Tlv.h"
+#include "AsmHelper.h"
+#include <stdio.h>
+#include <byteswap.h>
+
+int
+tlv_get_int_by_reverse_endian(const unsigned char *tlv_buffer_in, int bytes)
+{
+       _INFO("");
+
+       RET_IF_FAIL(tlv_buffer_in != NULL, -1);
+
+       int val = 0;
+       int i = 0;
+       for (i = 0; i < bytes; i++) {
+               uint16_t b_val = (tlv_buffer_in[i]) << (i * 8);
+               val |= b_val;
+       }
+       return val;
+}
+
+Buffer *
+tlv_to_buffer(tlv_s *tlv)
+{
+       int total_len = 2 + 2 + tlv->len;
+
+       unsigned char *enc = (unsigned char*)calloc(1, total_len);
+       unsigned char *iter = enc;
+
+       *iter = tlv->tag & 0xFF;
+       iter++;
+       *iter = (tlv->tag >> 8) & 0xFF;
+       iter++;
+
+       *iter = tlv->len & 0xFF;
+       iter++;
+       *iter = (tlv->len >> 8) & 0xFF;
+       iter++;
+
+       if ((tlv->len > 0) && (tlv->val != NULL))
+               memcpy(iter, tlv->val, tlv->len);
+
+       Buffer *buff = (Buffer*)calloc(1, sizeof(Buffer));
+       buff->len = total_len;
+       buff->data = enc;
+
+       return buff;
+}
+
+tlv_s*
+tlv_decode(const uint8_t *tlv_buffer_in)
+{
+       _INFO("tlv_buffer_in");
+
+       RET_IF_FAIL(tlv_buffer_in != NULL, NULL);
+
+       uint16_t tag = tlv_get_int_by_reverse_endian(tlv_buffer_in, 2);
+
+       uint16_t length = tlv_get_int_by_reverse_endian(tlv_buffer_in + 2, 2);
+
+       tlv_s *tlv = (tlv_s*)calloc(1, sizeof(tlv_s));
+       tlv->tag = tag;
+       tlv->len = length;
+       if (tlv->len > 0) {
+               tlv->val = (uint8_t *)calloc(1, tlv->len);
+               memcpy(tlv->val, tlv_buffer_in + 2 + 2, tlv->len);
+
+       }
+       _INFO("[%0002x][%d]", tlv->tag, tlv->len);
+
+       return tlv;
+}
+
+tlv_builder_s*
+tlv_builder_create(void)
+{
+       tlv_builder_s *builder = ALLOC(tlv_builder_s);
+
+       builder->stack = g_queue_new();
+       builder->root = NULL;
+
+       return builder;
+}
+
+tlv_builder_s*
+tlv_builder_start_composite(tlv_builder_s* builder, int tag)
+{
+       if (builder->stack == NULL)
+               return NULL;
+
+       tlv_s *node = ALLOC(tlv_s);
+       node->tag = tag;
+       node->len = 0;
+       node->val = NULL;
+
+       if (builder->root == NULL)
+               builder->root = node;
+
+       g_queue_push_head(builder->stack, node);
+
+       return builder;
+}
+
+tlv_builder_s*
+tlv_builder_add_int8(tlv_builder_s* builder, int tag, uint8_t val)
+{
+       if (builder->stack == NULL)
+               return NULL;
+
+       tlv_s *node = ALLOC(tlv_s);
+       node->tag = tag;
+       node->len = sizeof(uint8_t);
+       node->val = NALLOC(1, uint8_t);
+       *(node->val) = val;
+
+       Buffer *node_buff = tlv_to_buffer(node);
+
+       tlv_s *head = (tlv_s *)g_queue_peek_head(builder->stack);
+       head->val = (uint8_t *)realloc(head->val, head->len + node_buff->len);
+       memcpy(head->val + head->len, node_buff->data, node_buff->len);
+       head->len += node_buff->len;
+
+       //g_queue_push_head(builder->stack, head);
+
+       free(node);
+
+       return builder;
+}
+
+tlv_builder_s*
+tlv_builder_add_int16(tlv_builder_s* builder, int tag, uint16_t val)
+{
+       if (builder->stack == NULL)
+               return NULL;
+
+       tlv_s *node = ALLOC(tlv_s);
+       node->tag = tag;
+       node->len = sizeof(uint16_t);
+       node->val = NALLOC(2, uint8_t);
+       *(node->val) = (val) & 0xFF;
+       *(node->val+1) = (val>>8) & 0xFF;
+
+       Buffer *node_buff = tlv_to_buffer(node);
+
+       tlv_s *head = (tlv_s *)g_queue_peek_head(builder->stack);
+       head->val = (uint8_t *)realloc(head->val, head->len + node_buff->len);
+       memcpy(head->val + head->len, node_buff->data, node_buff->len);
+       head->len += node_buff->len;
+
+       //g_queue_push_head(builder->stack, head);
+
+       free(node);
+
+       return builder;
+}
+
+tlv_builder_s*
+tlv_builder_add_string(tlv_builder_s *builder, int tag, char *val)
+{
+       if (builder->stack == NULL)
+               return NULL;
+
+       if (val == NULL) {
+               _ERR("[%d] tag value given is NULL", tag);
+               return builder;
+       }
+
+       tlv_s *node = ALLOC(tlv_s);
+       node->tag = tag;
+       node->len = strlen(val);
+       node->val = (uint8_t*)val;
+
+       Buffer *node_buff = tlv_to_buffer(node);
+
+       tlv_s *head = (tlv_s *)g_queue_peek_head(builder->stack);
+       head->val = (uint8_t *)realloc(head->val, head->len + node_buff->len);
+       memcpy(head->val + head->len, node_buff->data, node_buff->len);
+       head->len += node_buff->len;
+
+       //g_queue_push_head(builder->stack, head);
+
+       free(node);
+
+       return builder;
+}
+
+tlv_builder_s*
+tlv_builder_add_buffer(tlv_builder_s *builder, int tag, Buffer *val)
+{
+       if (builder->stack == NULL)
+               return NULL;
+
+       tlv_s *node = ALLOC(tlv_s);
+       node->tag = tag;
+       node->len = val->len;
+       node->val = val->data;
+
+       Buffer *node_buff = tlv_to_buffer(node);
+
+       tlv_s *head = (tlv_s *)g_queue_peek_head(builder->stack);
+       head->val = (uint8_t *)realloc(head->val, head->len + node_buff->len);
+       memcpy(head->val + head->len, node_buff->data, node_buff->len);
+       head->len += node_buff->len;
+
+       //g_queue_push_head(builder->stack, head);
+
+       free(node);
+
+       return builder;
+}
+
+tlv_builder_s*
+tlv_builder_end_composite(tlv_builder_s *builder)
+{
+       if (builder->stack == NULL)
+               return NULL;
+
+       tlv_s *head = (tlv_s *)g_queue_pop_head(builder->stack);
+
+       if (g_queue_is_empty(builder->stack) == true) {
+               return builder;
+       }
+
+       Buffer *head_buff = tlv_to_buffer(head);
+
+       tlv_s *cur_head = (tlv_s *)g_queue_peek_head(builder->stack);
+
+       cur_head->val = (uint8_t *)realloc(cur_head->val, cur_head->len + head_buff->len);
+       //cur_head->len += head_buff->len;
+       memcpy(cur_head->val + cur_head->len, head_buff->data, head_buff->len);
+       cur_head->len += head_buff->len;
+
+       //g_queue_push_head(builder->stack, cur_head);
+
+       return builder;
+}
+
+
+Buffer*
+tlv_builder_get_buffer(tlv_builder_s *builder)
+{
+       Buffer *root_buff = tlv_to_buffer(builder->root);
+
+       return root_buff;
+}
+
diff --git a/common/uafv1tlvutil/src/TlvEncoderFactory.cpp b/common/uafv1tlvutil/src/TlvEncoderFactory.cpp
new file mode 100644 (file)
index 0000000..1a4ad83
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "TlvData.h"
+#include "GetInfoReqTlvEncoder.h"
+#include "GetInfoRespTlvEncoder.h"
+#include "RegReqTlvEncoder.h"
+#include "RegRespTlvEncoder.h"
+#include "SignReqTlvEncoder.h"
+#include "SignRespTlvEncoder.h"
+#include "DeRegReqTlvEncoder.h"
+#include "DeRegRespTlvEncoder.h"
+#include "AsmHelper.h"
+
+std::map<int, ITlvEncoder*> *TlvEncoderFactory::__encoderTable = NULL;
+
+ITlvEncoder*
+TlvEncoderFactory::getTlvEncoderById(int id)
+{
+       _INFO("");
+
+       if (__encoderTable == NULL)
+               __encoderTable = loadAllEncoders();
+
+       RET_IF_FAIL(__encoderTable != NULL, NULL);
+
+       _INFO("");
+       return __encoderTable->find(id)->second;
+}
+
+TlvEncoderFactory::TlvEncoderFactory(void)
+{
+
+}
+
+std::map<int, ITlvEncoder*>*
+TlvEncoderFactory::loadAllEncoders(void)
+{
+       _INFO("");
+
+       std::map<int, ITlvEncoder*>* encTable = new std::map<int, ITlvEncoder*>();
+
+       encTable->insert(std::make_pair(EID_UAFV1_GETINFO_REQ, new GetInfoReqTlvEncoder()));
+       encTable->insert(std::make_pair(EID_UAFV1_GETINFO_RESP, new GetInfoRespTlvEncoder()));
+       encTable->insert(std::make_pair(EID_UAFV1_REGISTER_REQ, new RegAssertionTlvEncoder()));
+       encTable->insert(std::make_pair(EID_UAFV1_REGISTER_RESP, new RegRespTlvEncoder()));
+       encTable->insert(std::make_pair(EID_UAFV1_SIGN_REQ, new SignReqTlvEncoder()));
+       encTable->insert(std::make_pair(EID_UAFV1_SIGN_RESP, new SignRespTlvEncoder()));
+       encTable->insert(std::make_pair(EID_UAFV1_DEREG_REQ, new DeRegReqTlvEncoder()));
+       encTable->insert(std::make_pair(EID_UAFV1_DEREG_RESP, new DeRegRespTlvEncoder()));
+       encTable->insert(std::make_pair(EID_UAFV1_REG_ASSERTION_RESP, new RegAuthAssertionTlvEncoder()));
+       encTable->insert(std::make_pair(EID_UAFV1_REG_ASSERTION_KRD_RESP, new Uafv1KrdTlvEncoder()));
+       encTable->insert(std::make_pair(EID_UAFV1_SIGN_ASSERTION_RESP, new SignAuthAssertionTlvEncoder()));
+       encTable->insert(std::make_pair(EID_UAFV1_SIGN_DATA_RESP, new SignedDataTlvEncoder()));
+
+       /*TODO Add rests*/
+
+       _INFO("");
+       return encTable;
+}
diff --git a/common/uafv1tlvutil/src/Uafv1KrdTlvEncoder.cpp b/common/uafv1tlvutil/src/Uafv1KrdTlvEncoder.cpp
new file mode 100644 (file)
index 0000000..3f06eb3
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "Uafv1KrdTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+#include "stdio.h"
+
+Uafv1KrdTlvEncoder::Uafv1KrdTlvEncoder(void)
+{
+
+}
+
+Buffer *
+Uafv1KrdTlvEncoder::encode(const void *authData)
+{
+       _INFO("Uafv1KrdTlvEncoder::encode start");
+       RET_IF_FAIL(authData != NULL, NULL);
+
+       Krd *getRegAssertionKrd = (Krd*)authData;
+
+       tlv_builder_s *builder = tlv_builder_create();
+
+       /*1.2 TAG_UAFV1_KRD*/
+       tlv_builder_start_composite(builder, TAG_UAFV1_KRD);
+
+       /*1.2.2 TAG_AAID*/
+       tlv_builder_add_string(builder, TAG_AAID, getRegAssertionKrd->aaid);
+
+       if(getRegAssertionKrd->assrtInfo != NULL) {
+
+               Buffer *assertionInfoBuff = __assertionInfo.encode(getRegAssertionKrd->assrtInfo);
+               if(assertionInfoBuff != NULL) {
+
+                       /*1.2.3 TAG_ASSERTION_INFO*/
+                       tlv_builder_add_buffer(builder, TAG_ASSERTION_INFO, assertionInfoBuff);
+               }
+       }
+
+       /*1.2.4 TAG_FINAL_CHALLENGE*/
+       tlv_builder_add_buffer(builder, TAG_FINAL_CHALLENGE, getRegAssertionKrd->fch);
+
+       /*1.2.5 TAG_KEYID*/
+       tlv_builder_add_buffer(builder, TAG_KEYID, getRegAssertionKrd->keyId);
+
+       if(getRegAssertionKrd->counter != NULL) {
+
+               Buffer *countersInfoBuff = __countersInfo.encode(getRegAssertionKrd->counter);
+               if(countersInfoBuff != NULL) {
+
+                       /*1.2.6 TAG_COUNTERS*/
+                       tlv_builder_add_buffer(builder, TAG_COUNTERS, countersInfoBuff);
+               }
+       }
+
+       /*1.2.7 TAG_PUB_KEY*/
+       tlv_builder_add_buffer(builder, TAG_PUB_KEY, getRegAssertionKrd->pubKey);
+
+       /*1.2 end*/
+       tlv_builder_end_composite(builder);
+
+       _INFO("Uafv1KrdTlvEncoder::encode end");
+       return tlv_builder_get_buffer(builder);
+}
+
+void *
+Uafv1KrdTlvEncoder::decode(const unsigned char *rawData)
+{
+       _INFO("Uafv1KrdTlvEncoder::decode start");
+       RET_IF_FAIL(rawData != NULL, NULL);
+
+       tlv_s* root = tlv_decode(rawData);
+       RET_IF_FAIL(root != NULL, NULL);
+       RET_IF_FAIL(root->tag == TAG_UAFV1_KRD, NULL);
+
+       int rawIter = 2 + 2;
+       int endIter = rawIter + root->len;
+
+       Krd *getKrdInfo = ALLOC(Krd);
+
+       tlv_s *child = tlv_decode(rawData + rawIter);
+       RET_IF_FAIL(child != NULL, NULL);
+
+       bool foundMember = false;
+
+       while(1) {
+
+               switch(child->tag) {
+
+                       case TAG_AAID:
+                               getKrdInfo->aaid = (char*)__strTlvEncoder.decode(rawData + rawIter);
+                               _INFO("aaid [%s]", getKrdInfo->aaid);
+                               foundMember = true;
+                               break;
+
+                       case TAG_ASSERTION_INFO:
+                               getKrdInfo->assrtInfo = (AssertionInfo*)__assertionInfo.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       case TAG_FINAL_CHALLENGE:
+                               getKrdInfo->fch = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                               _INFO("Final Challenge [%s]", getKrdInfo->fch);
+                               foundMember = true;
+                               break;
+
+                       case TAG_COUNTERS:
+                               getKrdInfo->counter = (Counters*)__countersInfo.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       case TAG_KEYID:
+                               getKrdInfo->keyId = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       case TAG_PUB_KEY:
+                               getKrdInfo->pubKey = (Buffer*)__buffTlvEncoder.decode(rawData + rawIter);
+                               foundMember = true;
+                               break;
+
+                       default:
+                               foundMember = false;
+                               break;
+               }
+
+               rawIter = rawIter + 2 + 2 + child->len;
+               if(rawIter >= endIter)
+                       break;
+
+               child = tlv_decode(rawData + rawIter);
+               RET_IF_FAIL(child != NULL, NULL);
+       }
+
+       if(foundMember == false) {
+               free(getKrdInfo);
+               return NULL;
+       }
+
+       _INFO("Uafv1KrdTlvEncoder::decode end");
+       return getKrdInfo;
+}
diff --git a/common/uiutil/inc/AcUiAdaptor.h b/common/uiutil/inc/AcUiAdaptor.h
new file mode 100644 (file)
index 0000000..b74c471
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014 - 2015 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 ACUIADAPTOR_H_
+#define ACUIADAPTOR_H_
+
+#include <string>
+#include <vector>
+#include <glib.h>
+
+class AcUiAdaptor {
+public:
+       static AcUiAdaptor* getInstance(void);
+
+       std::string confirmAccount(const std::string& appId,
+                                                       const std::vector<std::string>& accList, int *err);
+
+       static void OnAccountResponseFromUi(const char *sessionData, int result,
+                                                                               const char *selecAcc);
+private:
+       AcUiAdaptor(void);
+       ~AcUiAdaptor(void);
+       char *genNonce(void);
+
+       const char **convertVectorToCharArray(const std::vector<std::string>& stringVec);
+private:
+       static AcUiAdaptor *__this;
+       char *__sessionData;
+       int __result;
+       std::string __selectedAcc;
+       GMainLoop *__mainLoop;
+       int __uiAppPid;
+};
+
+
+#endif /* ACUIADAPTOR_H_ */
diff --git a/common/uiutil/inc/AsmUiCommonTypes.h b/common/uiutil/inc/AsmUiCommonTypes.h
new file mode 100644 (file)
index 0000000..84af383
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014 - 2015 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 ASMUICOMMONTYPES_H
+#define ASMUICOMMONTYPES_H
+
+
+#define ASM_UI_APP_NAME "org.tizen.asmui"
+#define TC_UI_KEY_MODE "mode"
+#define TC_UI_VAL_MODE_TC "TC"
+#define TC_UI_VAL_MODE_ACCOUNT "ACCOUNT"
+#define TC_UI_VAL_MODE_PIN_ENROLL "PIN_ENROLL"
+#define TC_UI_VAL_MODE_PIN_VERIFY "PIN_VERIFY"
+#define TC_UI_KEY_NONCE "nonce"
+#define TC_UI_KEY_TEXT "transaction_text"
+#define TC_UI_KEY_ACC_LIST "account_list"
+#define TC_UI_KEY_APP "app_id"
+#define TC_UI_KEY_TOK "token"
+#define OWNER_UID 5001
+
+typedef enum {
+       TC_UI_RESULT_USER_DENIED = -1,
+       TC_UI_RESULT_USER_ALLOWED = 0
+} tc_ui_result_e;
+
+typedef enum {
+       AC_UI_RESULT_USER_DENIED = -1,
+       AC_UI_RESULT_USER_SELCTED = 0
+} ac_ui_result_e;
+
+#endif // ASMUICOMMONTYPES_H
diff --git a/common/uiutil/inc/AuthUiFactory.h b/common/uiutil/inc/AuthUiFactory.h
new file mode 100644 (file)
index 0000000..a98710f
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014 - 2015 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 AUTHUIFACTORY_H
+#define AUTHUIFACTORY_H
+
+#include <string>
+#include <glib.h>
+#include "IAuthUiAdaptor.h"
+
+typedef enum {
+       AUTH_UI_TYPE_PIN,
+       AUTH_UI_TYPE_FACE,
+       AUTH_UI_TYPE_FINGER_PRINT,
+       AUTH_UI_TYPE_PIN_VOICE
+} auth_ui_type_e;
+
+class AuthUiFactory {
+public:
+       static IAuthUiAdaptor *getAuthUiAdaptor(auth_ui_type_e type);
+
+private:
+       AuthUiFactory(void);
+       ~AuthUiFactory(void);
+};
+
+#endif // AUTHUIFACTORY_H
diff --git a/common/uiutil/inc/IAuthUiAdaptor.h b/common/uiutil/inc/IAuthUiAdaptor.h
new file mode 100644 (file)
index 0000000..4285aac
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef IAUTHUIADAPTOR_H
+#define IAUTHUIADAPTOR_H
+
+#include <string>
+#include <glib.h>
+
+class IAuthUiAdaptor {
+public:
+       /*O/P : UserVerificationToken, the subsequent reg/sign commands must have the same*/
+       virtual std::string enrollUser(const std::string& appId, int *err) = 0;
+       virtual std::string verifyUser(const std::string& appId, const std::string &token, int *err) = 0;
+
+       virtual void OnAuthResponseFromUi(const char *sessionData,
+                                                                         const char *usrVerTok,
+                                                                         int result) = 0;
+
+       virtual ~IAuthUiAdaptor(void) {}
+};
+
+#endif // IAUTHUIADAPTOR_H
diff --git a/common/uiutil/inc/PinAuthUiAdaptor.h b/common/uiutil/inc/PinAuthUiAdaptor.h
new file mode 100644 (file)
index 0000000..da9fb1c
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef PINAUTHUIADAPTOR_H
+#define PINAUTHUIADAPTOR_H
+
+#include <string>
+#include <glib.h>
+#include "IAuthUiAdaptor.h"
+
+class PinAuthUiAdaptor : public IAuthUiAdaptor {
+public:
+       static PinAuthUiAdaptor* getInstance(void);
+
+       /*O/P : UserVerificationToken, the subsequent reg/sign commands must have the same*/
+       virtual std::string enrollUser(const std::string& appId, int *err);
+       virtual std::string verifyUser(const std::string& appId, const std::string &token, int *err);
+
+       virtual void OnAuthResponseFromUi(const char *sessionData,
+                                                                         const char *usrVerTok,
+                                                                         int result);
+private:
+       typedef enum {
+               PIN_AUTH_MODE_MIN,
+               PIN_AUTH_MODE_ENROLL,
+               PIN_AUTH_MODE_VERIFY,
+               PIN_AUTH_MODE_MAX
+       } pin_auth_mode_e;
+
+       PinAuthUiAdaptor(void);
+       ~PinAuthUiAdaptor(void);
+       char *genNonce(void);
+
+       std::string getTokenFromUi(pin_auth_mode_e type, const std::string& appId,
+                                                          const std::string& tok, int *err);
+
+       static void init(void);
+
+private:
+       static PinAuthUiAdaptor *__this;
+       char *__sessionData;
+       int __result;
+       char *__usrVerTok;
+       GMainLoop *__mainLoop;
+       int __uiAppPid;
+};
+
+#endif // PINAUTHUIADAPTOR_H
diff --git a/common/uiutil/inc/TCUiAdaptor.h b/common/uiutil/inc/TCUiAdaptor.h
new file mode 100644 (file)
index 0000000..9ca6c45
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014 - 2015 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 TCUIADAPTOR_H_
+#define TCUIADAPTOR_H_
+
+#include <string>
+#include <glib.h>
+
+class TcUiAdaptor {
+public:
+       static TcUiAdaptor* getInstance(void);
+       /*Currently only supports TEXT Transaction Confirmation, TODO: Image + Text combo*/
+       int confirmTransaction(const std::string& trans, const std::string& app);
+
+       static void OnTcResponseFromUi(const char *sessionData, int result);
+private:
+       TcUiAdaptor(void);
+       ~TcUiAdaptor(void);
+       char *genNonce(void);
+
+private:
+       static TcUiAdaptor *__this;
+       char *__sessionData;
+       int __result;
+       GMainLoop *__mainLoop;
+       int __uiAppPid;
+};
+
+
+#endif /* TCUIADAPTOR_H_ */
diff --git a/common/uiutil/src/AcUiAdaptor.cpp b/common/uiutil/src/AcUiAdaptor.cpp
new file mode 100644 (file)
index 0000000..038447b
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AcUiAdaptor.h"
+#include <glib.h>
+#include <aul.h>
+#include <string.h>
+#include <AsmHelper.h>
+#include <bundle.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <sys/time.h>
+#include <stdlib.h>
+#include "AsmUiCommonTypes.h"
+
+AcUiAdaptor* AcUiAdaptor::__this = NULL;
+static const int NONCE_LEN = 8;
+
+AcUiAdaptor*
+AcUiAdaptor::getInstance(void)
+{
+       if (__this != NULL)
+               return __this;
+
+       __this = new AcUiAdaptor();
+
+       return __this;
+}
+
+char *
+AcUiAdaptor::genNonce(void)
+{
+       struct timeval t1;
+       gettimeofday(&t1, NULL);
+       srand(t1.tv_usec * t1.tv_sec);
+
+       char *nonce = NALLOC(NONCE_LEN + 1, char);
+       for (int i = 0; i < NONCE_LEN; i++) {
+               int randNum = rand() % ('z' - '0');
+               nonce[i] = '0' + randNum;
+       }
+       nonce[NONCE_LEN] = '\0';
+
+       return nonce;
+}
+
+const char **
+AcUiAdaptor::convertVectorToCharArray(const std::vector<std::string>& stringVec)
+{
+       int vecSize = stringVec.size();
+       RET_IF_FAIL(vecSize > 0, NULL);
+
+       const char **charArray = NALLOC(vecSize, const char*);
+       for (int i = 0; i < vecSize; i++) {
+               std::string ipStr = stringVec.at(i);
+               int ipStrLen = ipStr.length();
+
+               char *cpStr = NALLOC(ipStrLen + 1, char);
+               strncpy(cpStr, ipStr.c_str(), ipStrLen);
+
+               charArray[i] = cpStr;
+       }
+
+       return charArray;
+}
+
+std::string
+AcUiAdaptor::confirmAccount(const std::string& appId,
+                                                       const std::vector<std::string>& accList, int *err)
+{
+       /*TODO: Disabled until UI launch-kill-launch sequence issue is fixed*/
+       _INFO("Disabled Account UI");
+       return accList.at(0);
+
+       if (__sessionData != NULL) {
+               _ERR("UI operation already in progress");
+               *err = -1;
+               return "";
+       }
+
+       int vecSize = accList.size();
+       if (vecSize <= 0) {
+               *err = -1;
+               return "";
+       }
+
+       __sessionData = genNonce();
+       __result = -1;
+       __selectedAcc.clear();
+
+
+       bundle *b = bundle_create();
+       bundle_add_str(b, TC_UI_KEY_MODE, TC_UI_VAL_MODE_ACCOUNT);
+       bundle_add_str(b, TC_UI_KEY_NONCE, __sessionData);
+       bundle_add_str_array(b, TC_UI_KEY_ACC_LIST, convertVectorToCharArray(accList),
+                                                accList.size());
+       bundle_add_str(b, TC_UI_KEY_APP, appId.c_str());
+
+       int uiPid = -1;
+       int tryCount = 0;
+
+       for(; tryCount < 10; tryCount++) {
+               uiPid = aul_launch_app_for_uid(ASM_UI_APP_NAME, b, OWNER_UID);
+               _INFO("aul_launch_app = [%d]", uiPid);
+               if (uiPid > 0)
+                       break;
+       }
+
+       if (uiPid < 0) {
+               if (uiPid == AUL_R_EINVAL)
+                       _INFO("AUL_R_EINVAL");
+               if (uiPid == AUL_R_ECOMM)
+                       _INFO("AUL_R_ECOM");
+               if (uiPid == AUL_R_ERROR)
+                       _INFO("AUL_R_ERROR");
+
+               __sessionData = NULL;
+
+               /*TODO*/
+               _ERR("Account UI Launch failed, returning first one for test");
+               __sessionData = NULL;
+               return accList.at(0);
+       }
+
+       __uiAppPid = uiPid;
+
+       __mainLoop = NULL;
+
+       __mainLoop = g_main_loop_new(NULL, FALSE);
+
+       g_main_loop_run(__mainLoop);
+
+       _INFO("AcUiAdaptor::confirmAccount:: set _sessionData NULL");
+       SAFE_DELETE(__sessionData);
+       __sessionData = NULL;
+
+       aul_terminate_pid_sync_for_uid(__uiAppPid, OWNER_UID);
+
+       *err = __result;
+       return __selectedAcc;
+}
+
+void
+AcUiAdaptor::OnAccountResponseFromUi(const char *sessionData, int result, const char *selecAcc)
+{
+       _INFO("");
+       if (AcUiAdaptor::getInstance()->__sessionData == NULL || sessionData == NULL)
+               return;
+
+       _INFO("%s", sessionData);
+
+       _INFO("%s", AcUiAdaptor::getInstance()->__sessionData);
+       if (strcmp(sessionData, AcUiAdaptor::getInstance()->__sessionData) != 0)
+               return;
+
+       _INFO("");
+       AcUiAdaptor::getInstance()->__result = result;
+       if (selecAcc != NULL) {
+               _INFO("%s", selecAcc);
+               std::string selectedAcc(selecAcc);
+               AcUiAdaptor::getInstance()->__selectedAcc = selectedAcc;
+       } else {
+               AcUiAdaptor::getInstance()->__selectedAcc.clear();
+               if (AcUiAdaptor::getInstance()->__result == AC_UI_RESULT_USER_SELCTED)
+                       AcUiAdaptor::getInstance()->__result = AC_UI_RESULT_USER_DENIED;
+       }
+
+
+       g_main_loop_quit(AcUiAdaptor::getInstance()->__mainLoop);
+
+}
+
+AcUiAdaptor::AcUiAdaptor(void)
+{
+       __sessionData = NULL;
+       __result = -1;
+}
+
+AcUiAdaptor::~AcUiAdaptor(void)
+{
+       SAFE_DELETE(__sessionData);
+}
+
diff --git a/common/uiutil/src/AuthUiFactory.cpp b/common/uiutil/src/AuthUiFactory.cpp
new file mode 100644 (file)
index 0000000..354ee1c
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AuthUiFactory.h"
+#include "PinAuthUiAdaptor.h"
+#include "AsmHelper.h"
+
+IAuthUiAdaptor *
+AuthUiFactory::getAuthUiAdaptor(auth_ui_type_e type)
+{
+       _BEGIN;
+       switch (type) {
+
+       case AUTH_UI_TYPE_PIN:
+               _INFO("AuthUiFactory::getAuthUiAdaptor:: PinAuthUiAdaptor");
+               return PinAuthUiAdaptor::getInstance();
+       default:
+               return NULL;
+       }
+
+       _END;
+       return NULL;
+}
diff --git a/common/uiutil/src/PinAuthUiAdaptor.cpp b/common/uiutil/src/PinAuthUiAdaptor.cpp
new file mode 100644 (file)
index 0000000..46fb643
--- /dev/null
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "PinAuthUiAdaptor.h"
+#include <glib.h>
+#include <aul.h>
+#include <string.h>
+#include <AsmHelper.h>
+#include <bundle.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <sys/time.h>
+#include <pthread.h>
+#include "AsmUiCommonTypes.h"
+
+PinAuthUiAdaptor* PinAuthUiAdaptor::__this = NULL;
+static const int NONCE_LEN = 8;
+
+void
+PinAuthUiAdaptor::init(void)
+{
+       __this = new PinAuthUiAdaptor();
+       _INFO("[%p]", __this);
+}
+
+PinAuthUiAdaptor*
+PinAuthUiAdaptor::getInstance(void)
+{
+       static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
+       pthread_once(&onceBlock, init);
+
+       _INFO("[%p]", __this);
+       return __this;
+}
+
+char *
+PinAuthUiAdaptor::genNonce(void)
+{
+       struct timeval t1;
+       gettimeofday(&t1, NULL);
+       srand(t1.tv_usec * t1.tv_sec);
+
+       char *nonce = NALLOC(NONCE_LEN + 1, char);
+       for (int i = 0; i < NONCE_LEN; i++) {
+               int randNum = rand() % ('z' - '0');
+               nonce[i] = '0' + randNum;
+       }
+       nonce[NONCE_LEN] = '\0';
+
+       _INFO("None gen=[%s]", nonce);
+
+       return nonce;
+}
+
+std::string
+PinAuthUiAdaptor::getTokenFromUi(pin_auth_mode_e type, const std::string& appId,
+                                                                const std::string& tok, int *err)
+{
+       _BEGIN;
+       if (type <= PIN_AUTH_MODE_MIN ||
+                       type >= PIN_AUTH_MODE_MAX)
+               return "";
+
+       if (__sessionData != NULL) {
+               _ERR("UI operation already in progress");
+               return "";
+       }
+
+       __sessionData = genNonce();
+       _INFO("SessionData sent to UI=[%s][%p]", __sessionData, __sessionData);
+       __usrVerTok = NULL;
+       __result = -1;
+
+       bundle *b = bundle_create();
+       if (type == PIN_AUTH_MODE_ENROLL)
+               bundle_add_str(b, TC_UI_KEY_MODE, TC_UI_VAL_MODE_PIN_ENROLL);
+       else if (type == PIN_AUTH_MODE_VERIFY) {
+               bundle_add_str(b, TC_UI_KEY_MODE, TC_UI_VAL_MODE_PIN_VERIFY);
+               bundle_add_str(b, TC_UI_KEY_TOK, tok.c_str());
+       }
+
+       bundle_add_str(b, TC_UI_KEY_NONCE, __sessionData);
+       _INFO("SessionData sent to UI=[%s]", __sessionData);
+       bundle_add_str(b, TC_UI_KEY_APP, appId.c_str());
+
+       int uiPid = -1;
+
+       for (int i = 0; i < 10; i++) {
+               uiPid = aul_launch_app_for_uid(ASM_UI_APP_NAME, b, OWNER_UID);
+               _INFO("aul_launch_app = [%d]", uiPid);
+               if (uiPid < 0) {
+                       if (uiPid == AUL_R_EINVAL)
+                               _INFO("AUL_R_EINVAL");
+                       if (uiPid == AUL_R_ECOMM)
+                               _INFO("AUL_R_ECOM");
+                       if (uiPid == AUL_R_ERROR)
+                               _INFO("AUL_R_ERROR");
+
+                       *err = -1;
+                       //return "";
+
+               } else {
+                       break;
+               }
+       }
+
+       if (uiPid < 0) {
+               *err = -1;
+               return "";
+       }
+
+       __uiAppPid = uiPid;
+
+       __mainLoop = NULL;
+
+       __mainLoop = g_main_loop_new(NULL, FALSE);
+
+       g_main_loop_run(__mainLoop);
+
+       _INFO("");
+       SAFE_DELETE(__sessionData);
+       __sessionData = NULL;
+
+       aul_terminate_pid_sync_for_uid(__uiAppPid, OWNER_UID);
+
+       *err = __result;
+
+       if (__usrVerTok == NULL)
+               return "";
+
+       return std::string(__usrVerTok);
+}
+
+std::string
+PinAuthUiAdaptor::enrollUser(const std::string& appId, int *err)
+{
+       return getTokenFromUi(PIN_AUTH_MODE_ENROLL, appId, "", err);
+}
+
+std::string
+PinAuthUiAdaptor::verifyUser(const std::string& appId,
+                                                        const std::string& token, int *err)
+{
+       _BEGIN;
+       return getTokenFromUi(PIN_AUTH_MODE_VERIFY, appId, token, err);
+}
+
+void
+PinAuthUiAdaptor::OnAuthResponseFromUi(const char *sessionData, const char *usrVerTok, int result)
+{
+       _INFO("");
+       if (sessionData != NULL)
+               _INFO("SessionData received from to UI=[%s]", sessionData);
+       else
+               _INFO("SessionData received from to UI=[NULL]");
+
+       _INFO("SessionData stored addr=[%p]", PinAuthUiAdaptor::getInstance()->__sessionData);
+
+       if (PinAuthUiAdaptor::getInstance()->__sessionData == NULL || sessionData == NULL)
+               return;
+
+       _INFO("%s", sessionData);
+       _INFO("%s", PinAuthUiAdaptor::getInstance()->__sessionData);
+       if (strcmp(sessionData, PinAuthUiAdaptor::getInstance()->__sessionData) != 0)
+               return;
+
+       _INFO("");
+       PinAuthUiAdaptor::getInstance()->__usrVerTok = strdup(usrVerTok);
+       PinAuthUiAdaptor::getInstance()->__result = result;
+
+       g_main_loop_quit(PinAuthUiAdaptor::getInstance()->__mainLoop);
+
+}
+
+PinAuthUiAdaptor::PinAuthUiAdaptor(void)
+{
+       __sessionData = NULL;
+       __result = -1;
+       __usrVerTok = NULL;
+}
+
+PinAuthUiAdaptor::~PinAuthUiAdaptor(void)
+{
+       SAFE_DELETE(__sessionData);
+       SAFE_DELETE(__usrVerTok);
+}
+
diff --git a/common/uiutil/src/TCUiAdaptor.cpp b/common/uiutil/src/TCUiAdaptor.cpp
new file mode 100644 (file)
index 0000000..0b0bb2a
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "TCUiAdaptor.h"
+#include <glib.h>
+#include <aul.h>
+#include <string.h>
+#include <AsmHelper.h>
+#include <bundle.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <sys/time.h>
+#include "AsmUiCommonTypes.h"
+
+TcUiAdaptor* TcUiAdaptor::__this = NULL;
+static const int NONCE_LEN = 8;
+
+TcUiAdaptor*
+TcUiAdaptor::getInstance(void)
+{
+       if (__this != NULL)
+               return __this;
+
+       __this = new TcUiAdaptor();
+
+       return __this;
+}
+
+char *
+TcUiAdaptor::genNonce(void)
+{
+       struct timeval t1;
+       gettimeofday(&t1, NULL);
+       srand(t1.tv_usec * t1.tv_sec);
+
+       char *nonce = NALLOC(NONCE_LEN + 1, char);
+       for (int i = 0; i < NONCE_LEN; i++) {
+               int randNum = rand() % ('z' - '0');
+               nonce[i] = '0' + randNum;
+       }
+       nonce[NONCE_LEN] = '\0';
+
+       return nonce;
+}
+
+/*Currently only supports TEXT Transaction Confirmation, TODO: Image + Text combo*/
+int
+TcUiAdaptor::confirmTransaction(const std::string& trans, const std::string& app)
+{
+       _BEGIN;
+       /*TODO: Disabled until UI launch-kill-launch sequence issue is fixed*/
+       _INFO("Disabled Transaction Confirmation UI");
+       return 0;
+
+       if (__sessionData != NULL) {
+               _ERR("UI operation already in progress");
+               return -1;
+       }
+
+       __sessionData = genNonce();
+       __result = -1;
+
+       bundle *b = bundle_create();
+       bundle_add_str(b, TC_UI_KEY_MODE, TC_UI_VAL_MODE_TC);
+       bundle_add_str(b, TC_UI_KEY_NONCE, __sessionData);
+       bundle_add_str(b, TC_UI_KEY_TEXT, trans.c_str());
+       bundle_add_str(b, TC_UI_KEY_APP, app.c_str());
+
+       int uiPid;
+       int tryCount = 0;
+
+       for(; tryCount < 10; tryCount++) {
+               uiPid = aul_launch_app_for_uid(ASM_UI_APP_NAME, b, OWNER_UID);
+               _INFO("aul_launch_app = [%d]", uiPid);
+               if(uiPid > 0)
+                       break;
+       }
+       if (uiPid < 0) {
+               if (uiPid == AUL_R_EINVAL)
+                       _INFO("AUL_R_EINVAL");
+               if (uiPid == AUL_R_ECOMM)
+                       _INFO("AUL_R_ECOM");
+               if (uiPid == AUL_R_ERROR)
+                       _INFO("AUL_R_ERROR");
+
+               /*TODO*/
+               _ERR("TC UI Launch failed, returning success for test");
+               __sessionData = NULL;
+               return 0;
+       }
+
+       __uiAppPid = uiPid;
+
+       __mainLoop = NULL;
+
+       __mainLoop = g_main_loop_new(NULL, FALSE);
+
+       g_main_loop_run(__mainLoop);
+
+       _INFO("TcUiAdaptor::confirmTransaction::set _sessionData NULL");
+       SAFE_DELETE(__sessionData);
+       __sessionData = NULL;
+
+       aul_terminate_pid_sync_for_uid(__uiAppPid, OWNER_UID);
+
+       _END;
+       return __result;
+}
+
+void
+TcUiAdaptor::OnTcResponseFromUi(const char *sessionData, int result)
+{
+       _INFO("");
+       if (TcUiAdaptor::getInstance()->__sessionData == NULL || sessionData == NULL)
+               return;
+
+       _INFO("%s", sessionData);
+       _INFO("%s", TcUiAdaptor::getInstance()->__sessionData);
+       if (strcmp(sessionData, TcUiAdaptor::getInstance()->__sessionData) != 0)
+               return;
+
+       _INFO("");
+       TcUiAdaptor::getInstance()->__result = result;
+
+       g_main_loop_quit(TcUiAdaptor::getInstance()->__mainLoop);
+
+}
+
+TcUiAdaptor::TcUiAdaptor(void)
+{
+       __sessionData = NULL;
+       __result = -1;
+}
+
+TcUiAdaptor::~TcUiAdaptor(void)
+{
+       SAFE_DELETE(__sessionData);
+}
diff --git a/fido-asm.manifest b/fido-asm.manifest
new file mode 100644 (file)
index 0000000..ad0406a
--- /dev/null
@@ -0,0 +1,9 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+       <assign>
+       <filesystem path="/opt/usr/data/fido_tizen_auth.der" label="_" />
+       <filesystem path="/opt/usr/data/fido_tizen_auth.key" label="_" />
+    </assign>
+</manifest>
diff --git a/fido-ble-ragent.manifest b/fido-ble-ragent.manifest
new file mode 100644 (file)
index 0000000..97e8c31
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
diff --git a/fido-bt-ragent.manifest b/fido-bt-ragent.manifest
new file mode 100644 (file)
index 0000000..97e8c31
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
diff --git a/fido-roaming-agent.manifest b/fido-roaming-agent.manifest
new file mode 100644 (file)
index 0000000..97e8c31
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
diff --git a/fido_tizen_auth.der b/fido_tizen_auth.der
new file mode 100644 (file)
index 0000000..ec46478
Binary files /dev/null and b/fido_tizen_auth.der differ
diff --git a/fido_tizen_auth.key b/fido_tizen_auth.key
new file mode 100644 (file)
index 0000000..263ef61
--- /dev/null
@@ -0,0 +1,30 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,23B79ED36ABB777F
+
+qFRxc1r2S1DABp3skhy2qS426QqeoVZZ5p58SDP1Ld/Aj17mfEef+EsmskZ160Tg
+dzo8GAaiu6N+eMjDxtNRjf1MaRCskXtAOKDPgMvGgXv+rYxgiiFZ2NlSEruh3pul
+R8cu6SNQXE3m+MFf0oEiywuyiWeqyK20a71E4FLLVii+MjGMbwuCw/Q484UARlYT
+pfepucEYR4nkwqJD7T20pa90zY8MaqhHPxcAQ3y8CgpAU+FDQA6xF1zJueHPtXMu
+HJmU7sEmK0aiC0YiUZ3K4+euPamXIqKfZnzay3/D0R9tfQJBA2C6D/vRy0AfK7Cr
+DSraSUAH9tyTi07rzhRQMBGTf9R55IyD4n28Kr5Xkaj8xSVjnpKvdKRXUtCzXK79
+MPSXx6IPbvvkJEQ6s6msBSb5BElFB/jnW8u/qzrIQ04LOD8vVLmfzwbsvbC7o90N
+ipSzmEpkgtX8ZQwe8m50CzdrprfprADGcBfKRp51XQKgAd94AfJKI9OJhKy/OItC
+3Lm2jPjuUjpefjDZEgqbT4O61p5yQXHMKs4slvqpeh385EFmJULgIEwbSYB4hwUw
+N6UbWyYzCkVLTkyqQdikl2WtA+8I4WIPwERcT/ivot6O3j9bxBiH7YDz+KZyy1N4
+nyjsZyeLjXIUYVIKiqfGVwnDDLiL7AjkyRkpc6mb8aMeRlEOff0dsTwJ0fliUiHB
+9vbKfo5OIPl9ILqeV1FpCPsuOSs63Y6Qq1JE1z0rILdOEVjE+nPaR+NzP+WF3GUL
+wKapElRD2ANr4zOMQd7T3EIKk8U0m8iXz3AKmMYYJAGC/pk9rr+vbAuRBzuyv+7J
+dmZKQgwsNFyEIJzvKzB4J09PQUcESHq6s0CgrEfpK10KsdgGmI5DDQZI93CR4d7+
+OzfiokDU1gIpsKKf4JBppPHaq/CJS1Wd1+iRH3r+zhkaaoou4iwUXxLDcG/GsmOG
+2+UZtoOk7sCqsL24dUSy3wabzxAWEOrbo2rN3hTiSod7983584V0qFnIWRKHFwtK
+odtv0kfulZMjuS9Oyf2ay3vb07h7KxX1EYM7+0VKxy3ZY52rupxoKPxfD0i3ZxIk
+FRaRsaAy1qyYikgRtEv/kdYW/hyxHEsoI4PJ570g8PmxTD4cO7Ue/i8HMLIByRvJ
+StFPP0wBAqFD4NvS9B5ftzubGySn4RDA/c73t+nq+NtS4lJ5OuKCR5eloh9xOkQs
+BVIYKisLm2812ujm6Y+6aaGOtglW/sbe5kTfxIWsm361WViADp0owC7zFMhcOTU1
+iYJv+rDIdT4/lDIj/KR40GqtNFa/cchFHlp/HzXwHuBwEtdBN0QNCiws5bJ0lQnS
+XNslme4p8OQzbm4XNe+cnfdDxM6uXmbeMxpxkeKorfNxLs27sv1pjwY9TWDU7fqo
+dF3j4cv6pCDZN/3ZZLPqkZ34jXXDz/u/HH26rpJs733kbMC3E/0cUmhvYMtTpRUY
+5btkkaOOVTJZvS80Qv/BiN79PVKL1mDj4vzlUohaYZs6067LcTh5xdOUCsAzuV3a
+ml0YcIVNhxaTflogTMNLRrXA57C/PNFojAN52EwI0HGBh+t/93XiHv16oI0Rt0Bn
+-----END RSA PRIVATE KEY-----
diff --git a/fido_tizen_auth_b64.txt b/fido_tizen_auth_b64.txt
new file mode 100644 (file)
index 0000000..0d15b4c
--- /dev/null
@@ -0,0 +1,20 @@
+MIIDqDCCApACCQD6yYgIA0+sKDANBgkqhkiG9w0BAQsFADCBlTELMAkGA1UEBhMC
+S1IxDjAMBgNVBAgMBVNlb3VsMQ4wDAYDVQQHDAVTZW91bDEcMBoGA1UECgwTU2Ft
+c3VuZyBFbGVjdHJvbmljczEOMAwGA1UECwwFVGl6ZW4xEjAQBgNVBAMMCVRFU1Qj
+MTExMTEkMCIGCSqGSIb3DQEJARYVbWFuYXNpai5yQHNhbXN1bmcuY29tMB4XDTE2
+MTIxNTA4MDk0NFoXDTE3MTIxNTA4MDk0NFowgZUxCzAJBgNVBAYTAktSMQ4wDAYD
+VQQIDAVTZW91bDEOMAwGA1UEBwwFU2VvdWwxHDAaBgNVBAoME1NhbXN1bmcgRWxl
+Y3Ryb25pY3MxDjAMBgNVBAsMBVRpemVuMRIwEAYDVQQDDAlURVNUIzExMTExJDAi
+BgkqhkiG9w0BCQEWFW1hbmFzaWouckBzYW1zdW5nLmNvbTCCASIwDQYJKoZIhvcN
+AQEBBQADggEPADCCAQoCggEBAKJ8Ynw/JOPpxggCmor46krJysT/WUyTtRYKgrqI
+w6KLNLv4uwYCBk4rQgcKU0bfeqZ2hGmT5SVxZ0YqTHX5oy+MxF8yp6r5MDDFRO0C
+7OcBYDitcFz+R4VOd6bfqmwQRGN47yk9tLtV6FBe4IkEx9QBmE8Xis6SDsPRrrCs
+sYm+yWtXBFWhOsLU7g0unfK2WrWtQoJWcBAfiIke5ZdevMYEYWMR/hCDFhrRVMfK
+gmT81aJEfj+qburKiyeOweaRlf6xJinA1FchR7xZWE4hbsoTHaFI+AZlqcQBuBvd
+EvBl+iXSywTPlJTuvNrxcYPJQ5h1LZwGsmtS4LjdlmcClxMCAwEAATANBgkqhkiG
+9w0BAQsFAAOCAQEAAt5hkKvp2ysZWyVicOu9nW5Zff1jDAmA9Tg0+bWmR+EJEbHs
+EIBNIaDOSIwZ5/mhVJx0NJ3srv+uFwtXEX39cY8/DOdBh44NX2TEywaNDzYhYQM2
+Oe24NU0thYOgs0oZQnnYNX4HdkSas3ADNyBuKdFm8bUcNPW2Vak2uTT00pJVopoP
+VxlJ/uEx+ca/6Y656whu78jAwbnux3kJrwPhxr+5iC82/Z+bKFNpDErQ4S8lcPTR
+DB2Kexd450HVOPxWPlm01B7Z6fVf701jHobkjd+OHgu+pZ6RpzGrE6dhtUoBvKlq
+XXx8AplFdITI3P8LuPIN5z3A3/5D9Uu4Bsy79w==
diff --git a/org.tizen.asmui.manifest b/org.tizen.asmui.manifest
new file mode 100644 (file)
index 0000000..75b0fa5
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+    <request>
+        <domain name="_"/>
+    </request>
+</manifest>
diff --git a/packaging/fido-asm.service b/packaging/fido-asm.service
new file mode 100644 (file)
index 0000000..132bf2a
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=FIDO ASM service
+After=tizen-runtime.target
+Requires=tizen-runtime.target
+
+[Service]
+ExecStart=/usr/bin/fido-asm
+
+[Install]
+WantedBy=multi-user.target
diff --git a/packaging/fido-asm.spec b/packaging/fido-asm.spec
new file mode 100644 (file)
index 0000000..2868296
--- /dev/null
@@ -0,0 +1,352 @@
+
+Name:       fido-asm
+Summary:    Tizen FIDO Reference ASM
+Version:    0.0.1
+Release:    1
+Group:      Social & Content/Other
+License:    Apache-2.0
+Source0:    fido-asm-%{version}.tar.gz
+Source1:    org.tizen.fido-asm.service
+Source2:    org.tizen.fido-asm.conf
+Source3:    fido-asm.service
+Source4:    fido-roaming-agent.service
+Source5:    fido-ble-roaming-agent.service
+Source6:    fido-bt-roaming-agent.service
+
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(db-util)
+BuildRequires:  pkgconfig(capi-base-common)
+BuildRequires:  pkgconfig(pkgmgr-info)
+BuildRequires:  pkgconfig(glib-2.0) >= 2.26
+BuildRequires:  pkgconfig(gio-2.0)
+BuildRequires:  pkgconfig(json-glib-1.0)
+BuildRequires:  pkgconfig(vconf)
+BuildRequires:  pkgconfig(cynara-client)
+BuildRequires:  pkgconfig(cynara-session)
+BuildRequires:  pkgconfig(cynara-creds-gdbus)
+BuildRequires:  pkgconfig(capi-network-connection)
+BuildRequires:  pkgconfig(libtzplatform-config)
+BuildRequires:  pkgconfig(sqlite3)
+BuildRequires:  pkgconfig(capi-appfw-app-manager)
+BuildRequires:  pkgconfig(iotcon)
+BuildRequires:  pkgconfig(capi-system-info)
+BuildRequires:  pkgconfig(capi-system-system-settings)
+BuildRequires:  pkgconfig(openssl)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(capi-network-bluetooth)
+BuildRequires: pkgconfig(capi-network-wifi-direct)
+BuildRequires: pkgconfig(capi-network-connection)
+BuildRequires:  pkgconfig(db-util)
+
+Requires(post): /sbin/ldconfig
+Requires(post): /usr/bin/sqlite3
+Requires(postun): /sbin/ldconfig
+
+%description
+Tizen Reference ASM
+
+%package devel
+Summary:    Tizen Reference ASM (DEV)
+Group:      Social & Content/Other
+Requires:   %{name} = %{version}-%{release}
+
+%description devel
+Tizen Reference ASM (DEV)
+
+%prep
+%setup -q
+cp %{SOURCE1} .
+
+%build
+%if 0%{?sec_build_binary_debug_enable}
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+%endif
+
+export CFLAGS="${CFLAGS} -fPIC -fvisibility=hidden"
+
+cmake . \
+-DCMAKE_INSTALL_PREFIX=%{_prefix} \
+-DLIBDIR=%{_libdir} \
+-DINCLUDEDIR=%{_includedir}
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+mkdir -p %{buildroot}/usr/share/dbus-1/system-services
+install -m 0644 %SOURCE1 %{buildroot}/usr/share/dbus-1/system-services/org.tizen.fido-asm.service
+
+mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
+install -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/dbus-1/system.d/
+
+mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
+install -m 644 %SOURCE3 %{buildroot}%{_unitdir}/fido-asm.service
+%install_service multi-user.target.wants fido-asm.service
+
+mkdir -p %{buildroot}%{_libdir}/fido/asm/auth
+
+mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
+install -m 0644 %SOURCE4 %{buildroot}%{_unitdir}/fido-roaming-agent.service
+%install_service multi-user.target.wants fido-roaming-agent.service
+
+mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
+install -m 0644 %SOURCE5 %{buildroot}%{_unitdir}/fido-ble-roaming-agent.service
+%install_service multi-user.target.wants fido-ble-roaming-agent.service
+
+mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
+install -m 0644 %SOURCE6 %{buildroot}%{_unitdir}/fido-bt-roaming-agent.service
+%install_service multi-user.target.wants fido-bt-roaming-agent.service
+
+
+%post
+/sbin/ldconfig
+mkdir -p /opt/data/fido-asm/
+chown -R service_fw:service_fw /opt/data/fido-asm/
+chsmack -a '_' /opt/data/fido-asm/
+
+if [ ! -f %{TZ_SYS_DB}/.fido_asm.db ]
+then
+       sqlite3 %{TZ_SYS_DB}/.fido_asm.db 'PRAGMA journal_mode = PERSIST;
+       CREATE TABLE IF NOT EXISTS ASMKEYS (
+       id INTEGER PRIMARY KEY AUTOINCREMENT,
+       auth_idx INTEGER NOT NULL,
+       caller_id TEXT NOT NULL,
+       app_id TEXT NOT NULL,
+       key_handle TEXT UNIQUE,
+       key_id TEXT NOT NULL UNIQUE,
+       time_stamp TEXT NOT NULL UNIQUE);
+'
+fi
+
+chown service_fw:service_fw %{TZ_SYS_DB}/.fido_asm.db
+chown service_fw:service_fw %{TZ_SYS_DB}/.fido_asm.db-journal
+chsmack -a '_' %{TZ_SYS_DB}/.fido_asm.db
+chsmack -a '_' %{TZ_SYS_DB}/.fido_asm.db-journal
+
+if [ ! -f %{TZ_SYS_DB}/.fido_auth.db ]
+then
+       sqlite3 %{TZ_SYS_DB}/.fido_auth.db 'PRAGMA journal_mode = PERSIST;
+       CREATE TABLE if not exists AUTHLIST (
+       id INTEGER PRIMARY KEY AUTOINCREMENT,
+       auth_index INTEGER NOT NULL,
+       device_id TEXT NOT NULL,
+       aaid TEXT NOT NULL,
+       mapped_index INTEGER UNIQUE);
+'
+fi
+
+chown service_fw:service_fw %{TZ_SYS_DB}/.fido_auth.db
+chown service_fw:service_fw %{TZ_SYS_DB}/.fido_auth.db-journal
+chsmack -a '_' %{TZ_SYS_DB}/.fido_auth.db
+chsmack -a '_' %{TZ_SYS_DB}/.fido_auth.db-journal
+
+
+if [ ! -f %{TZ_SYS_DB}/.fido_secret.db ]
+then
+       sqlite3 %{TZ_SYS_DB}/.fido_secret.db 'PRAGMA journal_mode = PERSIST;
+       CREATE TABLE IF NOT EXISTS SECRET (
+       id INTEGER PRIMARY KEY AUTOINCREMENT,
+       aaid TEXT NOT NULL,
+       device_id TEXT NOT NULL,
+       uid INTEGER NOT NULL,
+       secret_1 TEXT NOT NULL,
+       secret_2 TEXT);
+'
+fi
+
+chown service_fw:service_fw %{TZ_SYS_DB}/.fido_secret.db
+chown service_fw:service_fw %{TZ_SYS_DB}/.fido_secret.db-journal
+chsmack -a '_' %{TZ_SYS_DB}/.fido_secret.db
+chsmack -a '_' %{TZ_SYS_DB}/.fido_secret.db-journal
+
+%postun
+/sbin/ldconfig
+rm -rf /opt/share/fido-asm/
+rm /opt/dbspace/.fido*
+
+
+%files
+%manifest fido-asm.manifest
+%{_bindir}/fido-asm
+%config %{_sysconfdir}/dbus-1/system.d/org.tizen.fido-asm.conf
+%attr(0644,root,root) %{_unitdir}/fido-asm.service
+%attr(0644,root,root) %{_unitdir}/multi-user.target.wants/fido-asm.service
+%attr(0644,root,root) /usr/share/dbus-1/system-services/org.tizen.fido-asm.service
+%{_libdir}/fido/asm/fido_asm.json
+
+%files devel
+##/opt/usr/devel/fido_asm/tc/*
+
+#################################################################################
+# FIDO ASM UI
+#################################################################################
+
+%package -n org.tizen.asmui
+Summary:    FIDO ASM UI
+Group:       Social & Content/API
+
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(capi-appfw-application)
+BuildRequires:  pkgconfig(capi-system-system-settings)
+BuildRequires:  pkgconfig(elementary)
+BuildRequires:  pkgconfig(efl-extension)
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(bundle)
+BuildRequires:  pkgconfig(json-glib-1.0)
+BuildRequires:  pkgconfig(glib-2.0) >= 2.26
+BuildRequires:  pkgconfig(gio-unix-2.0)
+BuildRequires:  pkgconfig(elementary)
+BuildRequires:  pkgconfig(efl-extension)
+BuildRequires:  pkgconfig(openssl)
+
+BuildRequires:  pkgconfig(libtzplatform-config)
+
+%description -n org.tizen.asmui
+FIDO ASM UI provides various UI operations required.
+
+%files -n org.tizen.asmui
+%manifest org.tizen.asmui.manifest
+%defattr(-,root,root,-)
+%{TZ_SYS_RO_APP}/org.tizen.asmui/bin/asmui
+##%{TZ_SYS_RO_APP}/org.tizen.asmui/res/locale/*
+##%{TZ_SYS_RO_APP}/org.tizen.asmui/res/edje/*
+#%{TZ_SYS_RO_APP}/org.tizen.asmui/data
+/usr/share/packages/org.tizen.asmui.xml
+##%{TZ_SYS_RO_APP}/org.tizen.asmui/shared/res/*
+%{TZ_SYS_RW_ICONS}/default/small/org.tizen.asmui.png
+
+
+#################################################################################
+# FIDO Silent Authenticator
+#################################################################################
+
+%package -n fido_silent
+Summary:    FIDO Silent Authenticator
+Group:      Account
+#Requires:   %{name} = %{version}-%{release}
+
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(capi-appfw-application)
+BuildRequires:  pkgconfig(capi-system-system-settings)
+BuildRequires:  pkgconfig(elementary)
+BuildRequires:  pkgconfig(efl-extension)
+BuildRequires:  pkgconfig(pkgmgr-info)
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(bundle)
+BuildRequires:  pkgconfig(json-glib-1.0)
+BuildRequires:  pkgconfig(glib-2.0) >= 2.26
+BuildRequires:  pkgconfig(gio-unix-2.0)
+BuildRequires:  pkgconfig(capi-network-connection)
+
+%description -n fido_silent
+FIDO Silent Authenticator
+
+%post -n fido_silent
+chown service_fw:service_fw /opt/usr/data/silent_auth/fido_tizen_auth.der
+chown service_fw:service_fw /opt/usr/data/silent_auth/fido_tizen_auth.key
+chmod 660 /opt/usr/data/silent_auth/fido_tizen_auth.der
+chmod 660 /opt/usr/data/silent_auth/fido_tizen_auth.key
+chsmack -a '_' /opt/usr/data/silent_auth/fido_tizen_auth.der
+chsmack -a '_' /opt/usr/data/silent_auth/fido_tizen_auth.key
+
+%postun -n fido_silent
+rm -r /opt/usr/data/silent_auth/
+
+%files -n fido_silent
+%{_libdir}/fido/asm/auth/libfido_silent_*.so*
+/opt/usr/data/silent_auth/fido_tizen_auth.der
+/opt/usr/data/silent_auth/fido_tizen_auth.key
+
+#################################################################################
+# FIDO IoT Roaming Agent
+#################################################################################
+%package -n fido_roaming_agent
+Summary:    FIDO Roaming Agent
+Group:      Account
+
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(capi-appfw-application)
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(bundle)
+BuildRequires:  pkgconfig(json-glib-1.0)
+BuildRequires:  pkgconfig(glib-2.0) >= 2.26
+BuildRequires:  pkgconfig(gio-unix-2.0)
+BuildRequires:  pkgconfig(capi-network-connection)
+
+
+%description -n fido_roaming_agent
+FIDO Roaming Agent IoTivity Server
+
+%post -n fido_roaming_agent
+mkdir -p /opt/data/fido-ra/
+chown -R service_fw:service_fw /opt/data/fido-ra/
+chsmack -a '_' /opt/data/fido-ra/
+
+chown -R service_fw:service_fw /opt/data/fido-ra/*.dat
+chsmack -a '_' /opt/data/fido-ra/*.dat
+
+%files -n fido_roaming_agent
+%manifest fido-roaming-agent.manifest
+%{_bindir}/*
+%{_unitdir}/fido-roaming-agent.service
+%{_unitdir}/multi-user.target.wants/fido-roaming-agent.service
+%attr(0777,service_fw,service_fw)/opt/data/fido-ra/*.dat
+
+#################################################################################
+# FIDO BLE Roaming Agent
+#################################################################################
+%package -n fido_ble_roaming_agent
+Summary:    FIDO BLE Roaming Agent
+Group:      Account
+
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(capi-appfw-application)
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(bundle)
+BuildRequires:  pkgconfig(json-glib-1.0)
+BuildRequires:  pkgconfig(glib-2.0) >= 2.26
+BuildRequires:  pkgconfig(gio-unix-2.0)
+BuildRequires:  pkgconfig(capi-network-connection)
+BuildRequires:  pkgconfig(capi-network-bluetooth)
+
+
+%description -n fido_ble_roaming_agent
+FIDO BT Roaming Agent GATT Server
+
+%files -n fido_ble_roaming_agent
+%manifest fido-ble-ragent.manifest
+%{_bindir}/fido-ble-ragent-service
+%{_unitdir}/fido-ble-roaming-agent.service
+%{_unitdir}/multi-user.target.wants/fido-ble-roaming-agent.service
+
+#################################################################################
+# FIDO BT Roaming Agent
+#################################################################################
+%package -n fido_bt_roaming_agent
+Summary:    FIDO BT Roaming Agent
+Group:      Account
+
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(capi-appfw-application)
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(bundle)
+BuildRequires:  pkgconfig(json-glib-1.0)
+BuildRequires:  pkgconfig(glib-2.0) >= 2.26
+BuildRequires:  pkgconfig(gio-unix-2.0)
+BuildRequires:  pkgconfig(capi-network-connection)
+BuildRequires:  pkgconfig(capi-network-bluetooth)
+
+
+%description -n fido_bt_roaming_agent
+FIDO BT Roaming Agent
+
+%files -n fido_bt_roaming_agent
+%manifest fido-bt-ragent.manifest
+%{_bindir}/fido-bt-ragent-service
+%{_unitdir}/fido-bt-roaming-agent.service
+%{_unitdir}/multi-user.target.wants/fido-bt-roaming-agent.service
diff --git a/packaging/fido-ble-roaming-agent.service b/packaging/fido-ble-roaming-agent.service
new file mode 100644 (file)
index 0000000..0e21329
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=FIDO GATT Service for Roaming Authenticator
+
+[Service]
+ExecStart=/usr/bin/fido-ble-ragent-service
+User=system
+Group=system
+
+[Install]
+WantedBy=multi-user.target
diff --git a/packaging/fido-bt-roaming-agent.service b/packaging/fido-bt-roaming-agent.service
new file mode 100644 (file)
index 0000000..da82014
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=FIDO BT Agent Service for Roaming Authenticator
+
+[Service]
+ExecStart=/usr/bin/fido-bt-ragent-service
+User=system
+Group=system
+
+[Install]
+WantedBy=multi-user.target
diff --git a/packaging/fido-roaming-agent.service b/packaging/fido-roaming-agent.service
new file mode 100644 (file)
index 0000000..6f9d31d
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=FIDO Agent Service for Roaming Authenticator
+
+[Service]
+ExecStart=/usr/bin/fido-roaming-agent-service
+User=system
+Group=system
+
+[Install]
+WantedBy=multi-user.target
diff --git a/packaging/org.tizen.fido-asm.conf b/packaging/org.tizen.fido-asm.conf
new file mode 100644 (file)
index 0000000..5a5fb04
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+       <policy user="root">
+               <allow own="org.tizen.fidoasm"/>
+               <allow send_destination="org.tizen.fidoasm"/>
+               <allow send_interface="org.tizen.fidoasm"/>
+               <allow receive_sender="org.tizen.fidoasm"/>
+       </policy>
+       <policy smack="User">
+               <allow own="org.tizen.fidoasm"/>
+               <allow send_destination="org.tizen.fidoasm"/>
+               <allow send_interface="org.tizen.fidoasm"/>
+               <allow receive_sender="org.tizen.fidoasm"/>
+       </policy>
+       <policy smack="System">
+               <allow own="org.tizen.fidoasm"/>
+               <allow send_destination="org.tizen.fidoasm"/>
+               <allow send_interface="org.tizen.fidoasm"/>
+               <allow receive_sender="org.tizen.fidoasm"/>
+       </policy>
+       <policy at_console="true">
+               <allow send_destination="org.tizen.fidoasm"/>
+               <allow receive_sender="org.tizen.fidoasm"/>
+       </policy>
+       <policy context="default">
+               <deny own="org.tizen.fidoasm"/>
+               <allow send_destination="org.tizen.fidoasm"/>
+               <allow receive_sender="org.tizen.fidoasm"/>
+       </policy>
+</busconfig>
diff --git a/packaging/org.tizen.fido-asm.service b/packaging/org.tizen.fido-asm.service
new file mode 100644 (file)
index 0000000..3b72f51
--- /dev/null
@@ -0,0 +1,8 @@
+[Unit]
+Description=FIDO ASM Service D-BUS
+
+[D-BUS Service]
+Name=org.tizen.fidoasm
+Exec=/usr/bin/fido-asm
+User=service_fw
+Group=service_fw
diff --git a/roaming_agent/CMakeLists.txt b/roaming_agent/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3039ec9
--- /dev/null
@@ -0,0 +1,47 @@
+SET(RAGENT_DAEMON fido-roaming-agent-service)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(RAGENT_DAEMON_PKGS REQUIRED
+               dlog
+               db-util
+               glib-2.0
+               capi-base-common
+               pkgmgr-info
+               gio-2.0
+               gio-unix-2.0
+               gmodule-2.0
+               cynara-client
+               cynara-session
+               cynara-creds-gdbus
+               capi-network-connection
+               capi-base-common
+               capi-appfw-application
+               capi-appfw-app-manager
+               aul
+               json-glib-1.0
+               iotcon
+               capi-system-info
+               capi-system-system-settings
+)
+
+FOREACH(flag ${RAGENT_DAEMON_PKGS_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}")
+SET(PKGS_LDFLAGS "${RAGENT_DAEMON_PKGS_LDFLAGS} -pie")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/roaming_agent/inc/)
+
+FILE( GLOB RAGENT_DAEMON_SRCS_CC
+       src/*.c
+)
+
+ADD_EXECUTABLE(${RAGENT_DAEMON} ${RAGENT_DAEMON_SRCS_CC})
+
+TARGET_LINK_LIBRARIES(${RAGENT_DAEMON} ${RAGENT_DAEMON_PKGS_LDFLAGS} fido-asm-dbus "-ldl")
+
+INSTALL(TARGETS ${RAGENT_DAEMON} DESTINATION bin)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/common/fido-ra-acl-server.dat DESTINATION /opt/data/fido-ra)
diff --git a/roaming_agent/inc/RoamingKeys.h b/roaming_agent/inc/RoamingKeys.h
new file mode 100644 (file)
index 0000000..3b23bf9
--- /dev/null
@@ -0,0 +1,16 @@
+#include <tzplatform_config.h>
+
+#ifndef ROAMINGKEYS_H
+#define ROAMINGKEYS_H
+
+#define RA_RESOURCE_URI "/fido/auth/roaming/pin"
+#define RA_RESOURCE_TYPE "org.tizen.fidoauthroamingpin"
+
+#define RA_QUERY_KEY_REQUEST "ra_query_prcoess_tlv"
+#define RA_QUERY_KEY_SERVER_ID "ra_query_server_id"
+#define RA_QUERY_KEY_RESPONSE "ra_response"
+
+#define RA_ACL_SERVER tzplatform_mkpath(TZ_SYS_DATA, "fido-ra/fido-ra-acl-server.dat")
+#define RA_ACL_CLIENT tzplatform_mkpath(TZ_SYS_DATA, "fido-asm/fido-ra-acl-client.dat")
+
+#endif // ROAMINGKEYS_H
diff --git a/roaming_agent/src/iotcon_handler.c b/roaming_agent/src/iotcon_handler.c
new file mode 100644 (file)
index 0000000..3dc8bad
--- /dev/null
@@ -0,0 +1,504 @@
+/*
+ * iotcon_handler.c
+ *
+ *  Created on: May 16, 2016
+ *      Author: manasij.r
+ */
+
+#include <stdlib.h>
+#include <glib.h>
+#include <tizen.h>
+#include <stdio.h>
+
+#include <iotcon.h>
+#include <dlog.h>
+
+#include "iotcon_handler.h"
+#include "RoamingKeys.h"
+#include "AsmHelper.h"
+#include "fido-client-ipc-stub.h"
+
+#include <system_info.h>
+#include <system_settings.h>
+#include <net_connection.h>
+
+#define IC_FEATURE_OIC "http://tizen.org/feature/iot.oic"
+#define IC_FEATURE_OCF "http://tizen.org/feature/iot.ocf"
+
+#include <glib.h>
+
+//#define ASM_GET_INFO_RESP "{\"responseData\":{\"Authenticators\":[{\"aaid\":\"R001#8001\",\"asmVersions\":[{\"major\":1,\"minor\":0}],\"assertionScheme\":\"UAFV1TLV\",\"title\":\"UAF PIN Roaming\",\"attestationTypes\":[15879],\"tcDisplayContentType\":\"text/plain\",\"description\":\"Tizen Roaming PIN Authenticator\",\"supportedExtensionIDs\":[\"abc\"],\"icon\":\"data:image/png;base64,iVBORw0KGgoAAA\",\"isRoamingAuthenticator\":true,\"isSecondFactorOnly\":false,\"isUserEnrolled\":true,\"keyProtection\":1,\"matcherProtection\":1,\"hasSettings\":true,\"tcDisplay\":1,\"authenticatorIndex\":9,\"authenticationAlgorithm\":1,\"attachmentHint\":2,\"userVerification\":4}]},\"statusCode\":0}"
+
+/* ra Resource */
+typedef struct _ra_resource_s {
+       bool state;
+       char *uri_path;
+       char *type;
+       iotcon_resource_interfaces_h ifaces;
+       int properties;
+       iotcon_resource_h handle;
+       iotcon_observers_h observers;
+       iotcon_representation_h repr;
+} ra_resource_s;
+
+static void _request_handler(iotcon_resource_h resource, iotcon_request_h request,
+               void *user_data);
+
+static Fidoasm*
+__asm_get_dbus_proxy(void)
+{
+#if !GLIB_CHECK_VERSION(2, 35, 0)
+       g_type_init();
+#endif
+
+       GDBusConnection *connection = NULL;
+       GError *error = NULL;
+
+       connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+
+       /* Create the object */
+       Fidoasm *dbus_proxy = fidoasm_proxy_new_sync(connection,
+                                               G_DBUS_PROXY_FLAGS_NONE,
+                                                                                                "org.tizen.fidoasm",
+                                                                                                "/org/tizen/fidoasm",
+                                               NULL,
+                                               &error);
+
+       if (error != NULL)
+               _ERR("fidoasm_proxy_new_sync failed %s", error->message);
+
+       return dbus_proxy;
+}
+
+static int
+_set_ra_resource(ra_resource_s *ra)
+{
+       _INFO("_set_ra_resource");
+
+       int ret;
+
+       ra->state = false;
+
+       ra->uri_path = strdup(RA_RESOURCE_URI);
+       if (NULL == ra->uri_path) {
+               return -1;
+       }
+
+       ra->type = strdup(RA_RESOURCE_TYPE);
+       if (NULL == ra->type) {
+               free(ra->uri_path);
+               return -1;
+       }
+
+       ret = iotcon_resource_interfaces_create(&ra->ifaces);
+       if (IOTCON_ERROR_NONE != ret) {
+               free(ra->type);
+               free(ra->uri_path);
+               return -1;
+       }
+
+       ret = iotcon_resource_interfaces_add(ra->ifaces, IOTCON_INTERFACE_DEFAULT);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_resource_interfaces_destroy(ra->ifaces);
+               free(ra->type);
+               free(ra->uri_path);
+               return -1;
+       }
+
+       ra->properties = IOTCON_RESOURCE_DISCOVERABLE;
+
+//     ret = iotcon_observers_create(&ra->observers);
+//     if (IOTCON_ERROR_NONE != ret) {
+//             iotcon_resource_interfaces_destroy(ra->ifaces);
+//             free(ra->type);
+//             free(ra->uri_path);
+//             return -1;
+//     }
+
+       _INFO("_set_ra_resource end");
+
+       return 0;
+}
+
+static void _free_ra_resource(ra_resource_s *ra)
+{
+       iotcon_observers_destroy(ra->observers);
+       iotcon_resource_interfaces_destroy(ra->ifaces);
+       free(ra->type);
+       free(ra->uri_path);
+}
+
+static iotcon_resource_h
+_create_ra_resource(char *uri_path, char *type,
+               iotcon_resource_interfaces_h ifaces, int properties, void *user_data)
+{
+       _INFO("_create_ra_resource start");
+
+       int ret;
+       iotcon_resource_h handle;
+       iotcon_resource_types_h resource_types;
+
+       ret = iotcon_resource_types_create(&resource_types);
+       if (IOTCON_ERROR_NONE != ret) {
+               return NULL;
+       }
+
+       ret = iotcon_resource_types_add(resource_types, type);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_resource_types_destroy(resource_types);
+               return NULL;
+       }
+
+       /* register ra resource */
+       ret = iotcon_resource_create(uri_path, resource_types, ifaces, properties,
+                       _request_handler, user_data, &handle);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_resource_types_destroy(resource_types);
+               return NULL;
+       }
+
+       iotcon_resource_types_destroy(resource_types);
+
+       _INFO("_create_ra_resource end");
+
+       return handle;
+}
+
+static int
+_send_response(iotcon_request_h request, iotcon_representation_h repr,
+               iotcon_response_result_e result)
+{
+       _INFO("_send_response start");
+
+       int ret;
+       iotcon_response_h response;
+
+       ret = iotcon_response_create(request, &response);
+       if (IOTCON_ERROR_NONE != ret) {
+               return -1;
+       }
+
+       ret = iotcon_response_set_result(response, result);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_response_destroy(response);
+               return -1;
+       }
+
+       ret = iotcon_response_set_representation(response, repr);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_response_destroy(response);
+               return -1;
+       }
+
+       /* send Representation to the client */
+       ret = iotcon_response_send(response);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_response_destroy(response);
+               return -1;
+       }
+
+       iotcon_response_destroy(response);
+
+       _INFO("_send_response end");
+
+       return 0;
+}
+
+static iotcon_representation_h
+_create_ra_representation(ra_resource_s *ra, char *tlvRespB64)
+{
+       _INFO("_get_ra_representation start");
+
+       int ret;
+       iotcon_attributes_h state = NULL;
+       iotcon_representation_h repr = NULL;
+
+       /* create a ra Representation */
+       ret = iotcon_representation_create(&repr);
+       if (IOTCON_ERROR_NONE != ret) {
+               return NULL;
+       }
+
+       _INFO("After iotcon_representation_create");
+
+       /* create a ra state */
+       ret = iotcon_attributes_create(&state);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_representation_destroy(repr);
+               return NULL;
+       }
+
+       _INFO("After iotcon_attributes_create");
+
+       ret = iotcon_representation_set_uri_path(repr, RA_RESOURCE_URI/*ra->uri_path*/);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_attributes_destroy(state);
+               iotcon_representation_destroy(repr);
+               return NULL;
+       }
+
+       _INFO("After iotcon_representation_set_uri_path");
+
+       /*TODO:Call Mobile ASM with the incoming query (Base64 decoded TLV)*/
+       //char tlv_b64_dec[5000] = {0,};
+       //snprintf(tlv_b64_dec, 4999, "%s", ASM_GET_INFO_RESP);
+       iotcon_attributes_add_str(state, RA_QUERY_KEY_RESPONSE, tlvRespB64);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_attributes_destroy(state);
+               iotcon_representation_destroy(repr);
+               return NULL;
+       }
+
+       _INFO("After iotcon_attributes_add_str");
+       ret = iotcon_representation_set_attributes(repr, state);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_attributes_destroy(state);
+               iotcon_representation_destroy(repr);
+               return NULL;
+       }
+
+       //iotcon_attributes_destroy(state);
+
+       _INFO("After end [%p]", repr);
+       return repr;
+}
+
+char*
+__getServerId(void)
+{
+       connection_h conn = NULL;
+       connection_create(&conn);
+
+       static char *mac = NULL;
+       if (mac != NULL)
+               return mac;
+
+       /*Try: Ethernet*/
+       int ret = connection_get_mac_address(conn, CONNECTION_TYPE_ETHERNET, &mac);
+
+       /*Try: Wifi*/
+       if (ret != CONNECTION_ERROR_NONE)
+               ret = connection_get_mac_address(conn, CONNECTION_TYPE_WIFI, &mac);
+
+       /*Try: BT*/
+       if (ret != CONNECTION_ERROR_NONE)
+               ret = connection_get_mac_address(conn, CONNECTION_TYPE_BT, &mac);
+
+       return mac;
+}
+
+static int
+_request_handler_put(ra_resource_s *ra, iotcon_request_h request)
+{
+       _INFO("_request_handler_put start");
+
+       int ret = 0;
+
+       iotcon_representation_h repr = NULL;
+       iotcon_request_get_representation(request, &repr);
+       if (repr == NULL) {
+               _ERR("iotcon_request_get_representation failed");
+               return -1;
+       }
+
+       iotcon_attributes_h attr = NULL;
+       iotcon_representation_get_attributes(repr, &attr);
+       if (attr == NULL) {
+               _ERR("iotcon_representation_get_attributes failed");
+               return -1;
+       }
+
+       char *tlvReqB64 = NULL;
+       iotcon_attributes_get_str(attr, RA_QUERY_KEY_REQUEST, &tlvReqB64);
+       if (tlvReqB64 == NULL) {
+               _ERR("[%s] key missing", RA_QUERY_KEY_REQUEST);
+               _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
+
+               return -1;
+       }
+
+       char *serverId = NULL;
+       iotcon_attributes_get_str(attr, RA_QUERY_KEY_SERVER_ID, &serverId);
+       if (serverId == NULL) {
+               _ERR("[%s] key missing", RA_QUERY_KEY_SERVER_ID);
+               _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
+
+               return -1;
+       }
+
+       if (strcmp(serverId, __getServerId()) == 0) {
+               _ERR("Request from same Device is ignored");
+               _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
+
+               return -1;
+       }
+
+
+       /*Call ASM dbus and receive the response*/
+       Fidoasm *asm_proxy = __asm_get_dbus_proxy();
+       if (asm_proxy == NULL) {
+               _ERR("Failed to get ASM proxy");
+               _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
+               return -1;
+       }
+
+
+       char *tlvRespB64 = NULL;
+       GError *gErr = NULL;
+       int tz_err = 0;
+       fidoasm_call_asm_request_sync(asm_proxy, tlvReqB64,
+                                                                 &tz_err, &tlvRespB64, NULL, &gErr);
+       if (gErr != NULL) {
+
+               _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
+               _ERR("Failed returned from ASM");
+               return -1;
+       }
+
+       iotcon_representation_h resp_repr;
+
+       resp_repr = _create_ra_representation(ra, tlvRespB64);
+       if (NULL == resp_repr) {
+               _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
+               _ERR("RA representation create failed");
+               return -1;
+       }
+
+       ret = _send_response(request, resp_repr, IOTCON_RESPONSE_OK);
+       if (0 != ret) {
+               iotcon_representation_destroy(resp_repr);
+               return -1;
+       }
+
+       iotcon_representation_destroy(resp_repr);
+
+       return 0;
+}
+
+//static bool
+//_query_cb(const char *key, const char *value, void *user_data)
+//{
+//     return IOTCON_FUNC_CONTINUE;
+//}
+
+static void
+_request_handler(iotcon_resource_h resource, iotcon_request_h request,
+               void *user_data)
+{
+       _INFO("_request_handler start");
+
+       /*TODO: Only allow if request is not coming from the same device*/
+
+       ra_resource_s *ra;
+       iotcon_query_h query;
+       //int ret, observe_id;
+       iotcon_request_type_e type;
+       //iotcon_observe_type_e observe_type;
+       //char *host_address;
+
+       if (request == NULL)
+               return;
+
+       int ret = iotcon_request_get_query(request, &query);
+       if (IOTCON_ERROR_NONE != ret) {
+               _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
+               return;
+       }
+//     if (query)
+//             iotcon_query_foreach(query, _query_cb, NULL);
+
+       ret = iotcon_request_get_request_type(request, &type);
+       if (IOTCON_ERROR_NONE != ret) {
+               _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
+               return;
+       }
+
+
+       ra = user_data;
+
+
+       if (IOTCON_REQUEST_PUT == type) {
+               ret = _request_handler_put(ra, request);
+       }
+       else {
+               _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
+       }
+
+}
+
+static bool
+__iotcon_handler_is_supported(void)
+{
+       bool raSupported = false;
+       system_info_get_platform_bool(IC_FEATURE_OIC, &raSupported);
+       if (raSupported == false)
+               system_info_get_platform_bool(IC_FEATURE_OCF, &raSupported);
+
+       return raSupported;
+}
+
+int
+iotcon_handler_init(void)
+{
+       _INFO("iotcon_handler_init");
+       if (__iotcon_handler_is_supported() == false) {
+               _ERR("RA not supported");
+               return -1;
+       }
+
+       int ret;
+       ra_resource_s ra = {0};
+
+
+       /* initialize iotcon */
+       ret = iotcon_initialize(RA_ACL_SERVER);
+       if (IOTCON_ERROR_NONE != ret) {
+               return -1;
+       }
+
+       /* set local ra resource */
+       ret = _set_ra_resource(&ra);
+       if (0 != ret) {
+               iotcon_deinitialize();
+               return -1;
+       }
+
+       /* add resource options */
+       ret = iotcon_resource_interfaces_add(ra.ifaces, IOTCON_INTERFACE_BATCH);
+       if (IOTCON_ERROR_NONE != ret) {
+               _free_ra_resource(&ra);
+               iotcon_deinitialize();
+
+               return -1;
+       }
+       //ra.properties |= IOTCON_RESOURCE_OBSERVABLE;
+
+       /* add presence */
+       //g_timeout_add_seconds(10, _presence_timer, NULL);
+       //iotcon_start_presence(10);
+
+       /* create new ra resource */
+       ra.handle = _create_ra_resource(ra.uri_path, ra.type, ra.ifaces,
+                       ra.properties, &ra);
+       if (NULL == ra.handle) {
+
+               _free_ra_resource(&ra);
+               iotcon_deinitialize();
+               return -1;
+       }
+
+       //_check_ra_state(my_ra);
+
+
+       //iotcon_resource_destroy(ra.handle);
+
+       //_free_ra_resource(&ra);
+
+       /* deinitialize iotcon */
+       //iotcon_deinitialize();
+
+       return 0;
+}
+
+
+
diff --git a/roaming_agent/src/iotcon_handler.h b/roaming_agent/src/iotcon_handler.h
new file mode 100644 (file)
index 0000000..6513123
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * iotcon_handler.h
+ *
+ *  Created on: May 16, 2016
+ *      Author: manasij.r
+ */
+
+#ifndef IOTCON_HANDLER_H_
+#define IOTCON_HANDLER_H_
+
+
+int iotcon_handler_init(void);
+
+
+#endif /* IOTCON_HANDLER_H_ */
diff --git a/roaming_agent/src/ragent_main.c b/roaming_agent/src/ragent_main.c
new file mode 100644 (file)
index 0000000..512f4d9
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2014 - 2015 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 <tizen.h>
+#include <glib.h>
+
+#include "iotcon_handler.h"
+#include "AsmHelper.h"
+
+int
+main(int argc, char *argv[])
+{
+       _INFO("Starting Roaming Agent Service");
+
+       int ret = iotcon_handler_init();
+       if (ret != 0) {
+               _ERR("iotcon init failed [%d]", ret);
+
+               return 0;
+       }
+
+       GMainLoop *mainloop = g_main_loop_new(NULL, FALSE);
+
+       g_main_loop_run(mainloop);
+
+       _INFO("Stopping Roaming Agent Service");
+
+       return 0;
+}
diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3ad6f4a
--- /dev/null
@@ -0,0 +1,75 @@
+SET(DAEMON fido-asm)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(SERVICE_PKGS REQUIRED
+               dlog
+               db-util
+               glib-2.0
+               capi-base-common
+               pkgmgr-info
+               gio-2.0
+               gio-unix-2.0
+               gmodule-2.0
+               vconf
+               cynara-client
+               cynara-session
+               cynara-creds-gdbus
+               capi-network-connection
+               sqlite3
+               capi-base-common
+               capi-appfw-application
+               capi-appfw-app-manager
+               openssl
+               aul
+               json-glib-1.0
+               iotcon
+               openssl
+               capi-system-info
+               capi-system-system-settings
+               vconf
+               capi-network-bluetooth
+               capi-network-wifi-direct
+               db-util
+)
+
+FOREACH(flag ${SERVICE_PKGS_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}")
+SET(PKGS_LDFLAGS "${SERVICE_PKGS_LDFLAGS} -pie")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/server/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/server/states/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/server/ops/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/server/auth_discovery/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/datatypes/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/datatypes/auth/)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/jsonutil/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/uafv1tlvutil/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/cryptoutil/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/datatypes/auth/)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/uiutil/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/roaming_agent/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/bt_roaming_agent/inc)
+
+FILE( GLOB SERVICE_SRCS_CC
+       src/*.cpp
+       auth_discovery/src/*.cpp
+       ops/src/*.cpp
+       states/src/*.cpp
+       ../common/datatypes/src/*.cpp
+       ../common/jsonutil/src/*.cpp
+       ../common/uafv1tlvutil/src/*.cpp
+       ../common/cryptoutil/src/*.cpp
+       ../common/uiutil/src/*.cpp
+)
+
+ADD_EXECUTABLE(${DAEMON} ${SERVICE_SRCS_CC})
+
+TARGET_LINK_LIBRARIES(${DAEMON} ${SERVICE_PKGS_LDFLAGS} fido-asm-dbus "-ldl" "-lpthread" "-lgthread-2.0")
+
+INSTALL(TARGETS ${DAEMON} DESTINATION bin)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/server/fido_asm.json DESTINATION ${LIBDIR}/fido/asm/)
diff --git a/server/auth_discovery/inc/AuthIndexHanlder.h b/server/auth_discovery/inc/AuthIndexHanlder.h
new file mode 100644 (file)
index 0000000..f106bf4
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef AUTHINDEXHANLDER_H
+#define AUTHINDEXHANLDER_H
+
+#include <tizen.h>
+#include <string>
+
+class AuthIndexHandler {
+
+public:
+       static AuthIndexHandler *getInstance(void);
+
+       /*Maps the Auth Index reported by the Authenticator to the index used in ASM*/
+       int getMappedIndex(const std::string& devId, const std::string& aaid, int authIndex);
+
+       /*Maps the index used in ASM to the actual Authenticator Index*/
+       int getAuthIndex(int mappedIndex);
+
+private:
+       AuthIndexHandler(void);
+       ~AuthIndexHandler(void);
+
+private:
+       static AuthIndexHandler *__this;
+};
+
+#endif // AUTHINDEXHANLDER_H
diff --git a/server/auth_discovery/inc/AuthManager.h b/server/auth_discovery/inc/AuthManager.h
new file mode 100644 (file)
index 0000000..bf8f59b
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef AuthManager_H
+#define AuthManager_H
+
+#include <tizen.h>
+#include <vector>
+#include <map>
+
+#include "IADProvider.h"
+
+
+class GetInfoResp;
+
+class AuthManager {
+public:
+       static AuthManager* getInstance(void);
+
+       std::vector<IAuthStub*>* getAuthStubList(auth_type_e type);
+       IAuthStub* getAuthStub(int mappedIndex);
+       int setAuthStubCache(auth_type_e type, std::map<int, IAuthStub*> *stubCache);
+
+private:
+       int initProviders(void);
+       void appendToFullStubList(std::vector<IAuthStub*> *origList, std::vector<IAuthStub*> *stubList);
+
+private:
+       static AuthManager *__this;
+       std::vector<IADProvider*> __providerList;
+       std::map<int, IAuthStub*> *__cache;
+};
+
+#endif // AuthManager_H
diff --git a/server/auth_discovery/inc/BAuthStub.h b/server/auth_discovery/inc/BAuthStub.h
new file mode 100644 (file)
index 0000000..7ca3822
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014 - 2015 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 _BAUTH_STUB_H_
+#define _BAUTH_STUB_H_
+
+#include "IAuthStub.h"
+
+class BAuthStub : public IAuthStub {
+
+       friend class BoundADProvider;
+
+public:
+       int initLocal(auth_plugin_handle_s *pluginH);
+       int initRemote(IAuthConnection *conH);
+
+       auth_type_e getType(void);
+
+       GetAuthInfoResp *getInfo(void);
+
+       int connect(void);
+       int disConnect(void);
+
+       /*
+        * Roaming Auth: No need to call enroll,verify
+        * Bound Auth: Silent Authenticator, no need to call enroll, verify
+       */
+       bool isUserVerificationNeeded(void);
+       bool hasAuthUi(void);
+       int enroll(const char *opt);
+       bool isEnrolled(void);
+       int verify(const char *opt, const char *fch,  char **vToken);
+
+       RegisterResp* processRegister(const RegisterReq *regReq);
+       AuthenticateResp* processAuthenticate(const AuthenticateReq *authnReq);
+       DeregResp* processDeregister(const DeregReq *deregReq);
+
+       int openSettings(void);
+
+       Buffer* hash(const std::string& message);
+
+       Buffer* encodeRegisterRespone(RegAssertion *regAssrt, char **assrt_scheme);
+       Buffer* encodeSignRespone(AuthAssertion *authAssertion, char **assrt_scheme);
+       virtual void shutDown(void)
+       {
+
+       }
+
+private:
+       BAuthStub(void);
+       ~BAuthStub(void);
+
+private:
+       auth_plugin_handle_s *__pluginHandle;
+       GetAuthInfoResp *__cachedData;
+};
+
+#endif /* _BAUTH_STUB_H_ */
diff --git a/server/auth_discovery/inc/BleAdProvider.h b/server/auth_discovery/inc/BleAdProvider.h
new file mode 100644 (file)
index 0000000..c59a96b
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef _BLE_AD_PROVIDER_H
+#define _BLE_AD_PROVIDER_H
+
+#include <glib.h>
+
+#include "IADProvider.h"
+#include <bluetooth.h>
+
+class BleAdProvider : public IADProvider {
+       friend class AuthManager;
+public:
+       virtual int init(void);
+       virtual auth_type_e getType(void);
+       virtual std::vector<IAuthStub*> *getAuthStubList(void);
+       virtual void setCache(std::map<int, IAuthStub*> *stubCache);
+       virtual IAuthStub* getStubFromCache(int mappedIdx);
+
+       virtual ~BleAdProvider(void);
+
+private:
+       BleAdProvider(void);
+
+       static void onGattConchanged(int result, bool connected,
+                                                                const char *remote_address, void *user_data);
+       static void onBtStateChanged(int result, bt_adapter_state_e adapter_state,
+                                                                void *user_data);
+       static void onLEScanResult(int result, bt_adapter_le_device_scan_result_info_s *info,
+                                                                 void *user_data);
+       static void finishDiscovery(gpointer data);
+       static gboolean discoverTimeOutCb(gpointer user_data);
+
+private:
+       std::map<int, IAuthStub*> *__stubCache;
+
+       GMainLoop *__waitLoop;
+       bool __isValidInst;
+};
+
+#endif // _BLE_AD_PROVIDER_H
diff --git a/server/auth_discovery/inc/BleCon.h b/server/auth_discovery/inc/BleCon.h
new file mode 100644 (file)
index 0000000..221deb2
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef _BLE_CON_H
+#define _BLE_CON_H
+
+#include "IAuthConnection.h"
+#include <bluetooth.h>
+#include <glib.h>
+
+class GattClient {
+public:
+       GattClient(void)
+       {
+               __btClientInfo = NULL;
+               __btClient = NULL;
+               __btClientSvc = NULL;
+               __btClientChrReq = NULL;
+               __btClientChrResp = NULL;
+       }
+
+public:
+       /*bt_adapter_le_device_scan_result_info_s *__btClientInfo;*/
+       char *__btClientInfo;
+       bt_gatt_client_h __btClient;
+       bt_gatt_h __btClientSvc;
+       bt_gatt_h __btClientChrReq;
+       bt_gatt_h __btClientChrResp;
+};
+
+class BleCon : public IAuthConnection {
+public:
+       BleCon(void);
+       ~BleCon(void);
+
+       virtual int init(void *handle);
+       virtual StringMap* sendReqSync(StringMap *reqData);
+       virtual int shutdown(void);
+       virtual char* getInfo(void);
+private:
+       static void     onGattServerResponse(bt_gatt_h characteristic, char *value,
+                                                int len, void *user_data);
+       static void onGattWriteComplete(int result, bt_gatt_h request_handle,
+                                                                       void *user_data);
+private:
+       GattClient *__gClient;
+       GMainLoop *__waitLoop;
+       StringMap *__resp;
+};
+
+#endif // _BLE_CON_H
diff --git a/server/auth_discovery/inc/BoundADProvider.h b/server/auth_discovery/inc/BoundADProvider.h
new file mode 100644 (file)
index 0000000..c43e616
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014 - 2015 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 _BADP_H_
+#define _BADP_H_
+
+#include "IADProvider.h"
+#include <map>
+#include "AuthnrTypes.h"
+#include <glib.h>
+#include <gmodule.h>
+
+class BoundADProvider : public IADProvider {
+
+       friend class AuthManager;
+public:
+       virtual int init(void);
+       virtual auth_type_e getType(void);
+       virtual std::vector<IAuthStub*> *getAuthStubList(void);
+       virtual void setCache(std::map<int, IAuthStub*> *stubCache);
+       virtual IAuthStub* getStubFromCache(int mappedIdx);
+
+       virtual ~BoundADProvider(void);
+
+private:
+       BoundADProvider(void);
+
+       int loadPlugins(const std::string& dirName);
+       int initPluginList(void);
+       plugin_conn_handle_s* createConnectionHandle(void *mod);
+       plugin_assrt_handle_s* createAssertionHandle(void *mod);
+       plugin_process_handle_s* createProcessHandle(void *mod);
+       plugin_user_op_handle_s* createUserOpHandle(void *mod);
+       plugin_hash_handle_s* createHashHandle(void *mod);
+       plugin_ui_op_handle_s* createUiOpHandle(void *mod);
+
+private:
+       std::map<int, IAuthStub*> *__stubCache;
+       typedef std::map<int, IAuthStub*>::iterator AuthnrMapIter;
+
+};
+
+#endif /* _BADP_H_ */
diff --git a/server/auth_discovery/inc/BtAdProvider.h b/server/auth_discovery/inc/BtAdProvider.h
new file mode 100644 (file)
index 0000000..6925333
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef BTADPROVIDER_H
+#define BTADPROVIDER_H
+
+#include <glib.h>
+
+#include "IADProvider.h"
+#include <bluetooth.h>
+
+class BtAdProvider : public IADProvider {
+       friend class AuthManager;
+public:
+       virtual int init(void);
+       virtual auth_type_e getType(void);
+       virtual std::vector<IAuthStub*> *getAuthStubList(void);
+       virtual void setCache(std::map<int, IAuthStub*> *stubCache);
+       virtual IAuthStub* getStubFromCache(int mappedIdx);
+
+       virtual ~BtAdProvider(void);
+
+private:
+       BtAdProvider(void);
+       static void onSockChanged(int result, bt_socket_connection_state_e connection_state,
+                                                       bt_socket_connection_s *connection, void *user_data);
+       static bool onBondedList(bt_device_info_s *device_info, void *user_data);
+
+       static void finishDiscovery(gpointer data);
+       static gboolean discoverTimeOutCb(gpointer user_data);
+
+private:
+       std::map<int, IAuthStub*> *__stubCache;
+
+       GMainLoop *__waitLoop;
+       bool __isValidInst;
+       bool __isDiscovering;
+       char *__sAddr;
+       bool __isConCbSet;
+};
+
+#endif // BTADPROVIDER_H
diff --git a/server/auth_discovery/inc/BtCon.h b/server/auth_discovery/inc/BtCon.h
new file mode 100644 (file)
index 0000000..d19c0d4
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef BTCON_H
+#define BTCON_H
+
+#include "IAuthConnection.h"
+#include <bluetooth.h>
+#include <glib.h>
+
+class BtCon;
+
+class BtTimerInfo {
+public:
+       int __timerId;
+       BtCon *__caller;
+};
+
+class BtCon : public IAuthConnection {
+public:
+       BtCon(void);
+       ~BtCon(void);
+
+       virtual int init(void *handle);
+       virtual StringMap* sendReqSync(StringMap *reqData);
+       virtual int shutdown(void);
+       virtual char* getInfo(void);
+
+private:
+       void receiveFinshed(void);
+       static int sendDataInternal(int sock_fd, char *data);
+       static void timerExpired(gpointer data);
+       static gboolean discoverTimeOutCb(gpointer user_data);
+       static void onBtSockDataReceived(bt_socket_received_data_s *data, void *user_data);
+private:
+       bt_socket_connection_s *__sock;
+       GMainLoop *__waitLoop;
+       StringMap *__resp;
+
+       char *__fullData;
+       int __fullDataLen;
+
+       int __expDLen;
+       int __remDLen;
+       int __activeTimerId;
+};
+
+#endif // BTCON_H
diff --git a/server/auth_discovery/inc/IADProvider.h b/server/auth_discovery/inc/IADProvider.h
new file mode 100644 (file)
index 0000000..36b0069
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014 - 2015 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 _IADP_H_
+#define _IADP_H_
+
+#include <vector>
+#include <map>
+#include "AuthnrTypes.h"
+
+class IAuthStub;
+
+class IADProvider {
+public:
+       virtual int init(void) = 0;
+       virtual auth_type_e getType(void) = 0;
+       virtual std::vector<IAuthStub*> *getAuthStubList(void) = 0;
+       virtual void setCache(std::map<int, IAuthStub*> *stubCache) = 0;
+       virtual IAuthStub* getStubFromCache(int mappedIdx) = 0;
+
+       virtual ~IADProvider(){}
+};
+
+#endif /* _IADP_H_ */
diff --git a/server/auth_discovery/inc/IAuthConnection.h b/server/auth_discovery/inc/IAuthConnection.h
new file mode 100644 (file)
index 0000000..773c23c
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef IAUTHCONNECTION_H
+#define IAUTHCONNECTION_H
+
+#include <string>
+#include <map>
+
+typedef std::map<std::string, std::string> StringMap;
+
+class IAuthConnection {
+public:
+       ~IAuthConnection(void){}
+
+       virtual int init(void *handle) = 0;
+       virtual StringMap* sendReqSync(StringMap *reqData) = 0;
+       virtual char *getInfo(void) = 0;
+       virtual int shutdown(void) = 0;
+};
+
+#endif // IAUTHCONNECTION_H
diff --git a/server/auth_discovery/inc/IAuthStub.h b/server/auth_discovery/inc/IAuthStub.h
new file mode 100644 (file)
index 0000000..72c359e
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2014 - 2015 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 _IAUTH_STUB_H_
+#define _IAUTH_STUB_H_
+
+#include <glib.h>
+#include "AuthnrTypes.h"
+
+class IAuthConnection;
+
+class IAuthStub {
+public:
+
+       /*Auth Stub can be created by either one of the two*/
+       virtual int initLocal(auth_plugin_handle_s *pluginH) = 0;
+       virtual int initRemote(IAuthConnection *conH) = 0;
+
+       virtual auth_type_e getType(void) = 0;
+
+       virtual GetAuthInfoResp *getInfo(void) = 0;
+
+       /*
+        * Roaming Auth: No need to call enroll,verify
+        * Bound Auth: Silent Authenticator, no need to call enroll, verify
+       */
+       virtual bool isUserVerificationNeeded(void) = 0;
+       virtual bool hasAuthUi(void) = 0;
+       /*Silent Auth does not need Enroll/Verify*/
+       virtual int enroll(const char *opt) = 0;
+       virtual bool isEnrolled(void) = 0;
+       virtual int verify(const char *opt, const char *fch, char **vToken) = 0;
+       virtual RegisterResp* processRegister(const RegisterReq *regReq) = 0;
+       virtual AuthenticateResp* processAuthenticate(const AuthenticateReq *authnReq) = 0;
+       virtual DeregResp* processDeregister(const DeregReq *deregReq) = 0;
+       virtual int openSettings(void) = 0;
+       virtual Buffer* hash(const std::string& message) = 0;
+       virtual Buffer* encodeRegisterRespone(RegAssertion *regAssrt, char **assrt_scheme) = 0;
+       virtual Buffer* encodeSignRespone(AuthAssertion *authAssertion, char **assrt_scheme) = 0;
+       virtual void shutDown(void) = 0;
+
+       virtual ~IAuthStub(void){}
+};
+
+#endif /* _IAUTH_STUB_H_ */
diff --git a/server/auth_discovery/inc/IoTCon.h b/server/auth_discovery/inc/IoTCon.h
new file mode 100644 (file)
index 0000000..f337023
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef IOTCON_H
+#define IOTCON_H
+
+#include "IAuthConnection.h"
+#include <iotcon.h>
+#include <glib.h>
+
+class IoTCon : public IAuthConnection {
+public:
+
+       IoTCon(void);
+       ~IoTCon(void);
+
+       virtual int init(void *handle);
+       virtual StringMap* sendReqSync(StringMap *reqData);
+       virtual int shutdown(void);
+       virtual char* getInfo(void);
+
+private:
+       static void     onResponsePut(iotcon_remote_resource_h resource, iotcon_error_e err,
+                       iotcon_request_type_e request_type, iotcon_response_h response, void *user_data);
+private:
+       GMainLoop *__waitLoop;
+       iotcon_remote_resource_h __iotClient;
+       StringMap* __resp;
+};
+
+#endif // IOTCON_H
diff --git a/server/auth_discovery/inc/IotADProvider.h b/server/auth_discovery/inc/IotADProvider.h
new file mode 100644 (file)
index 0000000..cc1dc28
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014 - 2015 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 _IOT_ADP_H_
+#define _IOT_ADP_H_
+
+#include <vector>
+#include <glib.h>
+#include <iotcon.h>
+#include <map>
+
+#include "IADProvider.h"
+
+class IAuthStub;
+
+class IotADProvider : public IADProvider {
+
+       friend class AuthManager;
+public:
+       virtual int init(void);
+       virtual auth_type_e getType(void);
+       virtual std::vector<IAuthStub*> *getAuthStubList(void);
+       virtual void setCache(std::map<int, IAuthStub*> *stubCache);
+       virtual IAuthStub* getStubFromCache(int mappedIdx);
+
+       virtual ~IotADProvider(void);
+       static void finishDiscovery(gpointer data);
+       static gboolean discoverTimeOutCb(gpointer user_data);
+       static bool resourceFoundCb(iotcon_remote_resource_h resource, iotcon_error_e result,
+                       void *user_data);
+private:
+       IotADProvider(void);
+
+private:
+       /*std::vector<IAuthStub*> *__authList;*/
+       std::map<int, IAuthStub*> *__stubCache;
+
+       GMainLoop *__waitLoop;
+       bool __isValidInst;
+
+};
+
+#endif /* _IOT_ADP_H_ */
diff --git a/server/auth_discovery/inc/LocalCon.h b/server/auth_discovery/inc/LocalCon.h
new file mode 100644 (file)
index 0000000..71a3b82
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef LOCALCON_H
+#define LOCALCON_H
+
+#include "IAuthConnection.h"
+#include "BoundADProvider.h"
+
+class LocalCon : public IAuthConnection {
+       //friend class BoundADProvider;
+public:
+       LocalCon(void) {}
+       ~LocalCon(void) {}
+
+       virtual int init(void *handle) {return -1;}
+       StringMap* sendReqSync(StringMap *reqData) {return NULL;}
+       virtual int shutdown(void) {return 0;}
+       virtual char* getInfo(void) {return NULL;}
+private:
+       auth_plugin_handle_s *__pluginHandle;
+};
+
+#endif // LOCALCON_H
diff --git a/server/auth_discovery/inc/RAuthStub.h b/server/auth_discovery/inc/RAuthStub.h
new file mode 100644 (file)
index 0000000..d0d29db
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2014 - 2015 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 _RAUTH_STUB_H_
+#define _RAUTH_STUB_H_
+
+#include "IAuthStub.h"
+#include "IAuthConnection.h"
+
+class RAuthStub : public  IAuthStub {
+
+       friend class IotADProvider;
+       friend class BleAdProvider;
+       friend class BtAdProvider;
+
+public:
+       int initLocal(auth_plugin_handle_s *pluginH);
+       int initRemote(IAuthConnection *conH);
+
+       auth_type_e getType(void);
+
+       GetAuthInfoResp *getInfo(void);
+
+       /*
+        * Roaming Auth: No need to call enroll,verify
+        * Bound Auth: Silent Authenticator, no need to call enroll, verify
+       */
+       bool isUserVerificationNeeded(void)
+       {
+               return false;
+       }
+
+       bool hasAuthUi(void)
+       {
+               return false;
+       }
+
+       int connect(void)
+       {
+               return -1;
+       }
+
+       int disConnect(void)
+       {
+               return -1;
+       }
+
+       int enroll(const char *opt)
+       {
+               return 0;
+       }
+
+       bool isEnrolled(void)
+       {
+               return false;
+       }
+
+       int verify(const char *opt, const char *fch, char **vToken)
+       {
+               return 0;
+       }
+
+       RegisterResp* processRegister(const RegisterReq *regReq);
+
+       AuthenticateResp* processAuthenticate(const AuthenticateReq *authnReq);
+
+       DeregResp* processDeregister(const DeregReq *deregReq);
+
+       int openSettings(void)
+       {
+               return -1;
+       }
+
+       Buffer* hash(const std::string& message);
+
+       Buffer* encodeRegisterRespone(RegAssertion *regAssrt, char **assrt_scheme);
+
+       Buffer* encodeSignRespone(AuthAssertion *authAssertion, char **assrt_scheme);
+
+       virtual void shutDown(void);
+
+private:
+       RAuthStub(void);
+       ~RAuthStub(void);
+
+       int processTlv(const char *reqTlvB64, char **respTlvB64);
+
+private:
+       GetAuthInfoResp *__cachedData;
+       IAuthConnection *__conH;
+};
+
+#endif /* _RAUTH_STUB_H_ */
diff --git a/server/auth_discovery/inc/RoamingUtil.h b/server/auth_discovery/inc/RoamingUtil.h
new file mode 100644 (file)
index 0000000..a67e891
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef ROAMINGUTIL_H
+#define ROAMINGUTIL_H
+
+#include <tizen.h>
+#include <vector>
+#include "IAuthStub.h"
+
+class AsmRequest;
+
+class RoamingUtil {
+
+public:
+       static AsmRequest *createAuthReq(const char *tlvB64);
+
+       static char *composeAuthGetInfoReq(void);
+
+       static char *composeAuthRegisterReq(const RegisterReq *req);
+       static char *composeAuthSignReq(const AuthenticateReq *req);
+       static char *composeAuthDeregReq(const DeregReq *req);
+
+       static char *composeAuthGetInfoResponce(std::vector<GetAuthInfoResp*> *infoList);
+
+       static char *composeAuthRegisterResponse(RegisterResp *regResp);
+       static char *composeAuthSignResponse(AuthenticateResp *authResp);
+       static char *composeAuthDeregResponse(DeregResp *dResp);
+
+       static int b64Decode(const char *encoded_data, int encoded_size, unsigned char **decoded_data,
+                                        int *decoded_size);
+
+       static char *b64Encode(unsigned char *input, int ip_len);
+
+       static bool isRASupported(void);
+
+       static std::string getBTMACAddr(void);
+       static std::string getDevName(void);
+       static std::string getP2PMACAddr(void);
+
+       static char *getServerId(void);
+private:
+       RoamingUtil(void) {}
+       ~RoamingUtil(void) {}
+
+       static char makeP2PMAC(char c);
+};
+
+#endif // ROAMINGUTIL_H
diff --git a/server/auth_discovery/src/AuthIndexHanlder.cpp b/server/auth_discovery/src/AuthIndexHanlder.cpp
new file mode 100644 (file)
index 0000000..c021068
--- /dev/null
@@ -0,0 +1,137 @@
+
+#include "AuthIndexHanlder.h"
+#include "AsmStorage.h"
+#include "AsmHelper.h"
+
+AuthIndexHandler *AuthIndexHandler::__this = NULL;
+
+AuthIndexHandler*
+AuthIndexHandler::getInstance(void)
+{
+       if (__this != NULL)
+               return __this;
+
+       AuthIndexHandler *tempThis = new AuthIndexHandler();
+
+       __this = tempThis;
+
+       return __this;
+
+}
+
+/*Maps the Auth Index reported by the Authenticator to the index used in ASM*/
+int
+AuthIndexHandler::getMappedIndex(const std::string& devId, const std::string& aaid, int authIndex)
+{
+       /*Indexes are maitained in DB*/
+       /*DeviceId-AAID-AuthIndex-MappedIndex*/
+
+       /*If match found for the given <devId, aaid> tuple, then stored MappedIndex is returned*/
+
+       /*Else a new entry is inserted, MappedIndex is surrogate key, auto-incremented*/
+
+       /*The newly inserted MappedIndex is returned*/
+
+
+       _INFO("Real Index=[%d]", authIndex);
+
+       IStorageParcel *searchParcel = new AuthStorageParcel();
+       searchParcel->setInt(INT_PROP_AUTH_ID, authIndex);
+       searchParcel->setString(STR_PROP_DEV_ID, devId.c_str());
+       searchParcel->setString(STR_PROP_AAID, aaid.c_str());
+
+       std::vector<IStorageParcel*> *searchRes = AsmStorage::getInstance()->searchData(searchParcel);
+       if (searchRes != NULL && searchRes->size() > 0) {
+
+               _INFO("Previously mapped index");
+
+               std::vector<IStorageParcel*>::iterator searchResiter = searchRes->begin();
+               for (; searchResiter != searchRes->end(); ++searchResiter) {
+
+                       IStorageParcel *resParcel = (IStorageParcel*)(*searchResiter);
+
+                       int mappedIndex = authIndex;
+                       resParcel->getInt(INT_PROP_MAPPED_AUTH_ID, &mappedIndex);
+
+                       _INFO("Mapped Index=[%d]", mappedIndex);
+                       return mappedIndex;
+               }
+
+       } else {
+
+               _INFO("New index");
+
+               IStorageParcel *searchParcelInner = new AuthStorageParcel();
+               searchParcelInner->setInt(INT_PROP_AUTH_ID, authIndex);
+               searchParcelInner->setString(STR_PROP_DEV_ID, devId.c_str());
+               searchParcelInner->setString(STR_PROP_AAID, aaid.c_str());
+
+               AsmStorage::getInstance()->insertData(searchParcelInner);
+
+               _INFO("After insertData");
+
+               std::vector<IStorageParcel*> *searchResInner = AsmStorage::getInstance()->searchData(searchParcelInner);
+               if (searchResInner != NULL) {
+
+                       std::vector<IStorageParcel*>::iterator searchResiter = searchResInner->begin();
+                       for (; searchResiter != searchResInner->end(); ++searchResiter) {
+
+                               IStorageParcel *resParcel = (IStorageParcel*)(*searchResiter);
+
+                               int mappedIndex = authIndex;
+                               resParcel->getInt(INT_PROP_MAPPED_AUTH_ID, &mappedIndex);
+
+                               _INFO("Mapped Index=[%d]", mappedIndex);
+                               return mappedIndex;
+                       }
+
+               }
+
+       }
+
+       _INFO("Mapped Index with error=[%d]", authIndex);
+       return authIndex;
+}
+
+/*Maps the index used in ASM to the actual Authenticator Index*/
+int
+AuthIndexHandler::getAuthIndex(int mappedIndex)
+{
+       /*Searched the DB with the given mappedIndex, and return the corresponding AuthIndex*/
+
+       _INFO("Mapped Index=[%d]", mappedIndex);
+
+       IStorageParcel *searchParcel = new AuthStorageParcel();
+       searchParcel->setInt(INT_PROP_MAPPED_AUTH_ID, mappedIndex);
+
+
+       std::vector<IStorageParcel*> *searchRes = AsmStorage::getInstance()->searchData(searchParcel);
+       if (searchRes != NULL) {
+
+               std::vector<IStorageParcel*>::iterator searchResiter = searchRes->begin();
+               for (; searchResiter != searchRes->end(); ++searchResiter) {
+
+                       IStorageParcel *resParcel = (IStorageParcel*)(*searchResiter);
+
+                       int authIndex = mappedIndex;
+                       resParcel->getInt(INT_PROP_AUTH_ID, &authIndex);
+
+                       _INFO("Real Index=[%d]", authIndex);
+                       return authIndex;
+               }
+
+       }
+
+       _INFO("Real Index with error=[%d]", mappedIndex);
+       return mappedIndex;
+}
+
+AuthIndexHandler::AuthIndexHandler(void)
+{
+
+}
+
+AuthIndexHandler::~AuthIndexHandler(void)
+{
+
+}
diff --git a/server/auth_discovery/src/AuthManager.cpp b/server/auth_discovery/src/AuthManager.cpp
new file mode 100644 (file)
index 0000000..5402cfd
--- /dev/null
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AuthManager.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+
+#include <stdlib.h>
+#include "BoundADProvider.h"
+#include "IotADProvider.h"
+#include "RoamingUtil.h"
+#include "BleAdProvider.h"
+#include "BtAdProvider.h"
+
+AuthManager* AuthManager::__this = NULL;
+
+int
+AuthManager::initProviders(void)
+{
+       IADProvider *badPro = new BoundADProvider();
+       /*Bound Auth plugins may be installed later*/
+       badPro->init();
+       _INFO("Bound Provider=[%p]", badPro);
+       __providerList.push_back(badPro);
+
+
+       if (RoamingUtil::isRASupported() == true) {
+               IADProvider *radPro = new IotADProvider();
+               int retRa = radPro->init();
+               if (retRa == 0) {
+                       _INFO("Roaming Provider=[%p]", radPro);
+                       __providerList.push_back(radPro);
+               } else {
+                       _INFO("RA not supported");
+                       delete radPro;
+               }
+       }
+
+       IADProvider *blePro = new BleAdProvider();
+       int retBle = blePro->init();
+       if (retBle == 0) {
+               _INFO("BLE Provider=[%p]", blePro);
+               __providerList.push_back(blePro);
+       } else {
+               _INFO("BLE Provider not supported");
+               delete blePro;
+       }
+
+       IADProvider *btPro = new BtAdProvider();
+       int retBt = btPro->init();
+       if (retBt == 0) {
+               _INFO("BT Provider=[%p]", btPro);
+               __providerList.push_back(btPro);
+       } else {
+               _INFO("BT Provider not supported");
+               delete btPro;
+       }
+
+       return 0;
+}
+
+AuthManager*
+AuthManager::getInstance(void)
+{
+       _INFO("");
+
+       /*TODO: Thread safe singleton*/
+       if (__this != NULL)
+               return __this;
+
+
+       AuthManager *temp = new AuthManager();
+
+       int ret = temp->initProviders();
+
+       if (ret != 0) {
+               delete temp;
+               return NULL;
+       }
+
+       __this = temp;
+       return __this;
+}
+
+void
+AuthManager::appendToFullStubList(std::vector<IAuthStub*> *origList,
+                                                               std::vector<IAuthStub*> *stubList)
+{
+       _BEGIN;
+       RET_IF_FAIL_VOID(stubList != NULL);
+
+       std::vector<IAuthStub*>::iterator stIter = stubList->begin();
+       for (; stIter != stubList->end(); ++stIter) {
+
+               IAuthStub *stub = (IAuthStub*)(*stIter);
+               if (stub != NULL) {
+                       origList->push_back(stub);
+               }
+       }
+       _END;
+}
+
+std::vector<IAuthStub*>*
+AuthManager::getAuthStubList(auth_type_e type)
+{
+       _INFO("getAuthStubList [%d]", type);
+
+       std::vector<IAuthStub*> *stubListFull = new std::vector<IAuthStub*>();
+
+       std::vector<IADProvider*>::iterator adIter = __providerList.begin();
+       for (; adIter != __providerList.end(); ++adIter) {
+
+               IADProvider *pro = (IADProvider*)(*adIter);
+
+               if ((type == AUTH_TYPE_ALL) || (pro->getType() == type)) {
+                       /*Depending on Provider type, stub list is refreshed, Bound: re-use
+                       * Roaming: Refresh
+                       */
+                       std::vector<IAuthStub*> *stubList = pro->getAuthStubList();
+                       if (stubList != NULL) {
+                               appendToFullStubList(stubListFull, stubList);
+                       }
+               }
+       }
+
+       int stubCount = stubListFull->size();
+       _INFO("[%d] Type Stub list count=[%d]", type, stubCount);
+       return stubListFull;
+}
+
+IAuthStub*
+AuthManager::getAuthStub(int mappedIndex)
+{
+       std::vector<IADProvider*>::iterator adIter = __providerList.begin();
+       for (; adIter != __providerList.end(); ++adIter) {
+
+               IADProvider *pro = (IADProvider*)(*adIter);
+               IAuthStub *stub = pro->getStubFromCache(mappedIndex);
+               if (stub != NULL) {
+                       _INFO("Found [%d][%p] in [%d] cache", mappedIndex, stub, pro->getType());
+                       return stub;
+               }
+       }
+
+       _ERR("[%d] not found in any cache", mappedIndex);
+       return NULL;
+}
+
+int
+AuthManager::setAuthStubCache(auth_type_e type, std::map<int, IAuthStub*> *stubCache)
+{
+       _INFO("");
+
+       if (type >= AUTH_TYPE_ALL) {
+               _ERR("Cache can not be set for all");
+               return -1;
+       }
+
+       _INFO("");
+       std::vector<IADProvider*>::iterator adIter = __providerList.begin();
+       for (; adIter != __providerList.end(); ++adIter) {
+
+               IADProvider *pro = (IADProvider*)(*adIter);
+
+               _INFO("");
+               if (pro->getType() == type) {
+                       _INFO("");
+                       pro->setCache(stubCache);
+                       _INFO("Updated cache for [%d]", type);
+                       return 0;
+               }
+       }
+
+       return -1;
+}
diff --git a/server/auth_discovery/src/BAuthStub.cpp b/server/auth_discovery/src/BAuthStub.cpp
new file mode 100644 (file)
index 0000000..acd527d
--- /dev/null
@@ -0,0 +1,522 @@
+#include "BAuthStub.h"
+#include "AsmHelper.h"
+#include "TlvData.h"
+#include "AuthnrTypes.h"
+#include "asmcrypto.h"
+#include "AuthIndexHanlder.h"
+#include <openssl/sha.h>
+#include "PinAuthUiAdaptor.h"
+#include "AuthUiFactory.h"
+#include "AsmStorage.h"
+#include "asmcrypto.h"
+#include "JsonUtil.h"
+
+#define BIG_SIZE 5000
+#define uid 5001
+#define DIGEST_LEN 32
+
+GetAuthInfoResp*
+BAuthStub::getInfo(void)
+{
+       _INFO("getInfo");
+       RET_IF_FAIL(__pluginHandle != NULL, NULL);
+
+       if ((__cachedData == NULL)) {
+               _INFO("__cachedData NULL");
+
+               RET_IF_FAIL(__pluginHandle->process != NULL, NULL);
+               RET_IF_FAIL(__pluginHandle->process->process != NULL, NULL);
+
+               TlvEncodable<GetInfoReq> encodableReq;
+               encodableReq.setEncoder(EID_UAFV1_GETINFO_REQ);
+
+               TlvEncodable<GetAuthInfoResp> encodableResp;
+               encodableResp.setEncoder(EID_UAFV1_GETINFO_RESP);
+
+               Buffer *authReq = encodableReq.encode();
+               unsigned char *authRespRaw = NULL;
+
+               __pluginHandle->process->process(authReq->data, &authRespRaw);
+
+               __cachedData = encodableResp.decode(authRespRaw);
+               /*Map AuthIndex*/
+               /*TODO: Find Device ID logic used by IoTCon*/
+
+               if (__cachedData->authList != NULL) {
+
+                       GList *authListIter = g_list_first(__cachedData->authList);
+                       while (authListIter != NULL) {
+
+                               AuthenticatorInfo *authInfo = (AuthenticatorInfo*)(authListIter->data);
+                               /*TODO: Find Device ID logic used by IoTCon*/
+                               _INFO("Before calling getMappedIndex");
+                               authInfo->__authenticatorIndex = AuthIndexHandler::getInstance()->getMappedIndex(
+                                                       AsmCrypto::getDeviceId(), std::string(authInfo->__aaid),
+                                                       authInfo->__authenticatorIndex);
+
+                               _INFO("After calling getMappedIndex");
+                               authInfo->__devId = strdup(AsmCrypto::getDeviceId().c_str());
+                               authInfo->__isUserEnrolled = isEnrolled();
+                               authInfo->__isRoamingAuthenticator = false;
+                               authListIter = authListIter->next;
+                       }
+
+               }
+
+
+               /*Fill-up additional data*/
+               __cachedData->attach_hint = ATTACHMENT_HINT_INTERNAL;
+               /*__cachedData->attach_hint = __pluginHandle->conn->attach_hint();*/
+               /*__cachedData->title = __pluginHandle->conn->title();*/
+               /*__cachedData->description = __pluginHandle->conn->description();*/
+       }
+
+       _INFO("Returning __cachedData");
+       return __cachedData;
+}
+
+int
+BAuthStub::connect(void)
+{
+       RET_IF_FAIL(__pluginHandle != NULL, -1);
+       RET_IF_FAIL(__pluginHandle->conn != NULL, -1);
+       RET_IF_FAIL(__pluginHandle->conn->init != NULL, -1);
+
+       return __pluginHandle->conn->init();
+}
+
+int
+BAuthStub::disConnect(void)
+{
+       RET_IF_FAIL(__pluginHandle != NULL, -1);
+       RET_IF_FAIL(__pluginHandle->conn != NULL, -1);
+       RET_IF_FAIL(__pluginHandle->conn->de_init != NULL, -1);
+
+       delete __cachedData;
+       __cachedData = NULL;
+
+       return __pluginHandle->conn->de_init();
+}
+
+int
+_parse_enroll_request(char *enrollJson, char **appId, char **aaid)
+{
+       JsonParser *parser  = json_parser_new();
+
+       GError *err = NULL;
+       json_parser_load_from_data(parser, (char*)enrollJson, -1, &err);
+       if (err != NULL)
+       {
+               _ERR("Parsing failed=[%s]", err->message);
+               return -1;
+       }
+
+       JsonNode *rootNode = json_parser_get_root(parser);
+       RET_IF_FAIL(rootNode != NULL, -1);
+
+       JsonObject *rootObj = json_node_get_object(rootNode);
+       RET_IF_FAIL(rootObj != NULL, -1);
+
+       const char *appId_temp = json_object_get_string_member(rootObj, "appId");
+       const char *aaid_temp = json_object_get_string_member(rootObj, "aaid");
+
+       *appId = strdup(appId_temp);
+       *aaid = strdup(aaid_temp);
+
+       if (parser != NULL)
+               g_object_unref(parser);
+
+       return 0;
+}
+
+bool
+BAuthStub::isUserVerificationNeeded(void)
+{
+       if(__pluginHandle->user == NULL || __pluginHandle->user->is_uv_reqd == NULL) {
+               return true;
+       }
+
+       return __pluginHandle->user->is_uv_reqd();
+}
+
+bool
+BAuthStub::hasAuthUi(void)
+{
+       if((__pluginHandle->user == NULL) ||
+                       (__pluginHandle->user->enroll == NULL) ||
+                       (__pluginHandle->user->verify == NULL)) {
+               _INFO("Auth does not have inbuilt UI");
+               return false;
+       }
+
+       return true;
+}
+
+int
+BAuthStub::enroll(const char *opt)
+{
+       _BEGIN;
+       RET_IF_FAIL(__pluginHandle != NULL, -1);
+
+       if(__pluginHandle->user == NULL || __pluginHandle->user->enroll == NULL) {
+
+               _INFO("BAuthStub::enroll::__pluginHandle->user->enroll NULL");
+
+               RET_IF_FAIL(opt != NULL, -1);
+
+               char *appId = NULL;
+               char *aaid = NULL;
+               int res = _parse_enroll_request((char*)opt, &appId, &aaid);
+               RET_IF_FAIL(res == 0, -1);
+
+               _INFO("enroll json parsed successfully");
+
+               /* TODO */
+               IAuthUiAdaptor *uiAd = AuthUiFactory::getAuthUiAdaptor(AUTH_UI_TYPE_PIN);
+
+               _INFO("UIAD = [%p]", uiAd);
+
+               int ret = -1;
+               std::string appIdStr(appId);
+               std::string tok = uiAd->enrollUser(appIdStr, &ret);
+               if(tok.c_str() == NULL) {
+                       _INFO("BAuthStub::enroll::token NULL");
+                       return -1;
+               }
+               _INFO("enrollUser = [%s]", tok.c_str());
+
+               unsigned char digest[DIGEST_LEN];
+               AsmCrypto::genHash256(tok.c_str(), tok.length(), digest);
+               unsigned char *vToken = AsmCrypto::ToBase64Url(digest, DIGEST_LEN);
+               std::string vTokStr((char*)vToken);
+
+               std::string devId = AsmCrypto::getDeviceId();
+               RET_IF_FAIL(devId.empty() == false, -1);
+
+               IStorageParcel *parcel = new SecretStorageParcel();
+               res = parcel->setString(STR_PROP_AAID, aaid);
+               RET_IF_FAIL(res == 0, -1);
+               res = parcel->setString(STR_PROP_DEV_ID, devId);
+               RET_IF_FAIL(res == 0, -1);
+               res = parcel->setString(STR_PROP_SECRET1, vTokStr);
+               RET_IF_FAIL(res == 0, -1);
+               res = parcel->setInt(INT_PROP_UID, uid);
+               RET_IF_FAIL(res == 0, -1);
+
+               res = AsmStorage::getInstance()->insertData(parcel);
+               RET_IF_FAIL(res == 0, -1);
+
+               _INFO("Enroll data inserted success");
+               _INFO("BAuthStub::enroll::end");
+               return 0;
+       }
+
+       _END;
+       return __pluginHandle->user->enroll(opt);
+}
+
+bool
+BAuthStub::isEnrolled(void)
+{
+       RET_IF_FAIL(__pluginHandle != NULL, false);
+       RET_IF_FAIL(__pluginHandle->user != NULL, false);
+       RET_IF_FAIL(__pluginHandle->user->enroll != NULL, false);
+
+       return __pluginHandle->user->is_enrolled(NULL);
+}
+
+int
+BAuthStub::verify(const char *opt, const char *fch, char **vToken)
+{
+       _BEGIN;
+
+       if(__pluginHandle->user == NULL || __pluginHandle->user->verify == NULL) {
+
+               _INFO("BAuthStub::verify::__pluginHandle->user->verify NULL");
+
+               _INFO("VERIFY TOKEN = [%s]", *vToken);
+               RET_IF_FAIL(opt != NULL, -1);
+               RET_IF_FAIL(*vToken != NULL, -1);
+               RET_IF_FAIL(__pluginHandle != NULL, -1);
+
+               IAuthUiAdaptor *uiAd = AuthUiFactory::getAuthUiAdaptor(AUTH_UI_TYPE_PIN);
+               int ret = -1;
+
+               std::string appIdStr(opt);
+               std::string vTokStr(*vToken);
+
+               uiAd->verifyUser(appIdStr, vTokStr, &ret);
+               RET_IF_FAIL(ret == 0, -1);
+
+               _INFO("BAuthStub::verify::end");
+               return 0;
+       }
+
+       _END;
+       return __pluginHandle->user->verify(opt, fch, vToken);
+}
+
+RegisterResp*
+BAuthStub::processRegister(const RegisterReq *regReq)
+{
+       RET_IF_FAIL(__pluginHandle != NULL, NULL);
+       RET_IF_FAIL(__pluginHandle->process != NULL, NULL);
+       RET_IF_FAIL(__pluginHandle->process->process != NULL, NULL);
+
+
+       Buffer *authReq = NULL;
+       unsigned char *authRespRaw = NULL;
+
+       /*Default handlers*/
+       if (__pluginHandle->assrt == NULL) {
+               TlvEncodable<RegisterReq> encodableReq(regReq);
+               encodableReq.setEncoder(EID_UAFV1_REGISTER_REQ);
+
+               TlvEncodable<RegisterResp> encodableResp;
+               encodableResp.setEncoder(EID_UAFV1_REGISTER_RESP);
+
+               authReq = encodableReq.encode();
+
+               __pluginHandle->process->process(authReq->data, &authRespRaw);
+
+               return encodableResp.decode(authRespRaw);
+
+       }
+       else {
+               authReq = __pluginHandle->assrt->encode(TAG_UAFV1_REGISTER_CMD, regReq);
+
+               __pluginHandle->process->process(authReq->data, &authRespRaw);
+
+               RegisterResp *decodedResp = (RegisterResp*)
+                               (__pluginHandle->assrt->decode(authRespRaw));
+
+               RET_IF_FAIL(decodedResp != NULL, NULL);
+
+               return decodedResp;
+       }
+}
+
+AuthenticateResp*
+BAuthStub::processAuthenticate(const AuthenticateReq *authnReq)
+{
+       RET_IF_FAIL(__pluginHandle != NULL, NULL);
+       RET_IF_FAIL(__pluginHandle->process != NULL, NULL);
+       RET_IF_FAIL(__pluginHandle->process->process != NULL, NULL);
+
+
+       Buffer *authReq = NULL;
+       unsigned char *authRespRaw = NULL;
+
+       /*Default handlers*/
+       if (__pluginHandle->assrt == NULL) {
+               TlvEncodable<AuthenticateReq> encodableReq(authnReq);
+               encodableReq.setEncoder(EID_UAFV1_SIGN_REQ);
+
+               TlvEncodable<AuthenticateResp> encodableResp;
+               encodableResp.setEncoder(EID_UAFV1_SIGN_RESP);
+
+               authReq = encodableReq.encode();
+
+               __pluginHandle->process->process(authReq->data, &authRespRaw);
+
+               return encodableResp.decode(authRespRaw);
+
+       }
+       else {
+               authReq = __pluginHandle->assrt->encode(TAG_UAFV1_SIGN_CMD, authnReq);
+
+               __pluginHandle->process->process(authReq->data, &authRespRaw);
+
+               AuthenticateResp *decodedResp = (AuthenticateResp*)
+                               (__pluginHandle->assrt->decode(authRespRaw));
+
+               RET_IF_FAIL(decodedResp != NULL, NULL);
+
+               return decodedResp;
+       }
+}
+
+DeregResp*
+BAuthStub::processDeregister(const DeregReq *deregReq)
+{
+       RET_IF_FAIL(__pluginHandle != NULL, NULL);
+       RET_IF_FAIL(__pluginHandle->process != NULL, NULL);
+       RET_IF_FAIL(__pluginHandle->process->process != NULL, NULL);
+
+
+       Buffer *authReq = NULL;
+       unsigned char *authRespRaw = NULL;
+
+       /*Default handlers*/
+       if (__pluginHandle->assrt == NULL) {
+               TlvEncodable<DeregReq> encodableReq(deregReq);
+               encodableReq.setEncoder(EID_UAFV1_DEREG_REQ);
+
+               TlvEncodable<DeregResp> encodableResp;
+               encodableResp.setEncoder(EID_UAFV1_DEREG_RESP);
+
+               authReq = encodableReq.encode();
+               RET_IF_FAIL(authReq != NULL, NULL);
+
+               __pluginHandle->process->process(authReq->data, &authRespRaw);
+
+               return encodableResp.decode(authRespRaw);
+
+       }
+       else {
+               authReq = __pluginHandle->assrt->encode(TAG_UAFV1_DEREGISTER_CMD, deregReq);
+
+               __pluginHandle->process->process(authReq->data, &authRespRaw);
+
+               DeregResp *decodedResp = (DeregResp*)
+                               (__pluginHandle->assrt->decode(authRespRaw));
+
+
+               RET_IF_FAIL(decodedResp != NULL, NULL);
+
+               return decodedResp;
+       }
+}
+
+int
+BAuthStub::openSettings(void)
+{
+       RET_IF_FAIL(__pluginHandle != NULL, -1);
+       RET_IF_FAIL(__pluginHandle->process != NULL, -1);
+       RET_IF_FAIL(__pluginHandle->process->process != NULL, -1);
+
+       return -1;/*TODO*/
+}
+
+Buffer *
+BAuthStub::hash(const std::string& message)
+{
+       _BEGIN;
+       RET_IF_FAIL(__pluginHandle != NULL, NULL);
+
+       /*Defult handlers*/
+       if (__pluginHandle->hash == NULL) {
+
+               unsigned char digest[5000];
+               AsmCrypto::genHash256(message.c_str(), strlen(message.c_str()), digest);
+               _INFO("AuthenrStub::hash::digest generated is [%s]", digest);
+
+               Buffer *hashInfo = ALLOC(Buffer);
+               hashInfo->len = SHA256_DIGEST_LENGTH;
+               hashInfo->data = NALLOC(BIG_SIZE, uint8_t);
+               memcpy(hashInfo->data, digest, SHA256_DIGEST_LENGTH);
+               //std::string digestStr((char*)digest, 5000);
+               _END;
+               return hashInfo;
+       }
+
+       char *digest = NULL;
+       __pluginHandle->hash->hash(message.c_str(), &digest);
+
+       if (digest == NULL)
+               return NULL;
+
+       //std::string digestStr(digest, strlen(digest));
+       Buffer *hashInfo = ALLOC(Buffer);
+       hashInfo->len = SHA256_DIGEST_LENGTH;
+       hashInfo->data = NALLOC(BIG_SIZE, uint8_t);
+       memcpy(hashInfo->data, digest, SHA256_DIGEST_LENGTH);
+
+       _END;
+       return hashInfo;
+
+}
+
+Buffer*
+BAuthStub::encodeRegisterRespone(RegAssertion *regAssrt, char **assrt_scheme)
+{
+       _BEGIN;
+       RET_IF_FAIL(regAssrt != NULL, NULL);
+
+       RET_IF_FAIL(__pluginHandle != NULL, NULL);
+
+       /*Default handlers*/
+       if (__pluginHandle->assrt == NULL) {
+
+               TlvEncodable<RegAssertion> encodableRegAssrtn(regAssrt);
+               encodableRegAssrtn.setEncoder(EID_UAFV1_REG_ASSERTION_RESP);
+
+               *assrt_scheme = (char *)(calloc(1, 128));
+               snprintf(*assrt_scheme, 128 - 1, "%s", "UAFV1TLV");
+
+               _END;
+               return encodableRegAssrtn.encode();
+
+       }
+       else {
+               _END;
+               return __pluginHandle->assrt->encode(TAG_UAFV1_REG_ASSERTION, regAssrt);
+       }
+}
+
+Buffer*
+BAuthStub::encodeSignRespone(AuthAssertion *authAssertion, char **assrt_scheme)
+{
+       _BEGIN;
+       RET_IF_FAIL(authAssertion != NULL, NULL);
+
+       _INFO("");
+
+       RET_IF_FAIL(__pluginHandle != NULL, NULL);
+
+       _INFO("");
+
+       /*Default handlers*/
+       if (__pluginHandle->assrt == NULL) {
+
+               _INFO("");
+               TlvEncodable<AuthAssertion> encodableSignAssrtn(authAssertion);
+               encodableSignAssrtn.setEncoder(EID_UAFV1_SIGN_ASSERTION_RESP);
+
+               _INFO("");
+               *assrt_scheme = (char *)(calloc(128, sizeof(char)));
+               snprintf(*assrt_scheme, 128 - 1, "%s", "UAFV1TLV");
+
+               _INFO("");
+               _END;
+               return encodableSignAssrtn.encode();
+
+       }
+       else {
+               _END;
+               return __pluginHandle->assrt->encode(TAG_UAFV1_AUTH_ASSERTION, authAssertion);
+       }
+}
+
+BAuthStub::BAuthStub(void)
+{
+       _INFO("BAuthStub creation");
+       __pluginHandle = NULL;
+       __cachedData = NULL;
+}
+
+BAuthStub::~BAuthStub(void)
+{
+       _INFO("BAuthStub deletion");
+       __pluginHandle = NULL;
+}
+
+
+int
+BAuthStub::initLocal(auth_plugin_handle_s *pluginH)
+{
+       __pluginHandle = (auth_plugin_handle_s*)pluginH;
+       return 0;
+}
+
+int
+BAuthStub::initRemote(IAuthConnection *conH)
+{
+       return -1;
+}
+
+auth_type_e
+BAuthStub::getType(void)
+{
+       return AUTH_TYPE_BOUND;
+}
diff --git a/server/auth_discovery/src/BleAdProvider.cpp b/server/auth_discovery/src/BleAdProvider.cpp
new file mode 100644 (file)
index 0000000..d8a24bf
--- /dev/null
@@ -0,0 +1,413 @@
+
+#include "BleAdProvider.h"
+#include "IAuthConnection.h"
+#include "BleCon.h"
+#include "RAuthStub.h"
+#include "AsmHelper.h"
+#include "BTRoamingKeys.h"
+
+/*BLE is not working on 3.0*/
+#define DISABLE_BLE
+
+void
+BleAdProvider::onBtStateChanged(int result, bt_adapter_state_e adapter_state,
+                                                               void *user_data)
+{
+       _INFO("bluetooth onBtStateChanged=[%d]", adapter_state);
+       BleAdProvider *btPro = (BleAdProvider*)user_data;
+       if (adapter_state == BT_ADAPTER_DISABLED) {
+               if (btPro->__stubCache != NULL) {
+                       _INFO("bluetooth Deletting cache=[%p]", btPro->__stubCache);
+                       delete btPro->__stubCache;
+                       btPro->__stubCache = NULL;
+               }
+       }
+}
+
+int
+BleAdProvider::init(void)
+{
+#ifdef DISABLE_BLE
+       _INFO("BLE is disabled by ASM");
+       return -1;
+#endif
+
+       _INFO("bluetooth ");
+       __stubCache = NULL;
+       int ret = bt_initialize();
+       if(ret != BT_ERROR_NONE && ret != BT_ERROR_ALREADY_DONE) {
+               _ERR("bluetooth rclient bluetooth service can not initialize=[%d]", ret);
+               return -1;
+       }
+
+       bt_adapter_set_state_changed_cb(onBtStateChanged, this);
+       _INFO("bluetooth ");
+       return 0;
+}
+
+auth_type_e
+BleAdProvider::getType(void)
+{
+       return AUTH_TYPE_ROAMING;
+}
+
+static bool
+__bt_gatt_client_foreach_desc_cb(int total, int index, bt_gatt_h desc_handle, void *data)
+{
+       char *uuid = NULL;
+
+       bt_gatt_get_uuid(desc_handle, &uuid);
+
+       _INFO("bluetooth [%d / %d] uuid: (%s)", index, total, uuid);
+
+       g_free(uuid);
+
+       return true;
+}
+
+static bool
+__bt_gatt_client_foreach_chr_cb(int total, int index, bt_gatt_h chr_handle, void *data)
+{
+       int ret;
+       char *uuid = NULL;
+
+       bt_gatt_get_uuid(chr_handle, &uuid);
+
+       _INFO("bluetooth [%d / %d] uuid: (%s)", index, total, uuid);
+
+       g_free(uuid);
+
+       ret = bt_gatt_characteristic_foreach_descriptors(chr_handle,
+                                                                                                        __bt_gatt_client_foreach_desc_cb, NULL);
+       if (ret != BT_ERROR_NONE)
+               _INFO("bluetooth bt_gatt_characteristic_foreach_descriptors failed: %d", ret);
+
+       return true;
+}
+
+static bool
+__svcCb(int total, int index, bt_gatt_h gatt_handle,
+                       void *user_data)
+{
+       int ret;
+               char *uuid = NULL;
+
+               bt_gatt_get_uuid(gatt_handle, &uuid);
+               _INFO("bluetooth [%d / %d] uuid: (%s)", index, total, uuid);
+
+               g_free(uuid);
+
+               ret = bt_gatt_service_foreach_characteristics(gatt_handle,
+                                                                                                         __bt_gatt_client_foreach_chr_cb, NULL);
+               if (ret != BT_ERROR_NONE)
+                       _INFO("bluetooth bt_gatt_service_foreach_characteristics failed: %d", ret);
+
+               return true;
+}
+
+#define printIfAndRet(e1, e2, str) \
+       if (e1 == e2) {\
+       _INFO("bluetooth fido asm bt error=[%s]", str);\
+       return; \
+       }\
+
+static void
+printBTError(bt_error_e e)
+{
+       printIfAndRet(e, BT_ERROR_NONE, "BT_ERROR_NONE");
+       printIfAndRet(e, BT_ERROR_CANCELLED, "BT_ERROR_CANCELLED");
+       printIfAndRet(e, BT_ERROR_INVALID_PARAMETER, "BT_ERROR_INVALID_PARAMETER");
+       printIfAndRet(e, BT_ERROR_OUT_OF_MEMORY, "BT_ERROR_OUT_OF_MEMORY");
+       printIfAndRet(e, BT_ERROR_RESOURCE_BUSY, "BT_ERROR_RESOURCE_BUSY");
+       printIfAndRet(e, BT_ERROR_TIMED_OUT, "BT_ERROR_TIMED_OUT");
+       printIfAndRet(e, BT_ERROR_NOW_IN_PROGRESS, "BT_ERROR_NOW_IN_PROGRESS");
+       printIfAndRet(e, BT_ERROR_NOT_SUPPORTED, "BT_ERROR_NOT_SUPPORTED");
+       printIfAndRet(e, BT_ERROR_PERMISSION_DENIED, "BT_ERROR_PERMISSION_DENIED");
+       printIfAndRet(e, BT_ERROR_QUOTA_EXCEEDED, "BT_ERROR_QUOTA_EXCEEDED");
+       printIfAndRet(e, BT_ERROR_NO_DATA, "BT_ERROR_NO_DATA");
+       printIfAndRet(e, BT_ERROR_DEVICE_POLICY_RESTRICTION, "BT_ERROR_DEVICE_POLICY_RESTRICTION");
+       printIfAndRet(e, BT_ERROR_NOT_INITIALIZED, "BT_ERROR_NOT_INITIALIZED");
+       printIfAndRet(e, BT_ERROR_NOT_ENABLED, "BT_ERROR_NOT_ENABLED");
+       printIfAndRet(e, BT_ERROR_ALREADY_DONE, "BT_ERROR_ALREADY_DONE");
+       printIfAndRet(e, BT_ERROR_ALREADY_DONE, "BT_ERROR_ALREADY_DONE");
+       printIfAndRet(e, BT_ERROR_OPERATION_FAILED, "BT_ERROR_OPERATION_FAILED");
+       printIfAndRet(e, BT_ERROR_NOT_IN_PROGRESS, "BT_ERROR_NOT_IN_PROGRESS");
+       printIfAndRet(e, BT_ERROR_REMOTE_DEVICE_NOT_BONDED, "BT_ERROR_REMOTE_DEVICE_NOT_BONDED");
+       printIfAndRet(e, BT_ERROR_AUTH_REJECTED, "BT_ERROR_AUTH_REJECTED");
+       printIfAndRet(e, BT_ERROR_AUTH_FAILED, "BT_ERROR_AUTH_FAILED");
+       printIfAndRet(e, BT_ERROR_REMOTE_DEVICE_NOT_FOUND, "BT_ERROR_REMOTE_DEVICE_NOT_FOUND");
+       printIfAndRet(e, BT_ERROR_SERVICE_SEARCH_FAILED, "BT_ERROR_SERVICE_SEARCH_FAILED");
+       printIfAndRet(e, BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED, "BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED");
+       printIfAndRet(e, BT_ERROR_AGAIN, "BT_ERROR_AGAIN");
+       printIfAndRet(e, BT_ERROR_SERVICE_NOT_FOUND, "BT_ERROR_SERVICE_NOT_FOUND");
+       printIfAndRet(e, e, "Unknown");
+}
+
+void
+BleAdProvider::onGattConchanged(int result, bool connected, const char *remote_address, void *user_data)
+{
+       _INFO("bluetooth remote_address=[%s]", remote_address);
+       _INFO("bluetooth connected=[%d]", connected);
+       _INFO("bluetooth [%d]", result);
+       printBTError(static_cast<bt_error_e>(result));
+       if (connected == false) {
+               _ERR("bluetooth GATT disconnected");
+               return;
+       }
+
+       bt_gatt_h svc = NULL;
+       bt_gatt_h chrReq = NULL;
+       bt_gatt_h chrResp = NULL;
+       bt_gatt_client_h client = NULL;
+
+       _INFO("bluetooth ");
+       int ret = bt_gatt_client_create(remote_address, &client);
+       if (ret != BT_ERROR_NONE) {
+               _ERR("bluetooth rclient bt_gatt_client_create failed=[%d]", ret);
+               return;
+       }
+
+       ret = bt_gatt_client_foreach_services(client, __svcCb, NULL);
+       printBTError(static_cast<bt_error_e>(ret));
+
+       char *cRAddr = NULL;
+       ret = bt_gatt_client_get_remote_address(client, &cRAddr);
+       printBTError(static_cast<bt_error_e>(ret));
+
+       _INFO("bluetooth bt_gatt_client_get_remote_address=[%s]", cRAddr);
+       ret = bt_gatt_client_get_service(client, RA_BLE_SERVICE_UUID, &svc);
+       if (ret != BT_ERROR_NONE) {
+               _ERR("bluetooth rclient bt_gatt_client_get_service failed=[%d]", ret);
+               printBTError(static_cast<bt_error_e>(ret));
+               return;
+       }
+
+       _INFO("bluetooth ");
+       ret = bt_gatt_service_get_characteristic(svc, RA_BLE_UUID_REQUEST, &chrReq);
+       if (ret != BT_ERROR_NONE) {
+               _ERR("bluetooth rclient bt_gatt_service_get_characteristic failed=[%d]", ret);
+               return;
+       }
+
+       _INFO("bluetooth ");
+       ret = bt_gatt_service_get_characteristic(svc, RA_BLE_UUID_RESPONSE, &chrResp);
+       if (ret != BT_ERROR_NONE) {
+               _ERR("bluetooth rclient bt_gatt_service_get_characteristic failed=[%d]", ret);
+               return;
+       }
+
+       _INFO("bluetooth ");
+       GattClient *gC = new GattClient();
+       gC->__btClientInfo = _SAFE_DUP(remote_address);
+       gC->__btClient = client;
+       gC->__btClientSvc = svc;
+       gC->__btClientChrReq = chrReq;
+       gC->__btClientChrResp = chrResp;
+
+       IAuthConnection *bleClient = new BleCon();
+       bleClient->init(gC);
+
+       IAuthStub *raStub = new RAuthStub();
+       raStub->initRemote(bleClient);
+
+       BleAdProvider *blePro = (BleAdProvider*)user_data;
+       if (blePro->__stubCache == NULL) {
+               blePro->__stubCache = new std::map<int, IAuthStub*>();
+       }
+
+       /*Index auto incremented, set properly during setCache*/
+       blePro->__stubCache->insert(std::make_pair(blePro->__stubCache->size(), raStub));
+
+       BleAdProvider::finishDiscovery(user_data);
+}
+
+void
+BleAdProvider::onLEScanResult(int result, bt_adapter_le_device_scan_result_info_s *info,
+                                                         void *user_data)
+{
+       _INFO("bluetooth rclient __bt_adapter_le_scan_result_cb=[%d]", result);
+       _INFO("bluetooth remote_address=[%s]", info->remote_address);
+       _INFO("bluetooth address_type=[%d]", info->address_type);
+       /*_INFO("bluetooth adv_data=[%s]", info->adv_data);
+       _INFO("bluetooth scan_data=[%s]", info->scan_data);*/
+
+       if (info->adv_data_len > 31 || info->scan_data_len > 31) {
+                       _INFO("bluetooth ###################");
+                       bt_adapter_le_stop_scan();
+                       _INFO("bluetooth ###################");
+                       return;
+       }
+
+       bt_adapter_le_packet_type_e pkt_type = BT_ADAPTER_LE_PACKET_ADVERTISING;
+       int i = 0;
+       for (i = 0; i < 2; i++) {
+                       char **uuids;
+                       char *device_name;
+                       int tx_power_level;
+                       bt_adapter_le_service_data_s *data_list;
+                       int appearance;
+                       int manufacturer_id;
+                       char *manufacturer_data;
+                       int manufacturer_data_len;
+                       int count;
+
+                       pkt_type = static_cast<bt_adapter_le_packet_type_e>(static_cast<int>(pkt_type) + i);
+                       if (pkt_type == BT_ADAPTER_LE_PACKET_ADVERTISING && info->adv_data == NULL)
+                               continue;
+                       if (pkt_type == BT_ADAPTER_LE_PACKET_SCAN_RESPONSE && info->scan_data == NULL)
+                               break;
+
+                       if (bt_adapter_le_get_scan_result_service_uuids(info, pkt_type, &uuids, &count) == BT_ERROR_NONE) {
+                               int i;
+                               for (i = 0; i < count; i++) {
+                                       _INFO("bluetooth UUID[%d] = %s", i + 1, uuids[i]);
+                                       g_free(uuids[i]);
+                               }
+                               g_free(uuids);
+                       }
+                       if (bt_adapter_le_get_scan_result_device_name(info, pkt_type, &device_name) == BT_ERROR_NONE) {
+                               _INFO("bluetooth Device name = %s", device_name);
+                               g_free(device_name);
+                       }
+                       if (bt_adapter_le_get_scan_result_tx_power_level(info, pkt_type, &tx_power_level) == BT_ERROR_NONE)
+                               _INFO("bluetooth TX Power level = %d", tx_power_level);
+                       if (bt_adapter_le_get_scan_result_service_solicitation_uuids(info, pkt_type, &uuids, &count) == BT_ERROR_NONE) {
+                               int i;
+                               for (i = 0; i < count; i++) {
+                                       _INFO("bluetooth Solicitation UUID[%d] = %s", i + 1, uuids[i]);
+                                       g_free(uuids[i]);
+                               }
+                               g_free(uuids);
+                       }
+                       if (bt_adapter_le_get_scan_result_service_data_list(info, pkt_type, &data_list, &count) == BT_ERROR_NONE) {
+                               int i;
+                               for (i = 0; i < count; i++) {
+                                       _INFO("bluetooth Service Data[%d] = [0x%2.2X%2.2X:0x%.2X...]", i + 1,
+                                                          data_list[i].service_uuid[0], data_list[i].service_uuid[1], data_list[i].service_data[0]);
+                               }
+                               bt_adapter_le_free_service_data_list(data_list, count);
+                       }
+                       if (bt_adapter_le_get_scan_result_appearance(info, pkt_type, &appearance) == BT_ERROR_NONE)
+                               _INFO("bluetooth Appearance = %d", appearance);
+                       if (bt_adapter_le_get_scan_result_manufacturer_data(info, pkt_type, &manufacturer_id,
+                                                                                                                               &manufacturer_data, &manufacturer_data_len) == BT_ERROR_NONE) {
+                               _INFO("bluetooth Manufacturer data[ID:%.4X, 0x%.2X%.2X...(len:%d)]",
+                                                  manufacturer_id, manufacturer_data[0], manufacturer_data[1], manufacturer_data_len);
+                               g_free(manufacturer_data);
+                       }
+               }
+
+       /*RA_BLE_ADVERTISING_UUID*/
+
+       /*_INFO("bluetooth [%d] sec timeout starting", BT_DISC_TIMEOUT_SEC);
+       g_timeout_add_seconds_full(G_PRIORITY_DEFAULT, BT_DISC_TIMEOUT_SEC, discoverTimeOutCb, user_data,
+                                                               finishDiscovery);*/
+
+       _INFO("bluetooth Before bt_gatt_connect");
+
+       int ret = bt_gatt_connect(info->remote_address, false);
+       if (ret != BT_ERROR_NONE) {
+               _ERR("bluetooth rclient bt_gatt_connect failed=[%d]", ret);
+               return;
+       }
+
+       _INFO("bluetooth bt_gatt_connect=[%d]", ret);
+}
+
+void
+BleAdProvider::finishDiscovery(gpointer data)
+{
+       _INFO("bluetooth ");
+       bt_adapter_le_stop_scan();
+
+       BleAdProvider *btPro = (BleAdProvider*)(data);
+       g_main_loop_quit(btPro->__waitLoop);
+}
+
+gboolean
+BleAdProvider::discoverTimeOutCb(gpointer user_data)
+{
+       _INFO("bluetooth discoverTimeOutCb");
+
+       return G_SOURCE_REMOVE;
+}
+
+std::vector<IAuthStub*> *
+BleAdProvider::getAuthStubList(void)
+{
+       _INFO("bluetooth getAuthStubList");
+       delete __stubCache;
+       __stubCache = NULL;
+
+       __waitLoop = g_main_loop_new(NULL, FALSE);
+
+       bt_gatt_set_connection_state_changed_cb(onGattConchanged, this);
+
+       _INFO("bluetooth starting LE scan");
+       int ret = bt_adapter_le_start_scan(onLEScanResult, this);
+       if (ret != BT_ERROR_NONE) {
+               bt_gatt_unset_connection_state_changed_cb();
+               _ERR("bluetooth rclient bt_adapter_le_start_scan failed.");
+               bt_adapter_le_stop_scan();
+
+               return NULL;
+       }
+
+       _INFO("bluetooth starting wait loop");
+       g_main_loop_run(__waitLoop);
+
+       _INFO("bluetooth After waitloop");
+
+       g_main_loop_unref(__waitLoop);
+       __waitLoop = NULL;
+
+       if (__stubCache != NULL) {
+               _INFO("bluetooth BT Roaming Auth Count=[%d]", __stubCache->size());
+       } else {
+               _ERR("bluetooth BT Roaming Auth List is NULL");
+               return NULL;
+       }
+
+       std::vector<IAuthStub*> *stubList = NULL;
+
+       std::map<int, IAuthStub*>::iterator it = __stubCache->begin();
+       for (; it != __stubCache->end(); ++it) {
+               if (stubList == NULL)
+                       stubList = new std::vector<IAuthStub*>();
+
+               stubList->push_back(it->second);
+       }
+       _INFO("bluetooth ");
+       return stubList;
+}
+
+void
+BleAdProvider::setCache(std::map<int, IAuthStub*> *stubCache)
+{
+       _INFO("bluetooth BleAdProvider::setCache");
+       if (stubCache != NULL)
+               _INFO("bluetooth New cache set size =[%d]", stubCache->size());
+
+       __stubCache = stubCache;
+}
+
+IAuthStub*
+BleAdProvider::getStubFromCache(int mappedIdx)
+{
+       if (__stubCache == NULL) {
+               _ERR("bluetooth Stub cache NULL");
+               return NULL;
+       }
+
+       return __stubCache->find(mappedIdx)->second;
+}
+
+BleAdProvider::~BleAdProvider(void)
+{
+
+}
+
+BleAdProvider::BleAdProvider(void)
+{
+
+}
diff --git a/server/auth_discovery/src/BleCon.cpp b/server/auth_discovery/src/BleCon.cpp
new file mode 100644 (file)
index 0000000..5ce9f68
--- /dev/null
@@ -0,0 +1,103 @@
+#include "BleCon.h"
+#include "AsmHelper.h"
+#include "BTRoamingKeys.h"
+#include "RoamingKeys.h"
+
+BleCon::BleCon(void)
+{
+       __gClient = NULL;
+}
+
+BleCon::~BleCon(void)
+{
+
+}
+
+int
+BleCon::init(void *handle)
+{
+       __gClient = (GattClient*)handle;
+
+       return 0;
+}
+
+void
+BleCon::onGattServerResponse(bt_gatt_h characteristic, char *value,
+                                        int len, void *user_data)
+{
+       _INFO("Response length = [%d]", len);
+
+       BleCon *btCon = (BleCon*)user_data;
+       btCon->__resp = new StringMap();
+
+       std::string k(RA_QUERY_KEY_RESPONSE);
+       std::string v(strdup(value));
+       btCon->__resp->insert(std::make_pair(k, v));
+
+       g_main_loop_quit(btCon->__waitLoop);
+}
+
+void
+BleCon::onGattWriteComplete(int result, bt_gatt_h request_handle, void *user_data)
+{
+       _INFO("[%d]", result);
+       BleCon *btCon = (BleCon*)user_data;
+       if (result != 0) {
+               g_main_loop_quit(btCon->__waitLoop);
+       }
+}
+
+StringMap*
+BleCon::sendReqSync(StringMap *reqData)
+{
+       _INFO("sendReqSync start");
+
+       RET_IF_FAIL(reqData != NULL, NULL);
+       RET_IF_FAIL(__gClient != NULL, NULL);
+
+       __resp = NULL;
+       std::string reqTlvB64 = (reqData->find(RA_QUERY_KEY_REQUEST)->second);
+       char *reqTlvB64Copy = strdup(reqTlvB64.c_str());
+
+       __waitLoop = g_main_loop_new(NULL, FALSE);
+
+       int ret = bt_gatt_client_set_characteristic_value_changed_cb(__gClient->__btClientChrResp,
+                                                                                                                                onGattServerResponse, this);
+       _ERR("rclient bt_gatt_client_set_characteristic_value_changed_cb failed=[%d]", ret);
+
+
+       ret = bt_gatt_set_value(__gClient->__btClientChrReq, reqTlvB64Copy, strlen(reqTlvB64Copy));
+       if (ret != BT_ERROR_NONE) {
+               _ERR("rclient bt_gatt_set_value failed=[%d]", ret);
+               goto CATCH;
+       }
+
+       ret = bt_gatt_client_write_value(__gClient->__btClientChrReq, onGattWriteComplete, this);
+       if (ret != BT_ERROR_NONE) {
+               _ERR("rclient bt_gatt_client_write_value failed=[%d]", ret);
+               goto CATCH;
+       }
+
+       _INFO("bt_gatt_client_write_value=[%d]", ret);
+       g_main_loop_run(__waitLoop);
+
+CATCH:
+       g_main_loop_unref(__waitLoop);
+       bt_gatt_client_unset_characteristic_value_changed_cb(__gClient->__btClientChrResp);
+       _INFO("sendReqSync=%s", __resp);
+       return __resp;
+}
+
+int
+BleCon::shutdown(void)
+{
+       return -1;
+}
+
+char*
+BleCon::getInfo(void)
+{
+       RET_IF_FAIL(__gClient != NULL, NULL);
+
+       return __gClient->__btClientInfo;
+}
diff --git a/server/auth_discovery/src/BoundADProvider.cpp b/server/auth_discovery/src/BoundADProvider.cpp
new file mode 100644 (file)
index 0000000..0a2bd7b
--- /dev/null
@@ -0,0 +1,364 @@
+
+#include "BoundADProvider.h"
+#include "AsmHelper.h"
+#include "AuthnrTypes.h"
+#include "BAuthStub.h"
+#include "AuthIndexHanlder.h"
+
+#include <stdlib.h>
+#include <dlfcn.h>
+
+#define FIDO_AUTH_PLUGINS_PATH_PREFIX "/usr/lib/fido/asm/auth/"
+#define FIDO_AUTH_PLUGINS_PATH_PREFIX_64 "/usr/lib64/fido/asm/auth/"
+
+BoundADProvider::BoundADProvider(void)
+{
+       _INFO("BoundADProvider create");
+       __stubCache = NULL;
+}
+
+BoundADProvider::~BoundADProvider(void)
+{
+       _INFO("BoundADProvider destroy");
+       __stubCache = NULL;
+}
+
+int
+BoundADProvider::init(void)
+{
+       return initPluginList();
+}
+
+auth_type_e
+BoundADProvider::getType(void)
+{
+       return AUTH_TYPE_BOUND;
+}
+
+std::vector<IAuthStub*>*
+BoundADProvider::getAuthStubList(void)
+{
+       _INFO("getAllAuthenticators");
+       if ((__stubCache == NULL) || (__stubCache->size() <= 0)) {
+               _ERR("Stub cache NULL");
+               return NULL;
+       }
+
+       std::vector<IAuthStub*> *stubList = NULL;
+
+       AuthnrMapIter it = __stubCache->begin();
+       for (; it != __stubCache->end(); ++it) {
+               if (stubList == NULL)
+                       stubList = new std::vector<IAuthStub*>();
+
+               stubList->push_back(it->second);
+               _INFO("");
+       }
+       _INFO("");
+       return stubList;
+}
+
+void
+BoundADProvider::setCache(std::map<int, IAuthStub*> *stubCache)
+{
+       _INFO("BoundADProvider::setCache");
+       __stubCache = NULL;
+
+       if (stubCache != NULL)
+               _INFO("New cache set size =[%d]", stubCache->size());
+
+       __stubCache = stubCache;
+       _INFO("BoundADProvider::Cache=[%p][%p]", this, __stubCache);
+       std::map<int, IAuthStub*>::iterator it = __stubCache->begin();
+       for (; it != __stubCache->end(); ++it) {
+               _INFO("Cache Stub=[%d][%p]", it->first, it->second);
+       }
+}
+
+IAuthStub*
+BoundADProvider::getStubFromCache(int mappedIdx)
+{
+       if (__stubCache == NULL) {
+               _ERR("Stub cache NULL");
+               return NULL;
+       }
+
+       _INFO("Searching [%d]", mappedIdx);
+
+       _INFO("BoundADProvider::Cache=[%p][%p]", this, __stubCache);
+       std::map<int, IAuthStub*>::iterator it = __stubCache->begin();
+       for (; it != __stubCache->end(); ++it) {
+               _INFO("Cache Stub=[%d][%p]", it->first, it->second);
+       }
+
+       std::map<int, IAuthStub*>::iterator resIt = __stubCache->find(mappedIdx);
+       if (resIt == __stubCache->end()) {
+               _ERR("Stub not found");
+               return NULL;
+       }
+
+       _INFO("Result Stub=[%p]", resIt->second);
+       return resIt->second;
+}
+
+plugin_conn_handle_s*
+BoundADProvider::createConnectionHandle(void *mod)
+{
+       _INFO("");
+
+       RET_IF_FAIL(mod != NULL, NULL);
+
+       plugin_conn_handle_s *handle = (plugin_conn_handle_s*)
+                       calloc(1, sizeof(plugin_conn_handle_s));
+
+       handle->init = (plugin_init)dlsym(mod, "fido_auth_plugin_init");
+       CATCH_IF_FAIL(handle->init != NULL);
+
+       handle->de_init = (plugin_de_init)dlsym(mod, "fido_auth_plugin_de_init");
+       CATCH_IF_FAIL(handle->de_init != NULL);
+
+       handle->is_connected = (plugin_is_connected)dlsym(mod, "fido_auth_plugin_is_connected");
+       CATCH_IF_FAIL(handle->is_connected != NULL);
+
+       /*Not mandatory*/
+       handle->attach_hint = (plugin_get_attachment_hint)dlsym(mod, "fido_auth_plugin_get_attachment_hint");
+       handle->title = (plugin_get_title)dlsym(mod, "fido_auth_plugin_get_title");
+       handle->description = (plugin_get_description)dlsym(mod, "fido_auth_plugin_get_description");
+
+       _INFO("");
+        return handle;
+
+CATCH:
+        free(handle);
+        return NULL;
+
+}
+
+plugin_assrt_handle_s*
+BoundADProvider::createAssertionHandle(void *mod)
+{
+       RET_IF_FAIL(mod != NULL, NULL);
+
+       plugin_assrt_handle_s *handle = (plugin_assrt_handle_s*)
+                       calloc(1, sizeof(plugin_assrt_handle_s));
+
+       handle->get_scheme = (plugin_get_assertion_scheme)dlsym(mod, "fido_auth_plugin_get_assertion_scheme");
+       CATCH_IF_FAIL(handle->get_scheme != NULL);
+
+       handle->encode = (plugin_encode_assertion)dlsym(mod, "fido_auth_plugin_encode_assertion");
+       CATCH_IF_FAIL(handle->encode != NULL);
+
+       handle->decode = (plugin_decode_assertion)dlsym(mod, "fido_auth_plugin_decode_assertion");
+       CATCH_IF_FAIL(handle->decode != NULL);
+
+       return handle;
+
+CATCH:
+        free(handle);
+        return NULL;
+}
+
+plugin_process_handle_s*
+BoundADProvider::createProcessHandle(void *mod)
+{
+       RET_IF_FAIL(mod != NULL, NULL);
+
+       plugin_process_handle_s *handle = (plugin_process_handle_s*)
+                       calloc(1, sizeof(plugin_process_handle_s));
+
+       handle->process = (plugin_fido_command_process)dlsym(mod, "fido_auth_plugin_fido_command_process");
+       CATCH_IF_FAIL(handle->process != NULL);
+
+       return handle;
+
+CATCH:
+        free(handle);
+        return NULL;
+}
+
+plugin_user_op_handle_s*
+BoundADProvider::createUserOpHandle(void *mod)
+{
+       RET_IF_FAIL(mod != NULL, NULL);
+
+       plugin_user_op_handle_s *handle = (plugin_user_op_handle_s*)
+                       calloc(1, sizeof(plugin_user_op_handle_s));
+
+       handle->is_uv_reqd = (plugin_is_uv_required)dlsym(mod, "fido_auth_plugin_is_uv_required");
+
+       handle->enroll = (plugin_enroll)dlsym(mod, "fido_auth_plugin_enroll");
+       /*if enroll is not defined then default enroll function will be used*/
+       //CATCH_IF_FAIL(isFound == true);
+
+       handle->is_enrolled = (plugin_is_enrolled)dlsym(mod, "fido_auth_plugin_is_enrolled");
+       CATCH_IF_FAIL(handle->is_enrolled != NULL);
+
+       handle->verify = (plugin_verify)dlsym(mod, "fido_auth_plugin_verify");
+       CATCH_IF_FAIL(handle->verify != NULL);
+
+       return handle;
+
+CATCH:
+        free(handle);
+        return NULL;
+}
+
+plugin_hash_handle_s*
+BoundADProvider::createHashHandle(void *mod)
+{
+       RET_IF_FAIL(mod != NULL, NULL);
+
+       plugin_hash_handle_s *handle = (plugin_hash_handle_s*)
+                       calloc(1, sizeof(plugin_hash_handle_s));
+
+       handle->hash = (plugin_hash)dlsym(mod, "fido_auth_plugin_hash");
+       CATCH_IF_FAIL(handle->hash != NULL);
+
+       return handle;
+
+CATCH:
+        free(handle);
+        return NULL;
+}
+
+plugin_ui_op_handle_s*
+BoundADProvider::createUiOpHandle(void *mod)
+{
+       RET_IF_FAIL(mod != NULL, NULL);
+
+       plugin_ui_op_handle_s *handle = (plugin_ui_op_handle_s*)
+                       calloc(1, sizeof(plugin_ui_op_handle_s));
+
+       handle->confirm_account = (plugin_confirm_account)dlsym(mod, "fido_auth_plugin_confirm_account");
+       CATCH_IF_FAIL(handle->confirm_account != NULL);
+
+       handle->confirm_tc = (plugin_confirm_tc)dlsym(mod, "fido_auth_plugin_confirm_tc");
+       CATCH_IF_FAIL(handle->confirm_tc != NULL);
+
+       return handle;
+
+ CATCH:
+         free(handle);
+         return NULL;
+
+}
+
+int
+BoundADProvider::loadPlugins(const std::string& dirName)
+{
+       _INFO("loadPlugins from [%s]", dirName.c_str());
+
+       /*TODO: Directory watcher, to support dynamic add/remove of plugins*/
+
+       GDir *dir = NULL;
+       GError *error = NULL;
+       const gchar *filename = NULL;
+
+       /*Find arch in run-time*/
+       dir = g_dir_open(dirName.c_str(), 0, &error);
+       RET_IF_FAIL(dir != NULL, -1);
+
+       GPatternSpec *plugin_name_pattern = g_pattern_spec_new("*?.so");
+
+       _INFO("Before g_dir_read_name loop");
+       while ((filename = g_dir_read_name(dir))) {
+               if (g_pattern_match_string(plugin_name_pattern, filename)) {
+
+                       std::string fullPathName;
+                       fullPathName += dirName.c_str();
+                       fullPathName += filename;
+
+                       _INFO("fullPathName = [%s]", fullPathName.c_str());
+
+                       void *mod = dlopen(fullPathName.c_str(), RTLD_LAZY);
+                       if (mod != NULL) {
+                               _INFO("Module opened");
+
+                               auth_plugin_handle_s *auth_plugin = (auth_plugin_handle_s*)
+                                               calloc(1, sizeof(auth_plugin_handle_s));
+
+                               auth_plugin->conn = createConnectionHandle(mod);
+                               auth_plugin->assrt = createAssertionHandle(mod);
+                               auth_plugin->hash = createHashHandle(mod);
+                               auth_plugin->process = createProcessHandle(mod);
+                               auth_plugin->user = createUserOpHandle(mod);
+                               auth_plugin->ui = createUiOpHandle(mod);
+
+                               if (__stubCache == NULL)
+                                       __stubCache = new std::map<int, IAuthStub*>();
+
+                               /*id starts from 0*/
+                               auth_plugin->id = __stubCache->size();
+
+                               IAuthStub *stub = new BAuthStub();
+                               stub->initLocal(auth_plugin);
+
+                               /*Later, during setCache its overwritten by mappedIndex*/
+                               __stubCache->insert(std::make_pair(auth_plugin->id, stub));
+
+                       }
+
+
+
+
+                       /*GModule *mod = g_module_open(fullPathName.c_str(), G_MODULE_BIND_LAZY);
+                       if (mod != NULL) {
+
+                               _INFO("Found module");
+
+                               auth_plugin_handle_s *auth_plugin = (auth_plugin_handle_s*)
+                                               calloc(1, sizeof(auth_plugin_handle_s));
+
+                               auth_plugin->conn = createConnectionHandle(mod);
+                               auth_plugin->assrt = createAssertionHandle(mod);
+                               auth_plugin->hash = createHashHandle(mod);
+                               auth_plugin->process = createProcessHandle(mod);
+                               auth_plugin->user = createUserOpHandle(mod);
+                               auth_plugin->ui = createUiOpHandle(mod);
+
+                               if (__stubCache == NULL)
+                                       __stubCache = new std::map<int, IAuthStub*>();
+
+                               //id starts from 0
+                               auth_plugin->id = __stubCache->size();
+
+                               IAuthStub *stub = new BAuthStub();
+                               stub->initLocal(auth_plugin);
+
+                               //Later, during setCache its overwritten by mappedIndex
+                               __stubCache->insert(std::make_pair(auth_plugin->id, stub));
+
+                       }*/
+               }
+       }
+
+       g_pattern_spec_free(plugin_name_pattern);
+
+       g_dir_close(dir);
+
+       int count = 0;
+       if (__stubCache != NULL)
+               count = __stubCache->size();
+
+       _INFO("Total plugins found = [%d]", count);
+
+       if (count > 0)
+               return 0;
+
+       return -1;
+}
+
+int
+BoundADProvider::initPluginList(void)
+{
+       _INFO("initPluginList");
+
+       int ret32 = loadPlugins(FIDO_AUTH_PLUGINS_PATH_PREFIX);
+       int ret64 = loadPlugins(FIDO_AUTH_PLUGINS_PATH_PREFIX_64);
+
+       if ((ret32 != 0) && (ret64 != 0))
+               return -1;
+
+       else
+               return 0;
+}
diff --git a/server/auth_discovery/src/BtADProvider.cpp b/server/auth_discovery/src/BtADProvider.cpp
new file mode 100644 (file)
index 0000000..2bcd709
--- /dev/null
@@ -0,0 +1,255 @@
+
+#include "BtAdProvider.h"
+#include "IAuthConnection.h"
+#include "BtCon.h"
+#include "RAuthStub.h"
+#include "AsmHelper.h"
+#include "BTRoamingKeys.h"
+//#include <bluetooth/include/mobile/bluetooth.h>
+#include <string.h>
+
+#define RA_BT_SERVICE_UUID "00001101-0000-1000-8000-00805F9B34FB"
+
+int
+BtAdProvider::init(void)
+{
+       __isDiscovering = false;
+       __sAddr = NULL;
+
+       int ret = bt_initialize();
+       _INFO("bt_initialize=[%d]", ret);
+       if (ret != BT_ERROR_NONE)
+               return -1;
+       __stubCache = NULL;
+
+       return 0;
+}
+
+auth_type_e
+BtAdProvider::getType(void)
+{
+       return AUTH_TYPE_ROAMING;
+}
+
+void
+BtAdProvider::onSockChanged(int result, bt_socket_connection_state_e connection_state,
+                                               bt_socket_connection_s *connection, void *user_data)
+{
+       if (result != BT_ERROR_NONE) {
+               _ERR("[%d]", result);
+               return;
+       }
+
+       if (connection_state == BT_SOCKET_CONNECTED) {
+               _INFO("Connected = [%s][%s][%d]", connection->remote_address, connection->service_uuid,
+                         connection->local_role);
+
+               IAuthConnection *btCon = new BtCon();
+               bt_socket_connection_s *conClone = (bt_socket_connection_s*)calloc(1, sizeof(bt_socket_connection_s));
+               conClone->socket_fd = connection->socket_fd;
+               conClone->server_fd = connection->server_fd;
+               conClone->local_role = connection->local_role;
+               conClone->remote_address = _SAFE_DUP(connection->remote_address);
+               conClone->service_uuid = _SAFE_DUP(connection->service_uuid);
+               btCon->init(conClone);
+
+               IAuthStub *raStub = new RAuthStub();
+               raStub->initRemote(btCon);
+
+               BtAdProvider *btPro = (BtAdProvider*)user_data;
+               if (btPro->__stubCache == NULL) {
+                       btPro->__stubCache = new std::map<int, IAuthStub*>();
+               }
+
+               /*Index auto incremented, set properly during setCache*/
+               btPro->__stubCache->insert(std::make_pair(btPro->__stubCache->size(), raStub));
+
+               btPro->__sAddr = _SAFE_DUP(connection->remote_address);
+               finishDiscovery(user_data);
+               return;
+       }
+
+       if (connection_state == BT_SOCKET_DISCONNECTED) {
+               _INFO("DisConnected = [%s][%s][%d]", connection->remote_address, connection->service_uuid,
+                         connection->local_role);
+               return;
+       }
+}
+
+bool
+BtAdProvider::onBondedList(bt_device_info_s *device_info, void *user_data)
+{
+       _INFO("");
+       if (device_info->is_bonded == true) {
+               _INFO("");
+
+               /*bool isCon = false;
+               int ret = bt_device_is_profile_connected(device_info->remote_address, BT_PROFILE_RFCOMM, &isCon);
+               _INFO("%d", ret);
+
+               if (isCon == false) {
+                       //ret = bt_device_get_connection_state(device_info->remote_address, BT_PROFILE_RFCOMM, &isCon);
+                       //_INFO("%d", ret);
+                       if (isCon == false) {
+                               _INFO("Ignoring [%s], since not connected currently", device_info->remote_address);
+                               return true;
+                       }
+               }*/
+
+               int sC = device_info->service_count;
+               _INFO("service count=[%d]", sC);
+               //for (int i = 0; i < sC; i++) {
+                       //_INFO("");
+                       //_INFO("service uuid=[%s]", device_info->service_uuid[i]);
+                       //char *uuid = device_info->service_uuid[i];
+                       //if (uuid != NULL) {
+                               _INFO("");
+                               //if (strcmp(RA_BT_SERVICE_UUID, uuid) == 0) {
+                                       _INFO("Trying to conenct to [%s][%s]", device_info->remote_address, RA_BT_SERVICE_UUID);
+
+
+                                       BtAdProvider *btPro = (BtAdProvider*)user_data;
+                                       if (btPro->__isConCbSet == false) {
+                                               bt_socket_set_connection_state_changed_cb(onSockChanged, user_data);
+                                               btPro->__isConCbSet = true;
+                                       }
+                                       int ret = bt_socket_connect_rfcomm(device_info->remote_address,
+                                                                                        RA_BT_SERVICE_UUID);
+                                       _INFO("%d", ret);
+                                       if (ret != BT_ERROR_NONE) {
+                                               _ERR("bt_socket_connect_rfcomm failed=[%d]", ret);
+                                               return true;
+                                       }
+                               //}
+                       //}
+               //}
+       }
+       return true;
+}
+
+std::vector<IAuthStub*> *
+BtAdProvider::getAuthStubList(void)
+{
+       if (__stubCache != NULL) {
+               /*Close previous sockets*/
+               std::map<int, IAuthStub*>::iterator it = __stubCache->begin();
+               for (; it != __stubCache->end(); ++it) {
+                       _INFO("");
+                       it->second->shutDown();
+               }
+
+               delete __stubCache;
+               __stubCache = NULL;
+       }
+
+
+       __waitLoop = g_main_loop_new(NULL, FALSE);
+
+       __isDiscovering = true;
+       __sAddr = NULL;
+       __isConCbSet = false;
+
+       _INFO("bluetooth discovery [%d] sec timeout starting", 5);
+       g_timeout_add_seconds_full(G_PRIORITY_DEFAULT, 5, discoverTimeOutCb, this,
+                                                               finishDiscovery);
+
+       int ret = bt_adapter_foreach_bonded_device(onBondedList, this);
+       if (ret != BT_ERROR_NONE) {
+               _ERR("bt_adapter_foreach_bonded_device=[%d]", ret);
+               return NULL;
+       }
+
+       _INFO("bluetooth starting wait loop");
+       g_main_loop_run(__waitLoop);
+
+       _INFO("bluetooth After waitloop");
+
+       if (__sAddr == NULL) {
+               _ERR("No supported device found");
+               g_main_loop_unref(__waitLoop);
+               __waitLoop = NULL;
+
+               __isDiscovering = false;
+               return NULL;
+       }
+
+       g_main_loop_unref(__waitLoop);
+       __waitLoop = NULL;
+       __isDiscovering = false;
+       __isConCbSet = false;
+
+       if (__stubCache != NULL) {
+               _INFO("bluetooth BT Roaming Auth Count=[%d]", __stubCache->size());
+       } else {
+               _ERR("bluetooth BT Roaming Auth List is NULL");
+               return NULL;
+       }
+
+       std::vector<IAuthStub*> *stubList = NULL;
+
+       std::map<int, IAuthStub*>::iterator it = __stubCache->begin();
+       for (; it != __stubCache->end(); ++it) {
+               if (stubList == NULL)
+                       stubList = new std::vector<IAuthStub*>();
+
+               stubList->push_back(it->second);
+       }
+       _INFO("bluetooth ");
+       return stubList;
+
+}
+
+void
+BtAdProvider::setCache(std::map<int, IAuthStub*> *stubCache)
+{
+       _INFO("bluetooth BleAdProvider::setCache");
+       if (stubCache != NULL)
+               _INFO("bluetooth New cache set size =[%d]", stubCache->size());
+
+       __stubCache = stubCache;
+}
+
+IAuthStub*
+BtAdProvider::getStubFromCache(int mappedIdx)
+{
+       if (__stubCache == NULL) {
+               _ERR("bluetooth Stub cache NULL");
+               return NULL;
+       }
+
+       return __stubCache->find(mappedIdx)->second;
+}
+
+BtAdProvider::~BtAdProvider(void)
+{
+
+}
+
+BtAdProvider::BtAdProvider(void)
+{
+
+}
+
+void
+BtAdProvider::finishDiscovery(gpointer data)
+{
+       _INFO("bluetooth ");
+
+       bt_socket_unset_connection_state_changed_cb();
+
+       BtAdProvider *btPro = (BtAdProvider*)(data);
+       btPro->__isConCbSet = false;
+       if (btPro->__isDiscovering == false)
+               return;
+
+       btPro->__isDiscovering = false;
+       g_main_loop_quit(btPro->__waitLoop);
+}
+
+gboolean
+BtAdProvider::discoverTimeOutCb(gpointer user_data)
+{
+       _INFO("bluetooth discoverTimeOutCb");
+
+       return G_SOURCE_REMOVE;
+}
diff --git a/server/auth_discovery/src/BtCon.cpp b/server/auth_discovery/src/BtCon.cpp
new file mode 100644 (file)
index 0000000..ee16be2
--- /dev/null
@@ -0,0 +1,354 @@
+
+#include "BtCon.h"
+#include "BTRoamingKeys.h"
+#include "RoamingKeys.h"
+#include "AsmHelper.h"
+#include <string.h>
+#include <stdio.h>
+
+/*
+#define printIfAndRet(e1, e2, str) \
+       if (e1 == e2) {\
+       _INFO("bluetooth fido asm bt error=[%s]", str);\
+       return; \
+       }\
+
+static void
+printBTError(bt_error_e e)
+{
+       printIfAndRet(e, BT_ERROR_NONE, "BT_ERROR_NONE");
+       printIfAndRet(e, BT_ERROR_CANCELLED, "BT_ERROR_CANCELLED");
+       printIfAndRet(e, BT_ERROR_INVALID_PARAMETER, "BT_ERROR_INVALID_PARAMETER");
+       printIfAndRet(e, BT_ERROR_OUT_OF_MEMORY, "BT_ERROR_OUT_OF_MEMORY");
+       printIfAndRet(e, BT_ERROR_RESOURCE_BUSY, "BT_ERROR_RESOURCE_BUSY");
+       printIfAndRet(e, BT_ERROR_TIMED_OUT, "BT_ERROR_TIMED_OUT");
+       printIfAndRet(e, BT_ERROR_NOW_IN_PROGRESS, "BT_ERROR_NOW_IN_PROGRESS");
+       printIfAndRet(e, BT_ERROR_NOT_SUPPORTED, "BT_ERROR_NOT_SUPPORTED");
+       printIfAndRet(e, BT_ERROR_PERMISSION_DENIED, "BT_ERROR_PERMISSION_DENIED");
+       printIfAndRet(e, BT_ERROR_QUOTA_EXCEEDED, "BT_ERROR_QUOTA_EXCEEDED");
+       printIfAndRet(e, BT_ERROR_NO_DATA, "BT_ERROR_NO_DATA");
+       printIfAndRet(e, BT_ERROR_DEVICE_POLICY_RESTRICTION, "BT_ERROR_DEVICE_POLICY_RESTRICTION");
+       printIfAndRet(e, BT_ERROR_NOT_INITIALIZED, "BT_ERROR_NOT_INITIALIZED");
+       printIfAndRet(e, BT_ERROR_NOT_ENABLED, "BT_ERROR_NOT_ENABLED");
+       printIfAndRet(e, BT_ERROR_ALREADY_DONE, "BT_ERROR_ALREADY_DONE");
+       printIfAndRet(e, BT_ERROR_ALREADY_DONE, "BT_ERROR_ALREADY_DONE");
+       printIfAndRet(e, BT_ERROR_OPERATION_FAILED, "BT_ERROR_OPERATION_FAILED");
+       printIfAndRet(e, BT_ERROR_NOT_IN_PROGRESS, "BT_ERROR_NOT_IN_PROGRESS");
+       printIfAndRet(e, BT_ERROR_REMOTE_DEVICE_NOT_BONDED, "BT_ERROR_REMOTE_DEVICE_NOT_BONDED");
+       printIfAndRet(e, BT_ERROR_AUTH_REJECTED, "BT_ERROR_AUTH_REJECTED");
+       printIfAndRet(e, BT_ERROR_AUTH_FAILED, "BT_ERROR_AUTH_FAILED");
+       printIfAndRet(e, BT_ERROR_REMOTE_DEVICE_NOT_FOUND, "BT_ERROR_REMOTE_DEVICE_NOT_FOUND");
+       printIfAndRet(e, BT_ERROR_SERVICE_SEARCH_FAILED, "BT_ERROR_SERVICE_SEARCH_FAILED");
+       printIfAndRet(e, BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED, "BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED");
+       printIfAndRet(e, BT_ERROR_AGAIN, "BT_ERROR_AGAIN");
+       printIfAndRet(e, BT_ERROR_SERVICE_NOT_FOUND, "BT_ERROR_SERVICE_NOT_FOUND");
+       printIfAndRet(e, e, "Unknown");
+}*/
+
+#define RA_LEN_DELIM ':'
+#define DELIM_LEN 2
+#define D_LEN_MAX_LEN 12
+
+static const std::string RA_LEN_DELIM_STR = ":";
+
+int
+BtCon::sendDataInternal(int sock_fd, char *data)
+{
+       if (data == NULL) {
+               _ERR("");
+               return -1;
+       }
+
+       int d_len = strlen(data);
+       int full_data_max_len = d_len + DELIM_LEN + D_LEN_MAX_LEN;
+       char *full_data = (char*)(calloc(full_data_max_len, sizeof(char)));
+
+       snprintf(full_data, full_data_max_len, "%d%s%s", d_len, RA_LEN_DELIM_STR.c_str(), data);
+
+       int full_data_len = strlen(full_data);
+       _INFO("Sending data of len=[%d]", full_data_len);
+
+       int ret = bt_socket_send_data(sock_fd, full_data, full_data_len);
+       _INFO("bt_socket_send_data=[%d]", ret);
+
+       return 0;
+}
+
+BtCon::BtCon(void)
+{
+       __activeTimerId = 0;
+}
+
+BtCon::~BtCon(void)
+{
+       if (__fullData != NULL)
+               free(__fullData);
+}
+
+int
+BtCon::init(void *handle)
+{
+       __sock = (bt_socket_connection_s *)handle;
+       return 0;
+}
+
+void
+BtCon::receiveFinshed(void)
+{
+       if (__fullData == NULL) {
+               _ERR("No response");
+               __activeTimerId = 0;
+               g_main_loop_quit(__waitLoop);
+               return;
+       }
+       if (__expDLen <= 0) {
+               _INFO("Ignoring timer since data received fully before timeout");
+               __activeTimerId = 0;
+               g_main_loop_quit(__waitLoop);
+               return;
+       }
+
+       __expDLen = 0;
+       __remDLen = 0;
+
+       __resp = new StringMap();
+
+       std::string k(RA_QUERY_KEY_RESPONSE);
+
+       char *fullDataString = (char*)calloc(__fullDataLen + 1, sizeof(char));
+       memcpy(fullDataString, __fullData, __fullDataLen);
+
+       std::string v(strdup(fullDataString));
+       _INFO("Total pack length = [%d]", __fullDataLen);
+       __resp->insert(std::make_pair(k, v));
+
+       __activeTimerId = 0;
+
+       g_main_loop_quit(__waitLoop);
+}
+
+void
+BtCon::timerExpired(gpointer data)
+{
+       _INFO("bluetooth ");
+       BtTimerInfo *timerInfo = (BtTimerInfo*)data;
+       if (timerInfo == NULL)
+               return;
+
+       BtCon *btCon = (BtCon*)timerInfo->__caller;
+       if (btCon == NULL)
+               return;
+
+       _INFO("timeout id=[%d], active id =[%d]", timerInfo->__timerId, btCon->__activeTimerId);
+
+       if (timerInfo->__timerId != btCon->__activeTimerId) {
+               _INFO("timeout ignored");
+               timerInfo->__caller = NULL;
+               delete timerInfo;
+               return;
+       }
+
+       btCon->__expDLen = 0;
+       btCon->__remDLen = 0;
+
+       btCon->__activeTimerId = 0;
+       timerInfo->__caller = NULL;
+       delete timerInfo;
+
+       g_main_loop_quit(btCon->__waitLoop);
+}
+
+gboolean
+BtCon::discoverTimeOutCb(gpointer user_data)
+{
+       _INFO("bluetooth discoverTimeOutCb");
+
+       return G_SOURCE_REMOVE;
+}
+
+void
+BtCon::onBtSockDataReceived(bt_socket_received_data_s *data, void *user_data)
+{
+       _INFO("Arrived pack length = [%d]", data->data_size);
+       BtCon *btCon = (BtCon*)user_data;
+       if (btCon->__fullData != NULL)
+               _INFO("Current pack length = [%d]", btCon->__fullDataLen);
+
+       _INFO("%s", data->data);
+
+       if (data->data_size <= 0) {
+               g_main_loop_quit(btCon->__waitLoop);
+               return;
+       }
+
+       /*Packets may arrive segmented, so use timer to get long data*/
+       char *pack = NULL;
+       int fullPackLen = 0;
+       int cur_pack_len = 0;
+
+       BtTimerInfo *timerInfo = NULL;
+
+       if (btCon->__fullData == NULL) {
+               timerInfo = new BtTimerInfo();
+               if (btCon->__activeTimerId > 1000)
+                       btCon->__activeTimerId = 0;
+               else
+                       btCon->__activeTimerId++;
+
+               timerInfo->__caller = btCon;
+               timerInfo->__timerId = btCon->__activeTimerId;
+               _INFO("bluetooth [%d] sec timeout starting", 6);
+               g_timeout_add_seconds_full(G_PRIORITY_DEFAULT, 6, discoverTimeOutCb, timerInfo,
+                                                               timerExpired);
+
+               int i = 0;
+
+               while (1) {
+
+                       if (data->data[i] == RA_LEN_DELIM)
+                               break;
+                       if ((i == data->data_size) || (data->data[i] == '\0')) {
+                               i = 0;
+                               break;
+                       }
+                       i++;
+               }
+
+               if (i <= 1) {
+                       _ERR("Missing :");
+                       btCon->receiveFinshed();
+                       return;
+               }
+
+               int d_first_frame_len = data->data_size - (i + 1);
+               if (d_first_frame_len <= 0) {
+                       _ERR("Empty data frame following :");
+                       btCon->receiveFinshed();
+                       return;
+               }
+
+               char *d_len_str = (char*)calloc(12, sizeof(char));
+               memcpy(d_len_str, data->data, i);
+               /*snprintf(d_len_str, i, "%s", data->data);*/
+
+               int d_len = 0;
+               sscanf(d_len_str, "%d", &d_len);
+               d_len_str[i] = '\0';
+               _INFO("[%s]", d_len_str);
+
+               _INFO("Data Len frame=[%d]", d_len);
+
+               btCon->__expDLen = d_len;
+
+               pack = (char*)calloc(d_first_frame_len + 1, sizeof(char));
+               char *data_pack = data->data;
+               data_pack += i + 1;
+               memcpy(pack, data_pack, d_first_frame_len);
+
+               btCon->__remDLen = btCon->__expDLen - d_first_frame_len;
+               cur_pack_len = d_first_frame_len;
+       } else {
+
+               pack = (char*)calloc(data->data_size, sizeof(char));
+               memcpy(pack, data->data, data->data_size);
+
+               btCon->__remDLen = btCon->__remDLen - data->data_size;
+               cur_pack_len = data->data_size;
+       }
+
+
+       if (btCon->__fullData != NULL)
+               fullPackLen = cur_pack_len + btCon->__fullDataLen;
+       else
+               fullPackLen = cur_pack_len;
+
+       char *fullPackNew = (char*)calloc(fullPackLen, sizeof(char));
+
+       if (btCon->__fullData != NULL)
+               memcpy(fullPackNew, btCon->__fullData, btCon->__fullDataLen);
+
+       memcpy(fullPackNew + btCon->__fullDataLen, pack, cur_pack_len);
+
+       btCon->__fullDataLen = fullPackLen;
+       if (btCon->__fullData != NULL)
+               free(btCon->__fullData);
+       btCon->__fullData = fullPackNew;
+
+       free(pack);
+
+       if (btCon->__remDLen <= 0) {
+               _INFO("Received all");
+               btCon->receiveFinshed();
+       }
+}
+
+StringMap*
+BtCon::sendReqSync(StringMap *reqData)
+{
+       _INFO("sendReqSync start");
+       __fullData = NULL;
+       __fullDataLen = 0;
+
+       RET_IF_FAIL(reqData != NULL, NULL);
+       RET_IF_FAIL(__sock != NULL, NULL);
+       RET_IF_FAIL(__sock->socket_fd != -1, NULL);
+
+       __resp = NULL;
+       std::string reqTlvB64 = (reqData->find(RA_QUERY_KEY_REQUEST)->second);
+       char *reqTlvB64Copy = strdup(reqTlvB64.c_str());
+
+       __waitLoop = g_main_loop_new(NULL, FALSE);
+
+       bt_socket_set_data_received_cb(onBtSockDataReceived, this);
+
+       int dLen = strlen(reqTlvB64Copy);
+       _INFO("Sock fd=%d", __sock->socket_fd);
+       _INFO("Data=%s", reqTlvB64Copy);
+       _INFO("Data len=%d", dLen);
+       /*TODO: Data format=> <Data Length>:<Actual Data>*/
+       int ret = sendDataInternal(__sock->socket_fd, reqTlvB64Copy);
+       //int ret = bt_socket_send_data(__sock->socket_fd, reqTlvB64Copy, dLen);
+       _INFO("bt_socket_send_data=[%d]", ret);
+       if (ret != 0) {
+               _INFO("incomplete transfer=[%d]", ret);
+               bt_socket_unset_data_received_cb();
+               _INFO("");
+               g_main_loop_unref(__waitLoop);
+               _INFO("");
+               return NULL;
+       }
+
+       g_main_loop_run(__waitLoop);
+
+       bt_socket_unset_data_received_cb();
+
+       g_main_loop_unref(__waitLoop);
+
+       if (__fullData != NULL) {
+               free(__fullData);
+               __fullData = NULL;
+       }
+       __fullDataLen = 0;
+
+       return __resp;
+}
+
+int
+BtCon::shutdown(void)
+{
+       _BEGIN;
+       RET_IF_FAIL(__sock != NULL, 0);
+       int ret = bt_socket_disconnect_rfcomm(__sock->socket_fd);
+       _INFO("bt_socket_disconnect_rfcomm=[%d]", ret);
+       _END;
+       return 0;
+}
+
+char*
+BtCon::getInfo(void)
+{
+       RET_IF_FAIL(__sock != NULL, NULL);
+
+       return __sock->remote_address;
+}
+
diff --git a/server/auth_discovery/src/IoTCon.cpp b/server/auth_discovery/src/IoTCon.cpp
new file mode 100644 (file)
index 0000000..b0c6c63
--- /dev/null
@@ -0,0 +1,113 @@
+
+#include "IoTCon.h"
+#include "AuthnrTypes.h"
+#include "AsmHelper.h"
+#include "RoamingKeys.h"
+
+IoTCon::IoTCon(void)
+{
+
+}
+
+IoTCon::~IoTCon(void)
+{
+
+}
+
+int
+IoTCon::init(void *handle)
+{
+       __iotClient = (iotcon_remote_resource_h)handle;
+
+       return 0;
+}
+
+void
+IoTCon::onResponsePut(iotcon_remote_resource_h resource, iotcon_error_e err,
+               iotcon_request_type_e request_type, iotcon_response_h response, void *user_data)
+{
+       _INFO("");
+
+       IoTCon *conn = (IoTCon*)user_data;
+       _INFO("onResponsePut [%p]", conn);
+
+       iotcon_representation_h repr = NULL;
+       iotcon_attributes_h state = NULL;
+
+       iotcon_response_get_representation(response, &repr);
+
+       iotcon_representation_get_attributes(repr, &state);
+
+       char *asm_resp = NULL;
+       iotcon_attributes_get_str(state, RA_QUERY_KEY_RESPONSE, &asm_resp);
+       if (asm_resp != NULL) {
+               _INFO("%s=%s", RA_QUERY_KEY_RESPONSE, asm_resp);
+
+               conn->__resp = new StringMap();
+               std::string k(RA_QUERY_KEY_RESPONSE);
+               std::string v(strdup(asm_resp));
+               conn->__resp->insert(std::make_pair(k, v));
+       } else {
+               _ERR("Failed to get %s", RA_QUERY_KEY_RESPONSE);
+               conn->__resp = NULL;
+       }
+
+       _INFO("Before g_main_loop_quit");
+       g_main_loop_quit(conn->__waitLoop);
+}
+
+StringMap *
+IoTCon::sendReqSync(StringMap *reqData)
+{
+       RET_IF_FAIL(reqData != NULL, NULL);
+
+       std::string reqTlvB64 = (reqData->find(RA_QUERY_KEY_REQUEST)->second);
+       std::string svrId = (reqData->find(RA_QUERY_KEY_SERVER_ID)->second);
+
+       iotcon_attributes_h attr = NULL;
+       iotcon_attributes_create(&attr);
+
+       char *reqTlvB64Copy = strdup(reqTlvB64.c_str());
+
+       iotcon_attributes_add_str(attr, RA_QUERY_KEY_REQUEST, reqTlvB64Copy);
+       iotcon_attributes_add_str(attr, RA_QUERY_KEY_SERVER_ID, _SAFE_DUP(svrId.c_str()));
+
+       iotcon_representation_h repr = NULL;
+       iotcon_representation_create(&repr);
+
+       iotcon_representation_set_attributes(repr, attr);
+
+
+       __waitLoop = g_main_loop_new(NULL, FALSE);
+       int ret = iotcon_remote_resource_put(__iotClient, repr, NULL, onResponsePut, this);
+       if (ret != IOTCON_ERROR_NONE) {
+               _ERR("iotcon_remote_resource_get failed");
+               return NULL;
+       }
+
+       _INFO("iotcon_remote_resource_get=[%d]", ret);
+       g_main_loop_run(__waitLoop);
+
+       _INFO("sendReqSync end");
+
+       return __resp;
+}
+
+char*
+IoTCon::getInfo(void)
+{
+       char *devId = NULL;
+       int ret = iotcon_remote_resource_get_device_id(__iotClient, &devId);
+       if (ret == IOTCON_ERROR_NONE && devId != NULL) {
+               _INFO("Device Id = [%s]", devId);
+               return devId;
+       }
+
+       return NULL;
+}
+
+int
+IoTCon::shutdown(void)
+{
+       return 0;
+}
diff --git a/server/auth_discovery/src/IotADProvider.cpp b/server/auth_discovery/src/IotADProvider.cpp
new file mode 100644 (file)
index 0000000..b23466a
--- /dev/null
@@ -0,0 +1,214 @@
+
+#include "IotADProvider.h"
+
+#include <iotcon.h>
+#include "IoTCon.h"
+#include "AsmHelper.h"
+#include "RAuthStub.h"
+#include "RoamingKeys.h"
+#include "AuthIndexHanlder.h"
+#include "RoamingUtil.h"
+
+#define EMPTY_STUB_LIST std::vector<IAuthStub*>()
+
+#define AUTH_INDEX_START 5
+
+void
+IotADProvider::finishDiscovery(gpointer data)
+{
+       _INFO("");
+       IotADProvider *rAuthManager = (IotADProvider*)(data);
+       g_main_loop_quit(rAuthManager->__waitLoop);
+}
+
+gboolean
+IotADProvider::discoverTimeOutCb(gpointer user_data)
+{
+       _INFO("discoverTimeOutCb");
+
+       return G_SOURCE_REMOVE;
+}
+
+bool
+IotADProvider::resourceFoundCb(iotcon_remote_resource_h resource, iotcon_error_e result,
+               void *user_data)
+{
+       _INFO("");
+
+       if (result != IOTCON_ERROR_NONE) {
+               _ERR("No remote resource found");
+               return false;
+               //return;
+       }
+
+       char *rDevId = NULL;
+       iotcon_remote_resource_get_device_id(resource, &rDevId);
+       if (rDevId == NULL) {
+               _ERR("iotcon_remote_resource_get_device_id failed");
+               return false;
+               //return;
+       }
+
+       char *rHostAddr = NULL;
+       iotcon_remote_resource_get_host_address(resource, &rHostAddr);
+       if (rHostAddr == NULL) {
+               _ERR("iotcon_remote_resource_get_host_address failed");
+               return false;
+               //return;
+       }
+
+       std::string p2pMacAddr = RoamingUtil::getP2PMACAddr();
+       std::string btMacAddr = RoamingUtil::getBTMACAddr();
+
+       _INFO("[%s][%s]", p2pMacAddr.c_str(), btMacAddr.c_str());
+       _INFO("[%s]", rDevId);
+       _INFO("[%s]", rHostAddr);
+
+       if (p2pMacAddr.empty() == false) {
+
+               if (strcmp(rDevId, p2pMacAddr.c_str()) == 0) {
+                       _INFO("Ignoring request from same device");
+                       return false;
+                       //return;
+               }
+
+       } else if (btMacAddr.empty() == false) {
+               if (strcmp(rDevId, btMacAddr.c_str()) == 0) {
+                       _INFO("Ignoring request from same device");
+                       return false;
+                       //return;
+               }
+       }
+
+       IotADProvider *radPro = (IotADProvider*)user_data;
+       _INFO("this=[%p]", radPro);
+
+       iotcon_remote_resource_h resourceClone = NULL;
+
+       _INFO("Before iotcon_remote_resource_clone");
+       int ret = iotcon_remote_resource_clone(resource, &resourceClone);
+       _INFO("After iotcon_remote_resource_clone");
+       if (ret != IOTCON_ERROR_NONE) {
+               _ERR("Failed to clone remote resource");
+               return false;
+               //return;
+       }
+
+       IAuthStub *stub = new RAuthStub();
+       IAuthConnection *conH = new IoTCon();
+       conH->init(resourceClone);
+       stub->initRemote(conH);
+
+       if (radPro->__stubCache == NULL) {
+               radPro->__stubCache = new std::map<int, IAuthStub*>();
+       }
+
+       /*Index auto incremented, set properly during setCache*/
+       radPro->__stubCache->insert(std::make_pair(radPro->__stubCache->size(), stub));
+
+       return true;
+}
+
+std::vector<IAuthStub*>*
+IotADProvider::getAuthStubList(void)
+{
+       delete __stubCache;
+       __stubCache = NULL;
+
+       __waitLoop = g_main_loop_new(NULL, FALSE);
+
+       g_timeout_add_seconds_full(G_PRIORITY_DEFAULT, 1, discoverTimeOutCb, this,
+                                                               finishDiscovery);
+
+
+       iotcon_query_h iotQ = NULL;
+       iotcon_query_create(&iotQ);
+
+       int ret = iotcon_query_set_resource_type(iotQ, RA_RESOURCE_TYPE);
+
+       ret = iotcon_find_resource(IOTCON_MULTICAST_ADDRESS, IOTCON_CONNECTIVITY_ALL,
+                       iotQ, resourceFoundCb, this);
+       if (IOTCON_ERROR_NONE != ret) {
+               _ERR("iotcon_find_resource failed");
+
+               return NULL;
+       }
+
+       g_main_loop_run(__waitLoop);
+
+       _INFO("After g_main_loop_run");
+
+       g_main_loop_unref(__waitLoop);
+       __waitLoop = NULL;
+
+       if (__stubCache != NULL) {
+               _INFO("Roaming Auth Count=[%d]", __stubCache->size());
+       } else {
+               _ERR("Roaming Auth List is NULL");
+               return NULL;
+       }
+
+       std::vector<IAuthStub*> *stubList = NULL;
+
+       std::map<int, IAuthStub*>::iterator it = __stubCache->begin();
+       for (; it != __stubCache->end(); ++it) {
+               if (stubList == NULL)
+                       stubList = new std::vector<IAuthStub*>();
+
+               stubList->push_back(it->second);
+       }
+       _INFO("");
+       return stubList;
+}
+
+void
+IotADProvider::setCache(std::map<int, IAuthStub*> *stubCache)
+{
+       _INFO("IotADProvider::setCache");
+       if (stubCache != NULL)
+               _INFO("New cache set size =[%d]", stubCache->size());
+
+       __stubCache = stubCache;
+}
+
+IAuthStub*
+IotADProvider::getStubFromCache(int mappedIdx)
+{
+       if (__stubCache == NULL) {
+               _ERR("Stub cache NULL");
+               return NULL;
+       }
+
+       return __stubCache->find(mappedIdx)->second;
+}
+
+IotADProvider::~IotADProvider(void)
+{
+       if (__isValidInst == true)
+               iotcon_deinitialize();
+}
+
+int
+IotADProvider::init(void)
+{
+       int ret = iotcon_initialize(RA_ACL_CLIENT);
+       if (IOTCON_ERROR_NONE != ret) {
+               __isValidInst = false;
+               return -1;
+       }
+
+       __isValidInst = true;
+       return 0;
+}
+
+auth_type_e
+IotADProvider::getType(void)
+{
+       return AUTH_TYPE_ROAMING;
+}
+
+IotADProvider::IotADProvider(void)
+       : __isValidInst(false)
+{
+       __stubCache = NULL;
+}
diff --git a/server/auth_discovery/src/RAuthStub.cpp b/server/auth_discovery/src/RAuthStub.cpp
new file mode 100644 (file)
index 0000000..c3bd402
--- /dev/null
@@ -0,0 +1,306 @@
+
+#include "RAuthStub.h"
+#include "AsmHelper.h"
+#include "RoamingKeys.h"
+#include "RoamingUtil.h"
+#include "TlvData.h"
+#include "AuthIndexHanlder.h"
+#include "AsmHelper.h"
+#include "asmcrypto.h"
+
+#include <string.h>
+#include <stdio.h>
+#include <openssl/sha.h>
+
+#define GET_INFO_TLV_B64 "ATQAAA=="
+#define BIG_SIZE 5000
+
+#define RA_RESOURCE_URI "/fido/auth/roaming/pin"
+#define RA_RESOURCE_TYPE "org.tizen.fidoauthroamingpin"
+
+#define RA_QUERY_KEY_REQUEST "ra_query_prcoess_tlv"
+#define RA_QUERY_KEY_SERVER_ID "ra_query_server_id"
+#define RA_QUERY_KEY_RESPONSE "ra_response"
+
+RAuthStub::RAuthStub(void)
+       : __cachedData(NULL)
+{
+       _INFO("RAuthStub creation");
+       __conH = NULL;
+}
+
+RAuthStub::~RAuthStub(void)
+{
+       _INFO("RAuthStub creation");
+       __cachedData = NULL;
+}
+
+int
+RAuthStub::initLocal(auth_plugin_handle_s *pluginH)
+{
+       return -1;
+}
+
+int
+RAuthStub::initRemote(IAuthConnection *conH)
+{
+       __conH = conH;
+       return 0;
+}
+
+auth_type_e
+RAuthStub::getType(void)
+{
+       return AUTH_TYPE_ROAMING;
+}
+
+GetAuthInfoResp*
+RAuthStub::getInfo(void)
+{
+       if (__cachedData != NULL)
+               return __cachedData;
+
+       /*TODO*/
+       char *getInfoB64Resp = NULL;
+       int ret = processTlv(GET_INFO_TLV_B64, &getInfoB64Resp);
+
+       if (ret != 0)
+               return NULL;
+
+       /*Base 64 Decode getInfoB64Resp*/
+       unsigned char *getInfoRaw = NULL;
+       int getInfoRawLen = 0;
+       ret = RoamingUtil::b64Decode(getInfoB64Resp, strlen(getInfoB64Resp), &getInfoRaw, &getInfoRawLen);
+       if (ret != 0 || getInfoRaw == NULL) {
+               _ERR("B64 decode failed");
+
+               SAFE_DELETE(getInfoB64Resp);
+
+               return NULL;
+       }
+
+       /*TLV decode*/
+       TlvEncodable<GetAuthInfoResp> encodable;
+       encodable.setEncoder(EID_UAFV1_GETINFO_RESP);
+       GetAuthInfoResp *getInfoResp = encodable.decode(getInfoRaw);
+       if (getInfoResp == NULL) {
+               _ERR("TLV decode failed");
+
+               free(getInfoB64Resp);
+               free(getInfoRaw);
+
+               return NULL;
+       }
+
+       /*Map AuthIndex to MappedIndex*/
+       if (getInfoResp->authList != NULL) {
+
+               GList *authListIter = g_list_first(getInfoResp->authList);
+               while (authListIter != NULL) {
+                       AuthenticatorInfo *authInfo = (AuthenticatorInfo*)(authListIter->data);
+
+                       char *devId = __conH->getInfo();
+
+                       std::string devIdStr(devId);
+                       std::string aaidStr(authInfo->__aaid);
+                       _INFO("To AuthIndexHandler");
+                       _INFO("[%s][%s][%d]", devIdStr.c_str(), aaidStr.c_str(),
+                                       authInfo->__authenticatorIndex);
+
+                       authInfo->__authenticatorIndex = AuthIndexHandler::getInstance()->getMappedIndex(
+                                               devIdStr, aaidStr,
+                                               authInfo->__authenticatorIndex);
+
+                       authInfo->__devId = devId;
+                       authInfo->__isUserEnrolled = FALSE;/*TODO*/
+                       authInfo->__isRoamingAuthenticator = TRUE;
+                       authListIter = authListIter->next;
+               }
+
+       }
+
+       getInfoResp->attach_hint = ATTACHMENT_HINT_EXTERNAL;
+
+       __cachedData = getInfoResp;
+
+       return __cachedData;
+}
+
+int
+RAuthStub::processTlv(const char *reqTlvB64, char **respTlvB64)
+{
+       RET_IF_FAIL(__conH != NULL, -1);
+
+       RET_IF_FAIL(reqTlvB64 != NULL, -1);
+
+       _INFO("");
+
+       StringMap *reqData = new StringMap();
+
+       std::string kR(RA_QUERY_KEY_REQUEST);
+       std::string vR(reqTlvB64);
+       reqData->insert(std::make_pair(kR, vR));
+
+       _INFO("");
+       std::string kS(RA_QUERY_KEY_SERVER_ID);
+       std::string vS(AsmCrypto::getAsmToken());
+       reqData->insert(std::make_pair(kS, vS));
+
+       _INFO("");
+       StringMap *respData = __conH->sendReqSync(reqData);
+
+       if (respData == NULL)
+               return -1;
+
+       _INFO("");
+       if (respData->find(RA_QUERY_KEY_RESPONSE) == respData->end())
+               return -1;
+
+       _INFO("processTlv end");
+
+       std::string respTlvStr = (respData->find(RA_QUERY_KEY_RESPONSE)->second);
+       *respTlvB64 = strdup(respTlvStr.c_str());
+
+       _INFO("");
+       return 0;
+}
+
+RegisterResp*
+RAuthStub::processRegister(const RegisterReq *regReq)
+{
+       RET_IF_FAIL(regReq != NULL, NULL);
+
+       _INFO("");
+       char *tlvReqB64 = RoamingUtil::composeAuthRegisterReq(regReq);
+       RET_IF_FAIL(tlvReqB64 != NULL, NULL);
+
+       _INFO("");
+       char *tlvRespB64 = NULL;
+       processTlv(tlvReqB64, &tlvRespB64);
+       RET_IF_FAIL(tlvRespB64 != NULL, NULL);
+
+       _INFO("");
+       unsigned char *tlvResp = NULL;
+       int tlvRespLen = 0;
+       _INFO("");
+       RoamingUtil::b64Decode(tlvRespB64, strlen(tlvRespB64), &tlvResp, &tlvRespLen);
+       RET_IF_FAIL(tlvResp != NULL, NULL);
+
+       _INFO("");
+       TlvEncodable<RegisterResp> encodable;
+       encodable.setEncoder(EID_UAFV1_REGISTER_RESP);
+       return (RegisterResp*)(encodable.decode(tlvResp));
+}
+
+AuthenticateResp*
+RAuthStub::processAuthenticate(const AuthenticateReq *authnReq)
+{
+       RET_IF_FAIL(authnReq != NULL, NULL);
+
+       char *tlvReqB64 = RoamingUtil::composeAuthSignReq(authnReq);
+       RET_IF_FAIL(tlvReqB64 != NULL, NULL);
+
+       char *tlvRespB64 = NULL;
+       processTlv(tlvReqB64, &tlvRespB64);
+       RET_IF_FAIL(tlvRespB64 != NULL, NULL);
+
+       unsigned char *tlvResp = NULL;
+       int tlvRespLen = 0;
+       RoamingUtil::b64Decode(tlvRespB64, strlen(tlvRespB64), &tlvResp, &tlvRespLen);
+       RET_IF_FAIL(tlvResp != NULL, NULL);
+
+       TlvEncodable<AuthenticateResp> encodable;
+       encodable.setEncoder(EID_UAFV1_SIGN_RESP);
+       return (AuthenticateResp*)(encodable.decode(tlvResp));
+}
+
+DeregResp*
+RAuthStub::processDeregister(const DeregReq *deregReq)
+{
+       _INFO("");
+
+       RET_IF_FAIL(deregReq != NULL, NULL);
+
+       char *tlvReqB64 = RoamingUtil::composeAuthDeregReq(deregReq);
+       _INFO("");
+       RET_IF_FAIL(tlvReqB64 != NULL, NULL);
+
+       _INFO("");
+       char *tlvRespB64 = NULL;
+       processTlv(tlvReqB64, &tlvRespB64);
+       RET_IF_FAIL(tlvRespB64 != NULL, NULL);
+
+       _INFO("");
+       unsigned char *tlvResp = NULL;
+       int tlvRespLen = 0;
+       RoamingUtil::b64Decode(tlvRespB64, strlen(tlvRespB64), &tlvResp, &tlvRespLen);
+       RET_IF_FAIL(tlvResp != NULL, NULL);
+
+       _INFO("");
+       TlvEncodable<DeregResp> encodable;
+       encodable.setEncoder(EID_UAFV1_DEREG_RESP);
+
+       _INFO("");
+       return (DeregResp*)(encodable.decode(tlvResp));
+}
+
+Buffer *
+RAuthStub::hash(const std::string& message)
+{
+       _BEGIN;
+
+       /*TODO: Default Hash, ignoring Roaming*/
+       unsigned char digest[5000];
+       AsmCrypto::genHash256(message.c_str(), strlen(message.c_str()), digest);
+       _INFO("AuthenrStub::hash::digest generated is [%s]", digest);
+
+       Buffer *hashInfo = ALLOC(Buffer);
+       hashInfo->len = SHA256_DIGEST_LENGTH;
+       hashInfo->data = NALLOC(BIG_SIZE, uint8_t);
+       memcpy(hashInfo->data, digest, SHA256_DIGEST_LENGTH);
+       //std::string digestStr((char*)digest, 5000);
+       _END;
+
+       return hashInfo;
+
+}
+
+Buffer*
+RAuthStub::encodeRegisterRespone(RegAssertion *regAssrt, char **assrt_scheme)
+{
+       RET_IF_FAIL(regAssrt != NULL, NULL);
+
+       TlvEncodable<RegAssertion> encodableRegAssrtn(regAssrt);
+       encodableRegAssrtn.setEncoder(EID_UAFV1_REG_ASSERTION_RESP);
+
+       *assrt_scheme = (char *)(calloc(1, 128));
+       snprintf(*assrt_scheme, 128 - 1, "%s", "UAFV1TLV");
+
+       return encodableRegAssrtn.encode();
+}
+
+Buffer*
+RAuthStub::encodeSignRespone(AuthAssertion *authAssertion, char **assrt_scheme)
+{
+       _BEGIN;
+       RET_IF_FAIL(authAssertion != NULL, NULL);
+
+       TlvEncodable<AuthAssertion> encodableSignAssrtn(authAssertion);
+       encodableSignAssrtn.setEncoder(EID_UAFV1_SIGN_ASSERTION_RESP);
+
+       *assrt_scheme = (char *)(calloc(1, 128));
+       snprintf(*assrt_scheme, 128 - 1, "%s", "UAFV1TLV");
+
+       _END;
+       return encodableSignAssrtn.encode();
+}
+
+void
+RAuthStub::shutDown(void)
+{
+       _BEGIN;
+       RET_IF_FAIL_VOID(__conH != NULL);
+
+       __conH->shutdown();
+       _END;
+}
diff --git a/server/auth_discovery/src/RoamingUtil.cpp b/server/auth_discovery/src/RoamingUtil.cpp
new file mode 100644 (file)
index 0000000..94e0227
--- /dev/null
@@ -0,0 +1,443 @@
+
+#include "RoamingUtil.h"
+#include "AsmHelper.h"
+#include "Tlv.h"
+#include "TlvData.h"
+#include "AsmRequest.h"
+#include "AsmResponse.h"
+#include "AuthnrTypes.h"
+
+#include <openssl/buffer.h>
+#include <openssl/sha.h>
+#include <openssl/evp.h>
+#include <openssl/bio.h>
+#include <openssl/err.h>
+#include <openssl/x509.h>
+
+#include <system_info.h>
+#include <system_settings.h>
+#include <bluetooth.h>
+#include <bluetooth_internal.h>
+#include <vconf.h>
+#include <net_connection.h>
+
+#define STRING_OP_TYPE_GET_INFO "GetInfo"
+#define STRING_OP_TYPE_REG "Register"
+#define STRING_OP_TYPE_AUTH "Authenticate"
+#define STRING_OP_TYPE_DEREG "Deregister"
+#define STRING_OP_TYPE_OPEN_SETTINGS "OpenSettings"
+#define STRING_OP_TYPE_GET_REGS "GetRegistrations"
+
+const std::string GET_INFO_TLV_B64 = "ATQAAA==";
+
+#define IC_FEATURE_OIC "http://tizen.org/feature/iot.oic"
+#define IC_FEATURE_OCF "http://tizen.org/feature/iot.ocf"
+
+#define MAC_ADDR_STR_LEN 18
+
+int
+RoamingUtil::b64Decode(const char *encoded_data, int encoded_size, unsigned char **decoded_data,
+                                          int *decoded_size)
+{
+       RET_IF_FAIL(encoded_data != NULL, -1);
+
+       int len = 0;
+       *decoded_size = encoded_size;
+
+       (*decoded_data) = (unsigned char *) calloc((*decoded_size) * 1.5, sizeof(char));
+
+       BIO *bmem = BIO_new_mem_buf((void *) encoded_data, (*decoded_size));
+
+       BIO *bioCmd = BIO_new(BIO_f_base64());
+
+       BIO_set_flags(bioCmd, BIO_FLAGS_BASE64_NO_NL);
+
+       bmem = BIO_push(bioCmd, bmem);
+
+       len = BIO_read(bmem, (void *) (*decoded_data), (*decoded_size));
+       _INFO("%d", len);
+
+       *decoded_size = len;
+
+       BIO_free_all(bmem);
+
+       _INFO("");
+
+       return 0;
+}
+
+char*
+RoamingUtil::b64Encode(unsigned char *input, int ip_len)
+{
+       RET_IF_FAIL(input != NULL, NULL);
+       RET_IF_FAIL(ip_len > 0, NULL);
+
+       unsigned char *output = (unsigned char*)calloc(ip_len * 1.5, sizeof(char));
+
+       BIO *bmem = NULL;
+       BIO *b64 = NULL;
+       BUF_MEM *bptr = NULL;
+       b64 = BIO_new(BIO_f_base64());
+       if (b64 == NULL) {
+               _ERR("BIO_new failed \n");
+               free(output);
+               return NULL;
+       }
+
+       BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
+
+       bmem = BIO_new(BIO_s_mem());
+       b64 = BIO_push(b64, bmem);
+       BIO_write(b64, input, ip_len);
+       BIO_flush(b64);
+       BIO_get_mem_ptr(b64, &bptr);
+
+       memcpy(output, bptr->data, bptr->length);
+       output[bptr->length] = 0;
+
+       if(b64)
+               BIO_free_all(b64);
+
+       return (char*)output;
+}
+
+AsmRequest*
+RoamingUtil::createAuthReq(const char *tlvB64)
+{
+
+       RET_IF_FAIL(tlvB64 != NULL, NULL);
+
+       unsigned char *tlvRaw = NULL;
+       int tlvRawLen = 0;
+       b64Decode(tlvB64, strlen(tlvB64), &tlvRaw, &tlvRawLen);
+
+       RET_IF_FAIL(tlvRaw != NULL, NULL);
+
+       tlv_s *tlv = tlv_decode(tlvRaw);
+       if (tlv == NULL) {
+               _ERR("");
+               free(tlvRaw);
+               return NULL;
+       }
+
+       AsmRequest *asmReq = new AsmRequest();
+
+       switch (tlv->tag) {
+
+       case TAG_UAFV1_GETINFO_CMD: {
+               _INFO("");
+               TlvEncodable<GetInfoReq> encodableReq;
+               encodableReq.setEncoder(EID_UAFV1_GETINFO_REQ);
+
+               asmReq->__customRequest = encodableReq.decode(tlvRaw);
+               asmReq->__requestType = STRING_OP_TYPE_GET_INFO;
+       }
+       break;
+
+       case TAG_UAFV1_REGISTER_CMD: {
+               _INFO("");
+               TlvEncodable<RegisterReq> encodableReq;
+               encodableReq.setEncoder(EID_UAFV1_REGISTER_REQ);
+
+               asmReq->__customRequest = encodableReq.decode(tlvRaw);
+               asmReq->__requestType = STRING_OP_TYPE_REG;
+       }
+       break;
+
+       case TAG_UAFV1_SIGN_CMD: {
+               _INFO("");
+               TlvEncodable<AuthenticateReq> encodableReq;
+               encodableReq.setEncoder(EID_UAFV1_SIGN_REQ);
+
+               asmReq->__customRequest = encodableReq.decode(tlvRaw);
+               asmReq->__requestType = STRING_OP_TYPE_AUTH;
+       }
+       break;
+
+       case TAG_UAFV1_DEREGISTER_CMD: {
+               _INFO("");
+               TlvEncodable<DeregReq> encodableReq;
+               encodableReq.setEncoder(EID_UAFV1_DEREG_REQ);
+
+               asmReq->__customRequest = encodableReq.decode(tlvRaw);
+               asmReq->__requestType = STRING_OP_TYPE_DEREG;
+       }
+       break;
+
+       default:
+               /*Rest are not supported for Roaming operations*/
+               _ERR("");
+               delete asmReq;
+               return NULL;
+
+       }
+
+       _INFO("");
+       return asmReq;
+}
+
+char *
+RoamingUtil::composeAuthGetInfoReq(void)
+{
+       return strdup(GET_INFO_TLV_B64.c_str());
+}
+
+char *
+RoamingUtil::composeAuthRegisterReq(const RegisterReq *req)
+{
+       _INFO("");
+       TlvEncodable<RegisterReq> encodable(req);
+       encodable.setEncoder(EID_UAFV1_REGISTER_REQ);
+
+       _INFO("");
+       Buffer *tlvBuff = encodable.encode();
+       RET_IF_FAIL(tlvBuff != NULL, NULL);
+
+       _INFO("");
+       return b64Encode(tlvBuff->data, tlvBuff->len);
+}
+
+char *
+RoamingUtil::composeAuthSignReq(const AuthenticateReq *req)
+{
+       TlvEncodable<AuthenticateReq> encodable(req);
+       encodable.setEncoder(EID_UAFV1_SIGN_REQ);
+
+       Buffer *tlvBuff = encodable.encode();
+       RET_IF_FAIL(tlvBuff != NULL, NULL);
+
+       return b64Encode(tlvBuff->data, tlvBuff->len);
+}
+
+char *
+RoamingUtil::composeAuthDeregReq(const DeregReq *req)
+{
+       TlvEncodable<DeregReq> encodable(req);
+       encodable.setEncoder(EID_UAFV1_DEREG_REQ);
+
+       Buffer *tlvBuff = encodable.encode();
+       RET_IF_FAIL(tlvBuff != NULL, NULL);
+
+       return b64Encode(tlvBuff->data, tlvBuff->len);
+}
+
+char*
+RoamingUtil::composeAuthGetInfoResponce(std::vector<GetAuthInfoResp*> *infoList)
+{
+       RET_IF_FAIL(infoList != NULL, NULL);
+
+       GetAuthInfoResp *respFull = (GetAuthInfoResp*)calloc(1, sizeof(GetAuthInfoResp));
+
+       _INFO("RoamingUtil compose 1");
+
+       /*GetInfo TLV resp from each stub*/
+       std::vector<GetAuthInfoResp*>::iterator infoListIter = infoList->begin();
+       for (; infoListIter != infoList->end(); ++infoListIter) {
+               GetAuthInfoResp *resp = (GetAuthInfoResp*)(*infoListIter);
+               /*Accumulates all authList from GetInfoResp list*/
+
+               _INFO("RoamingUtil compose 2");
+               if (resp->authList != NULL) {
+
+                       _INFO("RoamingUtil compose 3");
+                       GList *respAuthListIter = g_list_first(resp->authList);
+
+                       while (respAuthListIter != NULL) {
+
+                               _INFO("RoamingUtil compose 4");
+                               AuthenticatorInfo *authInfo = (AuthenticatorInfo*)(respAuthListIter->data);
+                               if (authInfo != NULL) {
+                                       authInfo->__isRoamingAuthenticator = TRUE;
+                                       respFull->authList = g_list_append(respFull->authList, authInfo);
+                                       _INFO("RoamingUtil compose 5");
+                               }
+
+                               respAuthListIter = respAuthListIter->next;
+                       }
+               }
+       }
+
+       if (respFull->authList == NULL || g_list_length(respFull->authList) <= 0) {
+               _INFO("RoamingUtil authList empty error");
+               respFull->statusCode = UAF_ASM_STATUS_ERROR;
+       } else {
+               respFull->statusCode = UAF_ASM_STATUS_OK;
+               respFull->authList = g_list_first(respFull->authList);
+               _INFO("RoamingUtil authList valid");
+       }
+
+       TlvEncodable<GetAuthInfoResp> encoderResp(respFull);
+       encoderResp.setEncoder(EID_UAFV1_GETINFO_RESP);
+       _INFO("RoamingUtil after TLV");
+
+       Buffer *getinfoRespBuff = encoderResp.encode();
+       _INFO("RoamingUtil after TLV encode");
+
+       /*B64 encode*/
+       return b64Encode(getinfoRespBuff->data, getinfoRespBuff->len);
+
+}
+
+char *
+RoamingUtil::composeAuthRegisterResponse(RegisterResp *regResp)
+{
+       RET_IF_FAIL(regResp != NULL, NULL);
+
+       TlvEncodable<RegisterResp> encoderResp(regResp);
+       encoderResp.setEncoder(EID_UAFV1_REGISTER_RESP);
+
+       Buffer *respBuff = encoderResp.encode();
+
+       /*B64 encode*/
+       return b64Encode(respBuff->data, respBuff->len);
+}
+
+char *
+RoamingUtil::composeAuthSignResponse(AuthenticateResp *authResp)
+{
+       RET_IF_FAIL(authResp != NULL, NULL);
+
+       TlvEncodable<AuthenticateResp> encoderResp(authResp);
+       encoderResp.setEncoder(EID_UAFV1_SIGN_RESP);
+
+       Buffer *respBuff = encoderResp.encode();
+
+       /*B64 encode*/
+       return b64Encode(respBuff->data, respBuff->len);
+}
+
+char *
+RoamingUtil::composeAuthDeregResponse(DeregResp *dResp)
+{
+       RET_IF_FAIL(dResp != NULL, NULL);
+
+       TlvEncodable<DeregResp> encoderResp(dResp);
+       encoderResp.setEncoder(EID_UAFV1_DEREG_RESP);
+
+       Buffer *respBuff = encoderResp.encode();
+
+       /*B64 encode*/
+       return b64Encode(respBuff->data, respBuff->len);
+}
+
+bool
+RoamingUtil::isRASupported(void)
+{
+       /*TODO: Define a macro in spec file to let the platform/profile SCM decide*/
+       return true;
+
+       /*bool raSupported = false;
+       system_info_get_platform_bool(IC_FEATURE_OIC, &raSupported);
+       if (raSupported == false)
+               system_info_get_platform_bool(IC_FEATURE_OCF, &raSupported);
+
+       return raSupported;*/
+}
+
+std::string
+RoamingUtil::getBTMACAddr(void)
+{
+       static std::string g_mac_address;
+       if(g_mac_address.empty() == true) {
+               bt_initialize();
+               char* mac_address = NULL;
+               bt_adapter_enable();
+               int ret = bt_adapter_get_address(&mac_address);
+               if (ret != 0) {
+                       _ERR("bt_adapter_get_address failed");
+                       return g_mac_address;
+               }
+
+               _INFO("bluetooth get mac address : %s", mac_address);
+               g_mac_address = mac_address;
+               free(mac_address);
+               bt_deinitialize();
+       }
+       _INFO("mac address:%s", g_mac_address.c_str());
+
+       return g_mac_address;
+}
+
+
+std::string
+RoamingUtil::getDevName(void)
+{
+       static std::string g_device_name;
+       if(g_device_name.empty()) {
+               char* device_name = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
+               if (device_name == NULL) {
+                       g_device_name = "Tizen";
+               } else {
+                       g_device_name = device_name;
+               }
+               _INFO("device_name: %s", g_device_name.c_str());
+       }
+
+       return g_device_name;
+}
+
+char
+RoamingUtil::makeP2PMAC(char c)
+{
+       char convert_c = c;
+       if ((convert_c >= 'A') && (convert_c <= 'F')) {
+               convert_c = ((((convert_c - 'A') + 10) | 0x02) - 10) + 'A';
+       } else if ((convert_c >= '0') && (convert_c <= '9')) {
+               convert_c = ((convert_c - '0') | 0x02);
+               if (convert_c < 10)
+                       convert_c = convert_c + '0';
+               else
+                       convert_c = 'A' + (convert_c - 10);
+       } else {
+               _ERR("wrong byte for mac!");
+       }
+       return convert_c;
+}
+
+std::string
+RoamingUtil::getP2PMACAddr(void)
+{
+       static std::string g_p2p_mac_address;
+       if(g_p2p_mac_address.empty()) {
+               char p2p_mac[MAC_ADDR_STR_LEN];
+               memset(p2p_mac, 0x0, MAC_ADDR_STR_LEN);
+
+               char* temp_addr = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS);
+               if (temp_addr == NULL) {
+                       _ERR("vconf_get_str Failed for %s", VCONFKEY_WIFI_BSSID_ADDRESS);
+               } else {
+                       memcpy(p2p_mac, temp_addr, MAC_ADDR_STR_LEN-1);
+                       p2p_mac[1] = makeP2PMAC(p2p_mac[1]);
+                       _INFO("P2P mac is %s", p2p_mac);
+                       free(temp_addr);
+
+                       g_p2p_mac_address = p2p_mac;
+               }
+       }
+       _INFO("p2p mac address:%s", g_p2p_mac_address.c_str());
+       return g_p2p_mac_address;
+}
+
+char*
+RoamingUtil::getServerId(void)
+{
+       connection_h conn = NULL;
+       connection_create(&conn);
+
+       static char *mac = NULL;
+       if (mac != NULL)
+               return mac;
+
+       /*Try: Ethernet*/
+       int ret = connection_get_mac_address(conn, CONNECTION_TYPE_ETHERNET, &mac);
+
+       /*Try: Wifi*/
+       if (ret != CONNECTION_ERROR_NONE)
+               ret = connection_get_mac_address(conn, CONNECTION_TYPE_WIFI, &mac);
+
+       /*Try: BT*/
+       if (ret != CONNECTION_ERROR_NONE)
+               ret = connection_get_mac_address(conn, CONNECTION_TYPE_BT, &mac);
+
+       return mac;
+}
diff --git a/server/fido_asm.json b/server/fido_asm.json
new file mode 100644 (file)
index 0000000..57e9a11
--- /dev/null
@@ -0,0 +1,8 @@
+{
+       "vendor" : "FIDO Reference ASM",
+       "bin_path" : "/usr/bin/fido-asm",
+       "dbus_info" : "org.tizen.fidoasm",
+       "dbus_obj_path" : "/org/tizen/fidoasm",
+       "dbus_interface_name" : "org.tizen.fidoasm",
+       "dbus_method_name" : "asm_request"
+}
diff --git a/server/inc/AsmStorage.h b/server/inc/AsmStorage.h
new file mode 100644 (file)
index 0000000..2eeefb9
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2014 - 2015 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 ASMSTORAGE_H_
+#define ASMSTORAGE_H_
+
+#include <tizen.h>
+#include <string>
+#include <vector>
+#include <sqlite3.h>
+
+typedef enum {
+       INT_PROP_ID = 0,
+       INT_PROP_AUTH_IDX,
+       INT_PROP_AUTH_ID,
+       INT_PROP_UID,
+       INT_PROP_MAPPED_AUTH_ID
+} IntProperty;
+
+typedef enum {
+       STR_PROP_CALLER_ID = INT_PROP_MAPPED_AUTH_ID + 1,
+       STR_PROP_APP_ID,
+       STR_PROP_KEY_HANDLE,
+       STR_PROP_KEY_ID,
+       STR_PROP_TIME,
+       STR_PROP_DEV_ID,
+       STR_PROP_AAID,
+       STR_PROP_SECRET1,
+       STR_PROP_SECRET2
+} StringProperty;
+
+class IStorageParcel {
+
+public:
+
+       IStorageParcel(void){}
+       virtual ~IStorageParcel(void){}
+
+       virtual int setInt(IntProperty prop, int val) = 0;
+       virtual int setString(StringProperty prop, const std::string& val) = 0;
+
+       virtual int getInt(IntProperty prop, int *val) = 0;
+       virtual int getString(StringProperty prop, char **val) = 0;
+
+       virtual std::string getDBName(void) = 0;
+};
+
+class AsmStorageParcel : public IStorageParcel {
+
+public:
+
+       AsmStorageParcel(void);
+       virtual ~AsmStorageParcel(void){}
+
+       int setInt(IntProperty prop, int val);
+       int setString(StringProperty prop, const std::string& val);
+
+       int getInt(IntProperty prop, int *val);
+       int getString(StringProperty prop, char **val);
+
+       std::string getDBName(void);
+
+private:
+
+       int __id;
+       int __authIdx;
+       std::string __callerId;
+       std::string __appId;
+       std::string __keyHandle;
+       std::string __keyId;
+       std::string __ts;
+       std::string __dbName;
+};
+
+class AuthStorageParcel : public IStorageParcel {
+
+public:
+
+       AuthStorageParcel(void);
+       virtual ~AuthStorageParcel(void){}
+
+       int setInt(IntProperty prop, int val);
+       int setString(StringProperty prop, const std::string& val);
+
+       int getInt(IntProperty prop, int *val);
+       int getString(StringProperty prop, char **val);
+
+       std::string getDBName(void);
+
+private:
+
+       int __id;
+       std::string __devId;
+       std::string __aaid;
+       int __authIndex;
+       int __mappedIndex;
+       std::string __dbName;
+};
+
+class SecretStorageParcel : public IStorageParcel {
+
+public :
+
+       SecretStorageParcel(void);
+       virtual ~SecretStorageParcel(void){}
+
+       int setInt(IntProperty prop, int val);
+       int setString(StringProperty prop, const std::string& val);
+
+       int getInt(IntProperty prop, int *val);
+       int getString(StringProperty prop, char **val);
+
+       std::string getDBName(void);
+
+private :
+
+       int __id;
+       std::string __aaid;
+       std::string __devId;
+       int __uid;
+       std::string __secret1; /*pin*/
+       std::string __secret2; /*For future use*/
+       std::string __dbName;
+};
+
+typedef struct _SearchCbData {
+       char *dbName;
+       std::vector<IStorageParcel*> *resList;
+} SearchCbData;
+
+class AsmStorage {
+public:
+
+       static AsmStorage* getInstance(void);
+
+       int insertData(IStorageParcel *parcel);
+       int insertBulkData(std::vector<IStorageParcel*> *parcel);
+
+       std::vector<IStorageParcel*> *searchData(IStorageParcel *searchParcel);
+
+       int deleteData(IStorageParcel *parcel);
+       int deleteAllData(const std::string& dbName);
+
+private:
+       AsmStorage(void);
+
+       sqlite3* createIfNotExists(const std::string& dbName);
+
+       static int searchItemCb(void *data, int argc, char **argv, char **azCollName);
+       static int maxMappedIndexCb(void *data, int argc, char **argv, char **azCollName);
+       sqlite3* openDBHandle(const std::string &dbNameBase);
+       void closeDBHandle(sqlite3 *dbH);
+
+private:
+
+       /*sqlite3* __asmDb;
+       sqlite3* __authDb;
+       sqlite3* __secretDb;*/
+       static AsmStorage* __this;
+};
+
+#endif /* ASMSTORAGE_H_ */
diff --git a/server/inc/ClientListener.h b/server/inc/ClientListener.h
new file mode 100644 (file)
index 0000000..64fd052
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2014 - 2015 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 CLIENTLISTENER_H_
+#define CLIENTLISTENER_H_
+
+#include <tizen.h>
+#include <glib.h>
+#include <gio/gio.h>
+#include <string>
+#include "fido-client-ipc-stub.h"
+
+class ClientListner {
+
+public:
+       static ClientListner* getInstance(void);
+       int start(void);
+
+private:
+       ClientListner(void);
+       ~ClientListner(void);
+
+       void initialize(void);
+       bool initDbus(void);
+
+       static int readProc(const char *path, char *buf, int size);
+       static std::string getCallerId(GDBusMethodInvocation *invocation);
+
+       static void onBusAcquired(GDBusConnection *connection, const gchar *name,
+                                                gpointer user_data);
+
+       static void onNameAcquired(GDBusConnection *connection, const gchar *name,
+                                                          gpointer user_data);
+
+       static void onNameLost(GDBusConnection *connection, const gchar *name,
+                                                  gpointer user_data);
+
+       static gboolean onClientRequest(Fidoasm *object, GDBusMethodInvocation *invocation,
+                                                  const gchar *asmReqJson);
+
+       static gboolean onAgentRequest(Fidoasm *object, GDBusMethodInvocation *invocation,
+                                                  const gchar *tlvReqB64);
+
+       static gboolean onTCUiResponse(Fidoasm *object, GDBusMethodInvocation *invocation,
+                                                  const gchar *nonce, int result);
+
+       static gboolean onAccountUiResponse(Fidoasm *object, GDBusMethodInvocation *invocation,
+                                                  const gchar *nonce, int result, const gchar *account);
+
+       static gboolean onAuthUiResponse(Fidoasm *object, GDBusMethodInvocation *invocation,
+                                                  int uiType, const gchar *nonce, int error,
+                                                                       const gchar *token);
+
+private:
+       static ClientListner *__this;
+       static guint __ownerId;
+       static Fidoasm* __dbusObj;
+};
+
+
+
+#endif /* CLIENTLISTENER_H_ */
diff --git a/server/ops/inc/AsmOp.h b/server/ops/inc/AsmOp.h
new file mode 100644 (file)
index 0000000..83f9bc2
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014 - 2015 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 ASMOP_H_
+#define ASMOP_H_
+
+#include <tizen.h>
+#include <vector>
+#include <queue>
+#include "AsmOpFactory.h"
+#include "IAuthStub.h"
+
+class AsmRequest;
+class AsmResponse;
+
+class AsmOp {
+
+public:
+       virtual ~AsmOp(void);
+       virtual char* execute(void);
+
+protected:
+       AsmOp(void);
+
+protected:
+       AsmRequest *__req;
+       AsmResponse *__resp;
+       IAuthStub *__authStub;
+       //std::queue<AsmOpState*> *__states;
+
+       friend class AsmOpFactory;
+
+private:
+       std::string getAsmToken(void);
+};
+
+
+#endif /* ASMOP_H_ */
diff --git a/server/ops/inc/AsmOpFactory.h b/server/ops/inc/AsmOpFactory.h
new file mode 100644 (file)
index 0000000..951cc6f
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2014 - 2015 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 ASMOPFACTORY_H_
+#define ASMOPFACTORY_H_
+
+#include "AsmRequest.h"
+
+class AsmOp;
+
+class AsmOpFactory {
+public:
+       static AsmOp* createOperation(AsmRequest *asmReq);
+
+private:
+       AsmOpFactory(void);
+       ~AsmOpFactory(void);
+};
+
+
+
+#endif /* ASMOPFACTORY_H_ */
diff --git a/server/ops/inc/AuthenticateOp.h b/server/ops/inc/AuthenticateOp.h
new file mode 100644 (file)
index 0000000..5528b87
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014 - 2015 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 AUTHENTICATEOP_H_
+#define AUTHENTICATEOP_H_
+
+#include "AsmOp.h"
+#include "AsmOpFactory.h"
+
+class AuthenticateOp : public AsmOp {
+public:
+       virtual char* execute(void);
+       ~AuthenticateOp(void);
+
+private:
+       AuthenticateOp(void){}
+       friend class AsmOpFactory;
+};
+
+#endif /* AUTHENTICATEOP_H_ */
diff --git a/server/ops/inc/DeregOp.h b/server/ops/inc/DeregOp.h
new file mode 100644 (file)
index 0000000..ef97567
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014 - 2015 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 DEREGOP_H_
+#define DEREGOP_H_
+
+#include "AsmOp.h"
+#include "AsmOpFactory.h"
+
+class DeregOp : public AsmOp {
+
+public:
+       ~DeregOp(void);
+       virtual char* execute(void);
+
+private:
+       DeregOp(void){}
+       friend class AsmOpFactory;
+};
+
+
+
+
+#endif /* DEREGOP_H_ */
diff --git a/server/ops/inc/GetInfoOp.h b/server/ops/inc/GetInfoOp.h
new file mode 100644 (file)
index 0000000..60eaef9
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014 - 2015 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 GETINFOOP_H_
+#define GETINFOOP_H_
+
+#include "AsmOp.h"
+#include "AsmOpFactory.h"
+
+class GetInfoOp : public AsmOp {
+
+public:
+       ~GetInfoOp(void);
+
+       virtual char* execute(void);
+
+private:
+       GetInfoOp(void);
+       friend class AsmOpFactory;
+};
+
+
+
+#endif /* GETINFOOP_H_ */
diff --git a/server/ops/inc/GetRegsOp.h b/server/ops/inc/GetRegsOp.h
new file mode 100644 (file)
index 0000000..fb48bdc
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014 - 2015 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 GETREGSOP_H_
+#define GETREGSOP_H_
+
+
+#include "AsmOp.h"
+#include "AsmOpFactory.h"
+
+class GetRegsOp : public AsmOp {
+
+public:
+       ~GetRegsOp(void);
+       virtual char* execute(void);
+
+private:
+       GetRegsOp(void){}
+       friend class AsmOpFactory;
+};
+
+
+#endif /* GETREGSOP_H_ */
diff --git a/server/ops/inc/OpenSettingOp.h b/server/ops/inc/OpenSettingOp.h
new file mode 100644 (file)
index 0000000..73029df
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014 - 2015 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 OPENSETTINGOP_H_
+#define OPENSETTINGOP_H_
+
+#include "AsmOp.h"
+#include "AsmOpFactory.h"
+
+class OpenSettingOp : public AsmOp {
+
+public:
+       ~OpenSettingOp(void);
+       virtual char* execute(void);
+
+private:
+       OpenSettingOp(void){}
+       friend class AsmOpFactory;
+};
+
+#endif /* OPENSETTINGOP_H_ */
diff --git a/server/ops/inc/RegisterOp.h b/server/ops/inc/RegisterOp.h
new file mode 100644 (file)
index 0000000..1028c59
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014 - 2015 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 REGISTEROP_H_
+#define REGISTEROP_H_
+
+#include "AsmOp.h"
+#include "AsmOpFactory.h"
+#include <vector>
+
+class RegisterOp : public AsmOp {
+
+public:
+       ~RegisterOp(void);
+       virtual char* execute(void);
+
+private:
+       RegisterOp(void){}
+
+       int initStates(void);
+       friend class AsmOpFactory;
+
+
+};
+
+
+#endif /* REGISTEROP_H_ */
diff --git a/server/ops/src/AsmOp.cpp b/server/ops/src/AsmOp.cpp
new file mode 100644 (file)
index 0000000..2c9ed8f
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AsmOp.h"
+
+char*
+AsmOp::execute(void)
+{
+       return NULL;
+}
+
+AsmOp::AsmOp(void)
+{
+
+}
+
+AsmOp::~AsmOp(void)
+{
+
+}
+
+
+
diff --git a/server/ops/src/AsmOpFactory.cpp b/server/ops/src/AsmOpFactory.cpp
new file mode 100644 (file)
index 0000000..ac2a13f
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2014 - 2015 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 <string>
+
+#include "AsmOpFactory.h"
+#include "AuthManager.h"
+#include "AsmOp.h"
+#include "AsmHelper.h"
+#include "GetInfoOp.h"
+#include "RegisterOp.h"
+#include "AuthenticateOp.h"
+#include "GetRegsOp.h"
+#include "OpenSettingOp.h"
+#include "DeregOp.h"
+#include "AsmHelper.h"
+
+#define STRING_OP_TYPE_GET_INFO "GetInfo"
+#define STRING_OP_TYPE_REG "Register"
+#define STRING_OP_TYPE_AUTH "Authenticate"
+#define STRING_OP_TYPE_DEREG "Deregister"
+#define STRING_OP_TYPE_OPEN_SETTINGS "OpenSettings"
+#define STRING_OP_TYPE_GET_REGS "GetRegistrations"
+
+AsmOp*
+AsmOpFactory::createOperation(AsmRequest *req)
+{
+       _BEGIN;
+
+       RET_IF_FAIL(req != NULL, NULL);
+       _INFO("request is no NULL");
+       RET_IF_FAIL(req->getRequesttype().empty() == false, NULL);
+       std::string reqType = req->getRequesttype();
+       _INFO("requestType is [%s]", reqType.c_str());
+
+       AsmOp *op = NULL;
+
+       if (strcmp(req->getRequesttype().c_str(), STRING_OP_TYPE_GET_INFO) == 0)
+               op = new GetInfoOp();
+       else if (strcmp(req->getRequesttype().c_str(), STRING_OP_TYPE_REG) == 0)
+               op = new RegisterOp();
+       else if (strcmp(req->getRequesttype().c_str(), STRING_OP_TYPE_AUTH) == 0)
+               op = new AuthenticateOp();
+       else if (strcmp(req->getRequesttype().c_str(), STRING_OP_TYPE_DEREG) == 0)
+               op = new DeregOp();
+       else if (strcmp(req->getRequesttype().c_str(), STRING_OP_TYPE_OPEN_SETTINGS) == 0)
+               op = new OpenSettingOp();
+       else if (strcmp(req->getRequesttype().c_str(), STRING_OP_TYPE_GET_REGS) == 0)
+               op = new GetRegsOp();
+
+       else
+               return NULL;
+
+       if(op != NULL)
+               _INFO("op successfully created");
+
+       /*GetInfo does not need stub, because it needs to communicate with all*/
+       if (strcmp(req->getRequesttype().c_str(), STRING_OP_TYPE_GET_INFO) != 0) {
+
+               op->__authStub = NULL;
+               int mappedIndex = -1;
+               if (req->getCustomRequest() == NULL) {
+                       mappedIndex = req->getAuthIndex();
+               } else {
+                       if (strcmp(req->getRequesttype().c_str(), STRING_OP_TYPE_REG) == 0) {
+                               RegisterReq *regAuthReq = (RegisterReq*)req->getCustomRequest();
+                               mappedIndex = regAuthReq->authIdx;
+                       }
+                       if (strcmp(req->getRequesttype().c_str(), STRING_OP_TYPE_AUTH) == 0) {
+                               AuthenticateReq *authAuthReq = (AuthenticateReq*)req->getCustomRequest();
+                               mappedIndex = authAuthReq->authIdx;
+                       }
+                       if (strcmp(req->getRequesttype().c_str(), STRING_OP_TYPE_DEREG) == 0) {
+                               DeregReq *dAuthReq = (DeregReq*)req->getCustomRequest();
+                               mappedIndex = dAuthReq->authIdx;
+                       }
+               }
+
+               _INFO("Input mapped index = [%d]", mappedIndex);
+
+
+               IAuthStub *stub = AuthManager::getInstance()->getAuthStub(mappedIndex);
+               if (stub == NULL) {
+                       _ERR("Could not find stub for [%d]", mappedIndex);
+                       delete op;
+                       return NULL;
+               }
+               _INFO("Stub = [%p]", stub);
+               op->__authStub = stub;
+       }
+
+       op->__req = req;
+
+       _END;
+
+       return op;
+}
diff --git a/server/ops/src/AuthenticateOp.cpp b/server/ops/src/AuthenticateOp.cpp
new file mode 100644 (file)
index 0000000..a4528be
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AuthenticateOp.h"
+#include "AsmHelper.h"
+#include "InitState.h"
+#include "EnrollState.h"
+#include "VerifyState.h"
+#include "TCState.h"
+#include "AuthenticateState.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include "IAuthStub.h"
+#include <vector>
+
+AuthenticateOp::~AuthenticateOp(void)
+{
+       /*TODO*/
+}
+
+char *
+AuthenticateOp::execute(void)
+{
+       _BEGIN;
+       RET_IF_FAIL(__authStub != NULL, NULL);
+
+       InitState *inState = new InitState();
+       VerifyState *vState = new VerifyState();
+       TCState *tcState = new TCState();
+       AuthenticateState *authState = new AuthenticateState();
+
+       char *authReqStr = (char *)calloc(1, 128);
+       snprintf(authReqStr, 128 - 1, "%s", "authentication");
+
+       char *resJson = NULL;
+       char *vToken = NULL;
+
+       int err = inState->handle(__authStub, NULL, NULL, NULL);
+       _INFO("[%d]", err);
+       CATCH_IF_FAIL(err == 0);
+
+       err = vState->handle(__authStub, __req, authReqStr, &vToken);
+       _INFO("[%d]", err);
+       CATCH_IF_FAIL(err == 0);
+
+       err = tcState->handle(__authStub, __req, NULL, NULL);
+       _INFO("[%d]", err);
+       CATCH_IF_FAIL(err == 0);
+
+       err = authState->handle(__authStub, __req, vToken, &resJson);
+       _INFO("[%d]", err);
+       CATCH_IF_FAIL(err == 0);
+
+
+       delete inState;
+       delete vState;
+       delete tcState;
+       delete authState;
+       SAFE_DELETE(authReqStr);
+
+
+       _END;
+       return resJson;
+
+CATCH:
+       SAFE_DELETE(authReqStr);
+       delete inState;
+       delete vState;
+       delete tcState;
+       delete authState;
+
+       _INFO("AuthenticateOp::execute::NULL");
+       _END;
+       return NULL;
+}
diff --git a/server/ops/src/DeregOp.cpp b/server/ops/src/DeregOp.cpp
new file mode 100644 (file)
index 0000000..77a7ce4
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "DeregOp.h"
+#include "InitState.h"
+#include "DeregState.h"
+#include "AsmHelper.h"
+
+DeregOp::~DeregOp(void)
+{
+       /*TODO*/
+}
+
+char *
+DeregOp::execute(void)
+{
+       _INFO("");
+       RET_IF_FAIL(__authStub != NULL, NULL);
+
+       InitState *inState = new InitState();
+       DeregState *deRegState = new DeregState();
+
+       char *resJson = NULL;
+
+       int err = inState->handle(__authStub, NULL, NULL, NULL);
+       CATCH_IF_FAIL(err == 0);
+
+       _INFO("");
+       err = deRegState->handle(__authStub, __req, NULL, &resJson);
+       CATCH_IF_FAIL(err == 0);
+
+       _INFO("");
+       delete inState;
+       delete deRegState;
+
+       return resJson;
+
+CATCH:
+       delete inState;
+       delete deRegState;
+
+       return NULL;
+}
diff --git a/server/ops/src/GetInfoOp.cpp b/server/ops/src/GetInfoOp.cpp
new file mode 100644 (file)
index 0000000..0125a00
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "GetInfoOp.h"
+#include "AsmHelper.h"
+#include "AuthManager.h"
+#include "JsonUtil.h"
+#include "RoamingUtil.h"
+#include "GetInfoResponse.h"
+#include "AuthIndexHanlder.h"
+#include "AuthnrTypes.h"
+
+#include <vector>
+
+GetInfoOp::GetInfoOp(void)
+{
+       _INFO("");
+}
+
+GetInfoOp::~GetInfoOp(void)
+{
+       /*TODO*/
+       _INFO("");
+}
+
+char*
+GetInfoOp::execute(void)
+{
+       _INFO("");
+       RET_IF_FAIL(AuthManager::getInstance() != NULL, NULL);
+
+       /*Request is From FIDO Client: Return Roaming + Bound Info, as JSON*/
+       if (__req->getCustomRequest() == NULL) {
+               std::vector<IAuthStub*> *authList = AuthManager::getInstance()->
+                               getAuthStubList(AUTH_TYPE_ALL);
+
+               _INFO("");
+
+               /*MappedIndex - AuthStub(with cached getinfo response)*/
+               std::map<int, IAuthStub*> *stubMapB = NULL;
+               std::map<int, IAuthStub*> *stubMapR = NULL;
+               std::vector<GetAuthInfoResp*> *getInfoList = NULL;
+
+               uaf_asm_status_e status = UAF_ASM_STATUS_OK;
+               if (authList == NULL) {
+                       status = UAF_ASM_STATUS_ERROR;
+               } else {
+                       stubMapB = new std::map<int, IAuthStub*>();
+                       stubMapR = new std::map<int, IAuthStub*>();
+
+                       getInfoList = new std::vector<GetAuthInfoResp*>();
+
+                       _INFO("Setting up cache in Client");
+                       std::vector<IAuthStub*>::iterator authStubIter = authList->begin();
+                       for (; authStubIter != authList->end(); ++authStubIter) {
+                               IAuthStub *stub = *authStubIter;
+                               /*This call caches the response inside stub*/
+                               GetAuthInfoResp *getInfo = stub->getInfo();
+                               GList *aListOfStub = getInfo->authList;
+                               if ((getInfo != NULL) && (aListOfStub != NULL)) {
+
+                                       while (aListOfStub != NULL) {
+
+                                               AuthenticatorInfo *authInfo = (AuthenticatorInfo*)(aListOfStub->data);
+
+                                               //std::string devIdStr(authInfo->__devId);
+                                               //std::string aaidStr(authInfo->__aaid);
+
+                                               int realIndex = authInfo->__authenticatorIndex;
+
+                                               int mappedIndex = realIndex;/*AuthIndexHandler::getInstance()->
+                                                               getMappedIndex(devIdStr, aaidStr, realIndex);*/
+
+                                               if (stub->getType() == AUTH_TYPE_BOUND) {
+                                                       stubMapB->insert(std::make_pair(mappedIndex, stub));
+                                                       _INFO("[%d][%p] Added to Bound cache", mappedIndex, stub);
+                                               } else {
+                                                       stubMapR->insert(std::make_pair(mappedIndex, stub));
+                                                       _INFO("[%d][%p] Added to Roaming cache", mappedIndex, stub);
+                                               }
+
+                                               aListOfStub = aListOfStub->next;
+                                       }
+                                       getInfoList->push_back(getInfo);
+                               }
+                       }
+
+                       if ((stubMapB != NULL) && (stubMapB->size() > 0)) {
+                               AuthManager::getInstance()->setAuthStubCache(AUTH_TYPE_BOUND, stubMapB);
+                       }
+                       if ((stubMapR != NULL) && (stubMapR->size() > 0)) {
+                               AuthManager::getInstance()->setAuthStubCache(AUTH_TYPE_ROAMING, stubMapR);
+                       }
+
+               }
+
+               _INFO("Cache done");
+
+               /*json response*/
+               return JsonUtil::composeAsmGetInfoResponse(status, getInfoList);
+       } else {
+               /*Request is From Roaming Agent: Return Bound Info, as B64Encode(TLV)*/
+               std::vector<IAuthStub*> *authList = AuthManager::getInstance()->getAuthStubList(AUTH_TYPE_BOUND);
+
+               std::map<int, IAuthStub*> *stubMapB = NULL;
+               std::vector<GetAuthInfoResp*> *getInfoList = NULL;
+
+               stubMapB = new std::map<int, IAuthStub*>();
+               getInfoList = new std::vector<GetAuthInfoResp*>();
+
+               _INFO("Setting up cache in Server");
+               std::vector<IAuthStub*>::iterator authStubIter = authList->begin();
+               for (; authStubIter != authList->end(); ++authStubIter) {
+                       IAuthStub *stub = *authStubIter;
+                       /*This call caches the response inside stub*/
+                       GetAuthInfoResp *getInfo = stub->getInfo();
+                       if (getInfo == NULL) {
+                               _ERR("getInfo NULL!!");
+                               return NULL;
+                       }
+                       GList *aListOfStub = getInfo->authList;
+                       if (aListOfStub != NULL) {
+
+                               while (aListOfStub != NULL) {
+
+                                       AuthenticatorInfo *authInfo = (AuthenticatorInfo*)(aListOfStub->data);
+
+//                                     std::string devIdStr(authInfo->__devId);
+//                                     std::string aaidStr(authInfo->__aaid);
+
+//                                     int realIndex = authInfo->__authenticatorIndex;
+
+//                                     int mappedIndex = AuthIndexHandler::getInstance()->
+//                                                     getMappedIndex(devIdStr, aaidStr, realIndex);
+
+                                       /*In getinfo authInfo->__authenticatorIndex is set as mappedIndex*/
+                                       stubMapB->insert(std::make_pair(authInfo->__authenticatorIndex, stub));
+                                       _INFO("[%d][%p] Stub Added to Bound cache", authInfo->__authenticatorIndex, stub);
+
+                                       aListOfStub = aListOfStub->next;
+                               }
+                               getInfoList->push_back(getInfo);
+                       }
+               }
+               if ((stubMapB != NULL) && (stubMapB->size() > 0)) {
+                       AuthManager::getInstance()->setAuthStubCache(AUTH_TYPE_BOUND, stubMapB);
+               }
+               _INFO("Cache done in server");
+
+               /*b64 encoded tlv response*/
+               return RoamingUtil::composeAuthGetInfoResponce(getInfoList);
+       }
+}
diff --git a/server/ops/src/GetRegsOp.cpp b/server/ops/src/GetRegsOp.cpp
new file mode 100644 (file)
index 0000000..9abce82
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "GetRegsOp.h"
+#include "InitState.h"
+#include "GetRegsState.h"
+#include "AsmHelper.h"
+#include <vector>
+
+GetRegsOp::~GetRegsOp(void)
+{
+       /*TODO*/
+}
+
+char *
+GetRegsOp::execute(void)
+{
+       RET_IF_FAIL(__authStub != NULL, NULL);
+
+       InitState *inState = new InitState();
+       GetRegsState *getRegsState = new GetRegsState();
+
+       char *resJson = NULL;
+
+       int err = inState->handle(__authStub, NULL, NULL, NULL);
+       CATCH_IF_FAIL(err == 0);
+
+       err = getRegsState->handle(__authStub, __req, NULL, &resJson);
+       CATCH_IF_FAIL(err == 0);
+
+       delete inState;
+       delete getRegsState;
+
+       return resJson;
+
+CATCH:
+       delete inState;
+       delete getRegsState;
+
+       return NULL;
+}
diff --git a/server/ops/src/OpenSettingOp.cpp b/server/ops/src/OpenSettingOp.cpp
new file mode 100644 (file)
index 0000000..754bfa3
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "OpenSettingOp.h"
+
+
+OpenSettingOp::~OpenSettingOp(void)
+{
+       /*TODO*/
+}
+
+char *
+OpenSettingOp::execute(void)
+{
+       /*TODO*/
+       return NULL;
+}
diff --git a/server/ops/src/RegisterOp.cpp b/server/ops/src/RegisterOp.cpp
new file mode 100644 (file)
index 0000000..28c6cfa
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "RegisterOp.h"
+#include "AsmHelper.h"
+#include "InitState.h"
+#include "EnrollState.h"
+#include "VerifyState.h"
+#include "RegisterState.h"
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "IAuthStub.h"
+#include <vector>
+
+RegisterOp::~RegisterOp(void)
+{
+       /*TODO*/
+}
+
+int
+RegisterOp::initStates(void)
+{
+       //RET_IF_FAIL(__states == NULL, -1);
+
+//     __states = new std::queue();
+
+//     InitState *inState = new InitState();
+//     EnrollState *enState = new EnrollState();
+//     VerifyState *vState = new VerifyState();
+//     RegisterState *regState = new RegisterState();
+
+//     __states->push(inState);
+//     __states->push(enState);
+//     __states->push(vState);
+//     __states->push(regState);
+
+       return 0;
+}
+
+char *
+RegisterOp::execute(void)
+{
+       _BEGIN;
+       RET_IF_FAIL(__authStub != NULL, NULL);
+       _INFO("Stub [%p]", __authStub);
+
+       InitState *inState = new InitState();
+       EnrollState *enState = new EnrollState();
+       VerifyState *vState = new VerifyState();
+       RegisterState *regState = new RegisterState();
+
+       char *regReqStr = (char *)calloc(1, 128);
+       snprintf(regReqStr, 128 - 1, "%s", "registration");
+
+       char *resJson = NULL;
+       char *vToken = NULL;
+
+       int err = inState->handle(__authStub, NULL, NULL, NULL);
+       _INFO("Init State =[%d]", err);
+       CATCH_IF_FAIL(err == 0);
+
+       err = enState->handle(__authStub, __req, regReqStr, &vToken);
+       _INFO("Enroll State =[%d]", err);
+       CATCH_IF_FAIL(err == 0);
+
+       err = vState->handle(__authStub, __req, regReqStr, &vToken);
+       CATCH_IF_FAIL(err == 0);
+
+       err = regState->handle(__authStub, __req, vToken, &resJson);
+       _INFO("Register State =[%d]", err);
+       CATCH_IF_FAIL(err == 0);
+
+       delete inState;
+       delete enState;
+       delete vState;
+       delete regState;
+       SAFE_DELETE(regReqStr);
+
+       _END;
+       return resJson;
+
+CATCH:
+       SAFE_DELETE(regReqStr);
+       delete inState;
+       delete enState;
+       delete vState;
+       delete regState;
+
+       return NULL;
+}
+
diff --git a/server/src/AsmStorage.cpp b/server/src/AsmStorage.cpp
new file mode 100644 (file)
index 0000000..6887fdd
--- /dev/null
@@ -0,0 +1,1234 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AsmStorage.h"
+#include "AsmHelper.h"
+
+#include <dlog.h>
+#include <string.h>
+#include <time.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sqlite3.h>
+#include <db-util.h>
+#include <sys/time.h>
+#include <tzplatform_config.h>
+
+#define BUFFLEN 65535
+
+AsmStorage* AsmStorage::__this = NULL;
+
+//#define ASM_DB_PATH tzplatform_mkpath(TZ_SYS_DB, "/.fido_asm.db")
+#define ASM_DB_PATH "/opt/dbspace/.fido_asm.db"
+//#define AUTH_DB_PATH tzplatform_mkpath(TZ_SYS_DB, "/.fido_auth.db")
+#define AUTH_DB_PATH "/opt/dbspace/.fido_auth.db"
+
+//#define SECRET_DB_PATH tzplatform_mkpath(TZ_SYS_DB, "/.fido_secret.db")
+#define SECRET_DB_PATH "/opt/dbspace/.fido_secret.db"
+
+#define FIDO_ASM "fido_asm"
+#define FIDO_AUTH "fido_auth"
+#define FIDO_SECRET "fido_secret"
+
+#define DB_QUERY_CREATE_TABLE_ASM "CREATE TABLE IF NOT EXISTS ASMKEYS (" \
+                                                                                       "id INTEGER PRIMARY KEY AUTOINCREMENT, "\
+                                                                                       "auth_idx INTEGER NOT NULL, "\
+                                                                                       "caller_id TEXT NOT NULL, "\
+                                                                                       "app_id TEXT NOT NULL, "\
+                                                                                       "key_handle TEXT UNIQUE, "\
+                                                                                       "key_id TEXT NOT NULL UNIQUE, "\
+                                                                                       "time_stamp TEXT NOT NULL UNIQUE);"
+
+#define DB_QUERY_CREATE_TABLE_AUTH "CREATE TABLE if not exists AUTHLIST (" \
+                                                                               "id INTEGER PRIMARY KEY AUTOINCREMENT, "\
+                                                                               "auth_index INTEGER NOT NULL, "\
+                                                                               "device_id TEXT NOT NULL, "\
+                                                                               "aaid TEXT NOT NULL, "\
+                                                                               "mapped_index INTEGER UNIQUE);"
+
+#define DB_QUERY_CREATE_TABLE_SECRET "CREATE TABLE IF NOT EXISTS SECRET (" \
+                                                                               "id INTEGER PRIMARY KEY AUTOINCREMENT, "\
+                                                                               "aaid TEXT NOT NULL, "\
+                                                                               "device_id TEXT NOT NULL, "\
+                                                                               "uid INTEGER NOT NULL, "\
+                                                                               "secret_1 TEXT NOT NULL, "\
+                                                                               "secret_2 TEXT);"
+
+AsmStorageParcel::AsmStorageParcel(void)
+{
+       __id = -1;
+       __authIdx = -1;
+       __dbName = FIDO_ASM;
+}
+
+AuthStorageParcel::AuthStorageParcel(void)
+{
+       __id = -1;
+       __authIndex = -1;
+       __mappedIndex = -1;
+       __dbName = FIDO_AUTH;
+}
+
+SecretStorageParcel::SecretStorageParcel(void)
+{
+       __id = -1;
+       __uid = -1;
+       __dbName = FIDO_SECRET;
+}
+
+int
+AsmStorageParcel::getInt(IntProperty prop, int *val)
+{
+       if(prop == INT_PROP_ID) {
+               *val = __id;
+               return SQLITE_OK;
+       }
+       if(prop == INT_PROP_AUTH_IDX) {
+               *val =  __authIdx;
+               return SQLITE_OK;
+       }
+
+       return SQLITE_ERROR;
+}
+
+int
+AsmStorageParcel::setInt(IntProperty prop, int val)
+{
+       if(prop == INT_PROP_ID) {
+               __id = val;
+               return SQLITE_OK;
+       }
+       if(prop == INT_PROP_AUTH_IDX) {
+               __authIdx = val;
+               return SQLITE_OK;
+       }
+
+       return SQLITE_ERROR;
+}
+
+int
+AsmStorageParcel::getString(StringProperty prop, char **val)
+{
+       if(prop == STR_PROP_CALLER_ID) {
+          *val =  strdup(__callerId.c_str());
+          return SQLITE_OK;
+       }
+       if(prop == STR_PROP_APP_ID) {
+               *val = strdup(__appId.c_str());
+               return SQLITE_OK;
+       }
+       if(prop == STR_PROP_KEY_HANDLE) {
+               *val = strdup(__keyHandle.c_str());
+               return SQLITE_OK;
+       }
+       if(prop == STR_PROP_KEY_ID) {
+               *val = strdup(__keyId.c_str());
+               return SQLITE_OK;
+       }
+       if(prop == STR_PROP_TIME) {
+               *val = strdup(__ts.c_str());
+               return SQLITE_OK;
+       }
+
+       return SQLITE_ERROR;
+}
+
+int
+AsmStorageParcel::setString(StringProperty prop, const  std::string& val)
+{
+       if(prop == STR_PROP_CALLER_ID) {
+               __callerId = val;
+               return SQLITE_OK;
+       }
+       if(prop == STR_PROP_APP_ID) {
+               __appId = val;
+               return SQLITE_OK;
+       }
+       if(prop == STR_PROP_KEY_HANDLE) {
+               __keyHandle = val;
+               return SQLITE_OK;
+       }
+       if(prop == STR_PROP_KEY_ID) {
+               __keyId = val;
+               return SQLITE_OK;
+       }
+       if(prop == STR_PROP_TIME) {
+               __ts = val;
+               return SQLITE_OK;
+       }
+
+       return SQLITE_ERROR;
+}
+
+std::string
+AsmStorageParcel::getDBName(void)
+{
+       return __dbName;
+}
+
+int
+AuthStorageParcel::getInt(IntProperty prop, int *val)
+{
+       if(prop == INT_PROP_AUTH_ID) {
+               *val = __authIndex;
+               return SQLITE_OK;
+       }
+
+       if(prop == INT_PROP_MAPPED_AUTH_ID) {
+               *val = __mappedIndex;
+               return SQLITE_OK;
+       }
+
+       return SQLITE_ERROR;
+}
+
+int
+AuthStorageParcel::setInt(IntProperty prop, int val)
+{
+       if(prop == INT_PROP_AUTH_ID) {
+               __authIndex = val;
+               return SQLITE_OK;
+       }
+
+       if(prop == INT_PROP_MAPPED_AUTH_ID) {
+               __mappedIndex = val;
+               return SQLITE_OK;
+       }
+
+       return SQLITE_ERROR;
+}
+
+int
+AuthStorageParcel::getString(StringProperty prop, char **val)
+{
+       if(prop == STR_PROP_DEV_ID) {
+               if (__devId == "" || __devId.empty() == true)
+                       return SQLITE_ERROR;
+
+               *val =  strdup(__devId.c_str());
+               return SQLITE_OK;
+       }
+
+       if(prop == STR_PROP_AAID) {
+               if (__aaid == "" || __aaid.empty() == true)
+                       return SQLITE_ERROR;
+
+               *val =  strdup(__aaid.c_str());
+               return SQLITE_OK;
+       }
+
+       return SQLITE_ERROR;
+}
+
+int
+AuthStorageParcel::setString(StringProperty prop, const std::string& val)
+{
+       if(prop == STR_PROP_DEV_ID) {
+               __devId = val;
+               return SQLITE_OK;
+       }
+
+       if(prop == STR_PROP_AAID) {
+               __aaid = val;
+               return SQLITE_OK;
+       }
+
+       return SQLITE_ERROR;
+}
+
+std::string
+AuthStorageParcel::getDBName(void)
+{
+       return __dbName;
+}
+
+int
+SecretStorageParcel::setInt(IntProperty prop, int val)
+{
+       if(prop == INT_PROP_UID) {
+               __uid = val;
+               return SQLITE_OK;
+       }
+
+       return SQLITE_ERROR;
+}
+
+int
+SecretStorageParcel::getInt(IntProperty prop, int *val)
+{
+       if(prop == INT_PROP_UID) {
+               *val = __uid;
+               return SQLITE_OK;
+       }
+
+       return SQLITE_ERROR;
+}
+
+int
+SecretStorageParcel::setString(StringProperty prop, const std::string &val)
+{
+       if(prop == STR_PROP_AAID) {
+               __aaid = val;
+               return SQLITE_OK;
+       }
+
+       if(prop == STR_PROP_DEV_ID) {
+               __devId = val;
+               return SQLITE_OK;
+       }
+
+       if(prop == STR_PROP_SECRET1) {
+               __secret1 = val;
+               return SQLITE_OK;
+       }
+
+       if(prop == STR_PROP_SECRET2) {
+               __secret2 = val;
+               return SQLITE_OK;
+       }
+
+       return SQLITE_ERROR;
+}
+
+int
+SecretStorageParcel::getString(StringProperty prop, char **val)
+{
+       if(prop == STR_PROP_AAID) {
+               if(__aaid == "" || __aaid.empty() == true)
+                       return SQLITE_ERROR;
+
+               *val = strdup(__aaid.c_str());
+               return SQLITE_OK;
+       }
+
+       if(prop == STR_PROP_DEV_ID) {
+               if(__devId == "" || __devId.empty() == true)
+                       return SQLITE_ERROR;
+
+               *val = strdup(__devId.c_str());
+               return SQLITE_OK;
+       }
+
+       if(prop == STR_PROP_SECRET1) {
+               if(__secret1 == "" || __secret1.empty() == true)
+                       return SQLITE_ERROR;
+
+               *val = strdup(__secret1.c_str());
+               return SQLITE_OK;
+       }
+
+       if(prop == STR_PROP_SECRET2) {
+               if(__secret2 == "" || __secret2.empty() == true)
+                       return SQLITE_ERROR;
+
+               *val = strdup(__secret2.c_str());
+               return SQLITE_OK;
+       }
+
+       return SQLITE_ERROR;
+}
+
+std::string
+SecretStorageParcel::getDBName(void)
+{
+       return __dbName;
+}
+
+sqlite3*
+AsmStorage::createIfNotExists(const std::string& dbName)
+{
+       _INFO("%s", dbName.c_str());
+
+       const char *query = NULL;
+       char *dbPath = NALLOC(512, char);
+
+       if(dbName == FIDO_ASM) {
+               query = DB_QUERY_CREATE_TABLE_ASM;
+               snprintf(dbPath, 512 - 1, "%s", ASM_DB_PATH);
+       }
+       else if(dbName == FIDO_AUTH) {
+               query = DB_QUERY_CREATE_TABLE_AUTH;
+               snprintf(dbPath, 512 - 1, "%s", AUTH_DB_PATH);
+       }
+       else if(dbName == FIDO_SECRET) {
+               query = DB_QUERY_CREATE_TABLE_SECRET;
+               snprintf(dbPath, 512 - 1, "%s", SECRET_DB_PATH);
+       }
+       else {
+               return NULL;
+       }
+
+       _INFO("%s", dbPath);
+       _INFO("%s", query);
+
+       sqlite3 *dbH = NULL;
+       int ret = sqlite3_open_v2(dbPath , &dbH,
+                                       SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, NULL);
+
+       if (dbH == NULL) {
+               _ERR("Failed to create/open [%s]=[%d]", dbPath, ret);
+               return NULL;
+       }
+
+       char *errMsg = NULL;
+       ret = sqlite3_exec(dbH, query, NULL, 0, &errMsg);
+       if (errMsg != NULL) {
+               _INFO("createtable error = [%s]", errMsg);
+               sqlite3_close(dbH);
+
+               return NULL;
+       }
+
+       sqlite3_close(dbH);
+
+       sqlite3 *dbNew = NULL;
+       ret = sqlite3_open_v2(dbPath , &dbNew, SQLITE_OPEN_READWRITE, NULL);
+       if (dbNew == NULL) {
+               _ERR("sqlite3_open_v2 error = [%d]", ret);
+               return NULL;
+       }
+
+       _INFO("DB open successful");
+       return dbNew;
+}
+
+sqlite3*
+AsmStorage::openDBHandle(const std::string& dbName)
+{
+       _INFO("%s", dbName.c_str());
+       char *dbPath = NALLOC(512, char);
+       if(dbName == FIDO_ASM) {
+               snprintf(dbPath, 512 - 1, "%s", ASM_DB_PATH);
+       }
+       else if(dbName == FIDO_AUTH) {
+               snprintf(dbPath, 512 - 1, "%s", AUTH_DB_PATH);
+       }
+       else if(dbName == FIDO_SECRET) {
+               snprintf(dbPath, 512 - 1, "%s", SECRET_DB_PATH);
+       }
+       else {
+               return NULL;
+       }
+
+       sqlite3 *dbH = NULL;
+       int ret = db_util_open(dbPath, &dbH, DB_UTIL_REGISTER_HOOK_METHOD);
+       if (SQLITE_OK != ret) {
+               _ERR("db_util_open failed [%s]=[%d]", dbPath, ret);
+               return NULL;
+       }
+
+       _INFO("db_util_open done [%s]=[%d]", dbPath, ret);
+
+       return dbH;
+       /*return createIfNotExists(dbName);;*/
+}
+
+void
+AsmStorage::closeDBHandle(sqlite3 *dbH)
+{
+       if (dbH == NULL)
+               return;
+       db_util_close(dbH);
+}
+
+int
+AsmStorage::insertData(IStorageParcel *parcel)
+{
+       _INFO("insertData begin");
+       RET_IF_FAIL(parcel != NULL, SQLITE_ERROR);
+
+       int ret = 0;
+       char *errMsg = NULL;
+       char query[BUFFLEN] = {0};
+       const std::string& dbName = parcel->getDBName();
+       _INFO("dbName=[%s]", dbName.c_str());
+
+       sqlite3* dbHandle = openDBHandle(dbName);
+       _INFO("openDBHandle=[%p]", dbHandle);
+       RET_IF_FAIL(dbHandle != NULL, SQLITE_ERROR);
+
+       if (dbName == FIDO_ASM) {
+               int val = -1;
+               char *value = NULL;
+
+               parcel->getInt(INT_PROP_AUTH_IDX, &val);
+               int authIdx = val;
+
+               parcel->getString(STR_PROP_CALLER_ID, &value);
+               const std::string& callerId = value;
+
+               parcel->getString(STR_PROP_APP_ID, &value);
+               const std::string& appId = value;
+
+               parcel->getString(STR_PROP_KEY_HANDLE, &value);
+               const std::string& keyHandle = value;
+
+               parcel->getString(STR_PROP_KEY_ID, &value);
+               const std::string& keyId = value;
+
+               time_t now = time(0);
+               struct tm  tstruct;
+               char buf[BUFFLEN] = {0};
+               tstruct = *gmtime(&now); // UTC datetime
+               strftime(buf, sizeof(buf), "%Y-%m-%d.%H:%M:%S", &tstruct);
+
+               timeval curTime;
+               gettimeofday(&curTime, NULL);
+               int milli = curTime.tv_usec/1000;
+
+               char currentTime[BUFFLEN] = "";
+               snprintf(currentTime, BUFFLEN, "%s:%d", buf, milli);
+
+               const std::string& ts = currentTime;
+
+               if(authIdx == -1 || callerId == "" || appId == "" ||keyId == "" ||ts == "") {
+                       _ERR("One or more fields of the Asm parcel are not set properly");
+                       closeDBHandle(dbHandle);
+                       return SQLITE_ERROR;
+               }
+
+               if(keyHandle.empty() == true) {
+                       snprintf(query, BUFFLEN, "INSERT INTO ASMKEYS(auth_idx, caller_id, app_id, key_id, time_stamp) "
+                               "VALUES (%d, \'%s\', \'%s\', \'%s\', \'%s\');",
+                               authIdx, callerId.c_str(), appId.c_str(), keyId.c_str(), ts.c_str());
+               }
+               else {
+                       snprintf(query, BUFFLEN, "INSERT INTO ASMKEYS(auth_idx, caller_id, app_id, key_handle, key_id, time_stamp) "
+                               "VALUES (%d, \'%s\', \'%s\', \'%s\', \'%s\', \'%s\');",
+                               authIdx, callerId.c_str(), appId.c_str(), keyHandle.c_str(), keyId.c_str(), ts.c_str());
+               }
+       }
+
+       else if(dbName == FIDO_AUTH) {
+               /*Device Id, AAID, AuthIndex taken from input*/
+               /*MappedIndex is auto-incremented*/
+
+               char *devId = NULL;
+               char *aaid = NULL;
+               int authIndex = 0;
+               int mappedIndex = -1;
+
+               /*select max(mapped_index) from AUTHLIST;*/
+               /*store into mappedIndex*/
+               /*insert into AUTHLIST(auth_index, device_id, aaid, mapped_index)
+               values(authIndex, devId, aaid, mappedIndex);*/
+
+               char *qrySelect = NALLOC(BUFFLEN, char);
+               snprintf(qrySelect, BUFFLEN - 1, "%s",
+                                "SELECT IFNULL(MAX(mapped_index), -1) FROM AUTHLIST;");
+               _INFO("%s", qrySelect);
+               ret = sqlite3_exec(dbHandle, qrySelect, maxMappedIndexCb, &mappedIndex, &errMsg);
+               _INFO("%d", ret);
+               CATCH_IF_FAIL(ret == SQLITE_OK);
+
+               parcel->getInt(INT_PROP_AUTH_ID, &authIndex);
+               parcel->getString(STR_PROP_DEV_ID, &devId);
+               parcel->getString(STR_PROP_AAID, &aaid);
+
+               if((devId == NULL) || (aaid == NULL) || (authIndex < 0)) {
+                       _ERR("One or more fields of the Auth parcel are not set properly");
+                       _INFO("[%s][%s][%d]", devId, aaid, authIndex);
+                       closeDBHandle(dbHandle);
+                       return SQLITE_ERROR;
+               }
+
+               _INFO("Current mappedIndex=[%d]", mappedIndex);
+               mappedIndex++;
+
+               snprintf(query, BUFFLEN,
+                                "INSERT INTO AUTHLIST(auth_index, device_id, aaid, mapped_index) VALUES (%d, \'%s\', \'%s\', %d);",
+                                authIndex, devId, aaid, mappedIndex);
+               _INFO("%s", query);
+       }
+
+       else if(dbName == FIDO_SECRET) {
+               int uid = -1;
+               char *aaid = NULL;
+               char *devId = NULL;
+               char *secret1 = NULL;
+               char *secret2 = NULL;
+
+               parcel->getInt(INT_PROP_UID, &uid);
+               parcel->getString(STR_PROP_AAID, &aaid);
+               parcel->getString(STR_PROP_DEV_ID, &devId);
+               parcel->getString(STR_PROP_SECRET1, &secret1);
+               parcel->getString(STR_PROP_SECRET2, &secret2);
+
+               if(uid == -1 || aaid == NULL || devId == NULL || secret1 == NULL) {
+                       _ERR("One or more fields of the Secret parcel are not set properly");
+                       closeDBHandle(dbHandle);
+                       return SQLITE_ERROR;
+               }
+
+               if(secret2 == NULL) {
+                       snprintf(query, BUFFLEN,
+                                        "INSERT INTO SECRET(aaid, device_id, uid, secret_1) VALUES (\'%s\', \'%s\', %d, \'%s\');",
+                                        aaid, devId, uid, secret1);
+               }
+               else {
+                       snprintf(query, BUFFLEN,
+                                        "INSERT INTO SECRET(aaid, device_id, uid, secret_1, secret_2) VALUES (\'%s\', \'%s\', %d, \'%s\', \'%s\');",
+                                        aaid, devId, uid, secret1, secret2);
+               }
+       }
+
+       _INFO("AsmStorage::insertData:: query = [%s]", query);
+       ret = sqlite3_exec(dbHandle, query, NULL, 0, &errMsg);
+       _INFO("AsmStorage::insertData:: ERROR MSG : [%s]", errMsg);
+       CATCH_IF_FAIL(ret == SQLITE_OK);
+
+       _INFO("Record successfully inserted");
+       closeDBHandle(dbHandle);
+       return SQLITE_OK;
+
+CATCH :
+       _ERR("Record not inserted/ Record already exists in Table");
+       sqlite3_free(errMsg);
+       closeDBHandle(dbHandle);
+       return SQLITE_ERROR;
+}
+
+int
+AsmStorage::insertBulkData(std::vector<IStorageParcel *> *parcel)
+{
+       RET_IF_FAIL(parcel != NULL, SQLITE_ERROR);
+       int i = 0;
+       int ret = SQLITE_OK;
+
+       for(std::vector<IStorageParcel*>::iterator it = parcel->begin(); it != parcel->end(); it++) {
+               ret = insertData(*it);
+               if(ret != SQLITE_OK) {
+                       _INFO("%d th Record not inserted/already exists", i+1);
+               }
+               else {
+                       _INFO("%d th Record inserted successfully", i+1);
+               }
+               i++;
+       }
+       return ret;
+}
+
+int
+AsmStorage::maxMappedIndexCb(void *data, int argc, char **argv, char **azCollName)
+{
+       _INFO("");
+       int *mappedIndex = (int *)data;
+
+       _INFO("argc=[%d]", argc);
+
+       if ((argc > 0) && (argv[0] != NULL)) {
+               *mappedIndex = atoi(argv[0]);
+               _INFO("%d", *mappedIndex);
+               return SQLITE_OK;
+       }
+
+       *mappedIndex = -1;
+       _INFO("");
+       return SQLITE_OK;
+}
+
+int
+AsmStorage::searchItemCb(void *data, int argc, char **argv, char **azCollName)
+{
+       _BEGIN;
+
+       SearchCbData *cbData = (SearchCbData *)data;
+
+       std::string dbName(cbData->dbName, strlen(cbData->dbName));
+       int itr = 0;
+       const char *empty = "";
+
+       if(dbName == FIDO_ASM) {
+               IStorageParcel *parcel = new AsmStorageParcel();
+
+               if(itr < argc) {
+                       if(argv[itr] == NULL)
+                               argv[itr] = (char*)empty;
+                       parcel->setInt(INT_PROP_ID, atoi(argv[0]));
+               }
+               itr++;
+               if(itr < argc) {
+                       if(argv[itr] == NULL)
+                               argv[itr] = (char*)empty;
+                       parcel->setInt(INT_PROP_AUTH_IDX, atoi(argv[1]));
+               }
+               itr++;
+               if(itr < argc) {
+                       if(argv[itr] == NULL)
+                               argv[itr] = (char*)empty;
+                       parcel->setString(STR_PROP_CALLER_ID, argv[2]);
+               }
+               itr++;
+               if(itr < argc) {
+                       if(argv[itr] == NULL)
+                               argv[itr] = (char*)empty;
+                       parcel->setString(STR_PROP_APP_ID, argv[3]);
+               }
+               itr++;
+               if(itr < argc) {
+                       if(argv[itr] == NULL)
+                               argv[itr] = (char*)empty;
+                       parcel->setString(STR_PROP_KEY_HANDLE, argv[4]);
+               }
+               itr++;
+               if(itr < argc) {
+                       if(argv[itr] == NULL)
+                               argv[itr] = (char*)empty;
+                       parcel->setString(STR_PROP_KEY_ID, argv[5]);
+                       _INFO("AsmStorage::searchItemCb:: key_id = [%s]", argv[5]);
+               }
+               itr++;
+               if(itr < argc) {
+                       if(argv[itr] == NULL)
+                               argv[itr] = (char*)empty;
+                       parcel->setString(STR_PROP_TIME, argv[6]);
+               }
+
+               cbData->resList->push_back(parcel);
+               return SQLITE_OK;
+
+       }
+
+       else if(dbName == FIDO_AUTH) {
+               IStorageParcel *parcel = new AuthStorageParcel();
+
+               if ((argc >= 1) && (argv[1] != NULL))
+                       parcel->setInt(INT_PROP_AUTH_ID, atoi(argv[1]));
+
+               if ((argc >= 2) && (argv[2] != NULL))
+                       parcel->setString(STR_PROP_DEV_ID, argv[2]);
+
+               if ((argc >= 3) && (argv[3] != NULL))
+                       parcel->setString(STR_PROP_AAID, argv[3]);
+
+               if ((argc >= 4) && (argv[4] != NULL))
+                       parcel->setInt(INT_PROP_MAPPED_AUTH_ID, atoi(argv[4]));
+
+               cbData->resList->push_back(parcel);
+               return SQLITE_OK;
+       }
+
+       else if(dbName == FIDO_SECRET) {
+               IStorageParcel *parcel = new SecretStorageParcel();
+
+               if(itr < argc) {
+                       if(argv[itr] == NULL)
+                               argv[itr] = (char*)empty;
+                       parcel->setInt(INT_PROP_ID, atoi(argv[0]));
+               }
+               itr++;
+
+               if(itr < argc) {
+                       if(argv[itr] == NULL)
+                               argv[itr] = (char*)empty;
+                       parcel->setString(STR_PROP_AAID, argv[1]);
+               }
+               itr++;
+
+               if(itr < argc) {
+                       if(argv[itr] == NULL)
+                               argv[itr] = (char*)empty;
+                       parcel->setString(STR_PROP_DEV_ID, argv[2]);
+               }
+               itr++;
+
+               if(itr < argc) {
+                       if(argv[itr] == NULL)
+                               argv[itr] = (char*)empty;
+                       parcel->setInt(INT_PROP_UID, atoi(argv[3]));
+               }
+               itr++;
+
+               if(itr < argc) {
+                       if(argv[itr] == NULL)
+                               argv[itr] = (char*)empty;
+                       parcel->setString(STR_PROP_SECRET1, argv[4]);
+               }
+               itr++;
+
+               if(itr < argc) {
+                       if(argv[itr] == NULL)
+                               argv[itr] = (char*)empty;
+                       parcel->setString(STR_PROP_SECRET2, argv[5]);
+               }
+
+               cbData->resList->push_back(parcel);
+               return SQLITE_OK;
+       }
+
+       _END;
+       return SQLITE_ERROR;
+}
+
+std::vector<IStorageParcel*>*
+AsmStorage::searchData(IStorageParcel *parcel)
+{
+       RET_IF_FAIL(parcel != NULL, NULL);
+       const std::string& dbName = parcel->getDBName();
+       sqlite3* dbHandle = openDBHandle(dbName);
+       RET_IF_FAIL(dbHandle != NULL, NULL);
+
+
+       std::vector<IStorageParcel*> *resultList = new std::vector<IStorageParcel*>();
+
+       char *errMsg = NULL;
+       char q[BUFFLEN] = {0};
+       char *value = NULL;
+       char query[BUFFLEN] = {0};
+
+
+       SearchCbData cbData;
+
+       if(dbName == FIDO_ASM) {
+               int id = -1;
+               int authIdx = -1;
+
+               parcel->getInt(INT_PROP_ID, &id);
+               parcel->getInt(INT_PROP_AUTH_IDX, &authIdx);
+
+               parcel->getString(STR_PROP_CALLER_ID, &value);
+               const std::string& callerId = value;
+               parcel->getString(STR_PROP_APP_ID, &value);
+               const std::string& appId = value;
+               parcel->getString(STR_PROP_KEY_HANDLE, &value);
+               const std::string& keyHandle = value;
+               parcel->getString(STR_PROP_KEY_ID, &value);
+               const std::string& keyId = value;
+               parcel->getString(STR_PROP_TIME, &value);
+
+               snprintf(query, BUFFLEN, "SELECT * FROM ASMKEYS WHERE ");
+               bool isAnd = false;
+
+               if(id != -1) {
+                               snprintf(q, BUFFLEN, "id=%d", id);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+               }
+               if(authIdx != -1) {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND auth_idx=%d", authIdx);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "auth_idx=%d", authIdx);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+               if(callerId != "") {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND caller_id=\'%s\'", callerId.c_str());
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "caller_id=\'%s\'", callerId.c_str());
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+               if(appId != "") {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND app_id=\'%s\'", appId.c_str());
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "app_id=\'%s\'", appId.c_str());
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+               if(keyHandle != "") {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND key_handle=\'%s\'", keyHandle.c_str());
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "key_handle=\'%s\'", keyHandle.c_str());
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+               if(keyId != "") {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND key_id=\'%s\'", keyId.c_str());
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "key_id=\'%s\'", keyId.c_str());
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+
+               snprintf(q, BUFFLEN, ";");
+               strncat(query, q, sizeof(query)-strlen(query)-1);
+       }
+
+       else if(dbName == FIDO_AUTH) {
+               int authIndex = -1;
+               int mappedIndex = -1;
+               char *devId = NULL;
+               char *aaid = NULL;
+
+
+               parcel->getInt(INT_PROP_AUTH_ID, &authIndex);
+               parcel->getInt(INT_PROP_MAPPED_AUTH_ID, &mappedIndex);
+               parcel->getString(STR_PROP_DEV_ID, &devId);
+               parcel->getString(STR_PROP_AAID, &aaid);
+               _INFO("[%d][%d][%s][%s]", authIndex, mappedIndex, devId, aaid);
+
+               snprintf(query, BUFFLEN, "SELECT * FROM AUTHLIST WHERE ");
+               bool isAnd = false;
+
+               if(authIndex != -1) {
+                       snprintf(q, BUFFLEN, "auth_index=%d", authIndex);
+                       strncat(query, q, sizeof(query) - strlen(query)-1);
+                       isAnd = true;
+               }
+               if(mappedIndex != -1) {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND mapped_index=%d", mappedIndex);
+                               strncat(query, q, sizeof(query) - strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "mapped_index=%d", mappedIndex);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+
+               if(devId != NULL) {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND device_id=\'%s\'", devId);
+                               strncat(query, q, sizeof(query) - strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "device_id=\'%s\'", devId);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+
+               if(aaid != NULL) {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND aaid=\'%s\'", aaid);
+                               strncat(query, q, sizeof(query) - strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "aaid=\'%s\'", aaid);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+
+               snprintf(q, BUFFLEN, ";");
+               strncat(query, q, sizeof(query) - strlen(query) - 1);
+       }
+
+       else if(dbName == FIDO_SECRET) {
+               int uid = -1;
+               char *aaid = NULL;
+               char *devId = NULL;
+               char *secret1 = NULL;
+               char *secret2 = NULL;
+
+               parcel->getInt(INT_PROP_UID, &uid);
+               parcel->getString(STR_PROP_AAID, &aaid);
+               parcel->getString(STR_PROP_DEV_ID, &devId);
+               parcel->getString(STR_PROP_SECRET1, &secret1);
+               parcel->getString(STR_PROP_SECRET2, &secret2);
+
+               _INFO("[%d][%s][%s][%s][%s]", uid, aaid, devId, secret1,secret2);
+
+               snprintf(query, BUFFLEN, "SELECT * FROM SECRET WHERE ");
+               bool isAnd = false;
+
+               if(uid != -1) {
+                       snprintf(q, BUFFLEN, "uid=%d", uid);
+                       strncat(query, q, sizeof(query)-strlen(query)-1);
+                       isAnd = true;
+               }
+
+               if(aaid != NULL) {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND aaid=\'%s\'", aaid);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "aaid=\'%s\'", aaid);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+
+               if(devId != NULL) {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND device_id=\'%s\'", devId);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "device_id=\'%s\'", devId);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+
+               if(secret1 != NULL) {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND secret_1=\'%s\'", secret1);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "secret_1=\'%s\'", secret1);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+
+               if(secret2 != NULL) {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND secret_2=\'%s\'", secret2);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "secret_2=\'%s\'", secret2);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+
+               snprintf(q, BUFFLEN, ";");
+               strncat(query, q, sizeof(query) - strlen(query) - 1);
+       }
+
+       cbData.dbName = strdup(dbName.c_str());
+       cbData.resList = resultList;
+
+       _INFO("AsmStorage::searchData:: query = [%s]", query);
+       int ret = sqlite3_exec(dbHandle, query, searchItemCb, &cbData, &errMsg);
+       _INFO("AsmStorage::searchData:: ERROR MSG : [%s]", errMsg);
+       CATCH_IF_FAIL(ret == SQLITE_OK);
+
+       _INFO("Records found = [%d]", resultList->size());
+       closeDBHandle(dbHandle);
+
+       SAFE_DELETE(cbData.dbName);
+
+       return resultList;
+
+CATCH :
+       _ERR("No Records found");
+       sqlite3_free(errMsg);
+       closeDBHandle(dbHandle);
+
+       SAFE_DELETE(cbData.dbName);
+
+       return NULL;
+}
+
+int
+AsmStorage::deleteData(IStorageParcel *parcel)
+{
+       int numRecChanged = 0;
+       char *errMsg = NULL;
+       char q[BUFFLEN] = {0};
+       char *value = NULL;
+       char query[BUFFLEN] = {0};
+       RET_IF_FAIL(parcel != NULL, SQLITE_ERROR);
+       int ret = 0;
+
+       const std::string& dbName = parcel->getDBName();
+       sqlite3* dbHandle = openDBHandle(dbName);
+       RET_IF_FAIL(dbHandle != NULL, SQLITE_ERROR);
+
+       if(dbName == FIDO_ASM) {
+               int id = -1;
+               int authIdx = -1;
+
+               parcel->getInt(INT_PROP_ID, &id);
+               parcel->getInt(INT_PROP_AUTH_IDX, &authIdx);
+
+               parcel->getString(STR_PROP_CALLER_ID, &value);
+               const std::string& callerId = value;
+               parcel->getString(STR_PROP_APP_ID, &value);
+               const std::string& appId = value;
+               parcel->getString(STR_PROP_KEY_HANDLE, &value);
+               const std::string& keyHandle = value;
+               parcel->getString(STR_PROP_KEY_ID, &value);
+               const std::string& keyId = value;
+               parcel->getString(STR_PROP_TIME, &value);
+
+               snprintf(query, BUFFLEN, "DELETE FROM ASMKEYS WHERE ");
+               bool isAnd = false;
+
+               if(id != -1) {
+                               snprintf(q, BUFFLEN, "id=%d", id);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+               }
+               if(authIdx != -1) {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND auth_idx=%d", authIdx);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "auth_idx=%d", authIdx);
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+               if(callerId != "") {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND caller_id=\'%s\'", callerId.c_str());
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "caller_id=\'%s\'", callerId.c_str());
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+               if(appId != "") {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND app_id=\'%s\'", appId.c_str());
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "app_id=\'%s\'", appId.c_str());
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+               if(keyHandle != "") {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND key_handle=\'%s\'", keyHandle.c_str());
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "key_handle=\'%s\'", keyHandle.c_str());
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+               if(keyId != "") {
+                       if(isAnd == true) {
+                               snprintf(q, BUFFLEN, " AND key_id=\'%s\'", keyId.c_str());
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                       }
+                       else {
+                               snprintf(q, BUFFLEN, "key_id=\'%s\'", keyId.c_str());
+                               strncat(query, q, sizeof(query)-strlen(query)-1);
+                               isAnd = true;
+                       }
+               }
+
+               snprintf(q, BUFFLEN, ";");
+               strncat(query, q, sizeof(query)-strlen(query)-1);
+       }
+
+       else if(dbName == FIDO_AUTH) {
+               _ERR("AUTHLIST does not allow deletion of entries");
+               goto CATCH;
+       }
+
+       ret = sqlite3_exec(dbHandle, query, NULL, 0, &errMsg);
+       _INFO("AsmStorage::deleteData:: ERROR MSG : [%s]", errMsg);
+       CATCH_IF_FAIL(ret == SQLITE_OK);
+
+       _INFO("Record(s)  successfully deleted");
+       numRecChanged = sqlite3_changes(dbHandle);
+       _INFO("Number of rows deleted=[%d]", numRecChanged);
+       closeDBHandle(dbHandle);
+       return SQLITE_OK;
+
+CATCH:
+       _ERR("Record not deleted/ Record does not exists");
+       sqlite3_free(errMsg);
+       closeDBHandle(dbHandle);
+       return SQLITE_ERROR;
+}
+
+int
+AsmStorage::deleteAllData(const std::string& dbName)
+{
+       char *errMsg = NULL;
+       char query[BUFFLEN] = {0};
+
+       sqlite3* dbHandle = openDBHandle(dbName);
+       RET_IF_FAIL(dbHandle != NULL, SQLITE_ERROR);
+
+       if(dbName == FIDO_ASM) {
+               snprintf(query, BUFFLEN, "DELETE FROM ASMKEYS;");
+       }
+
+       else if(dbName == FIDO_AUTH) {
+               snprintf(query, BUFFLEN, "DELETE FROM AUTHLIST;");
+       }
+
+       int ret = sqlite3_exec(dbHandle, query, NULL, 0, &errMsg);
+       _INFO("AsmStorage::deleteAllData:: ERROR MSG : [%s]", errMsg);
+       CATCH_IF_FAIL(ret == SQLITE_OK);
+
+       _INFO("All Records successfully deleted from database");
+       closeDBHandle(dbHandle);
+       return SQLITE_OK;
+
+CATCH :
+       _ERR("All Records not deleted from database");
+       sqlite3_free(errMsg);
+       closeDBHandle(dbHandle);
+       return SQLITE_ERROR;
+}
+
+AsmStorage::AsmStorage(void)
+{
+       /*__asmDb = NULL;
+       __authDb = NULL;
+       __secretDb = NULL;*/
+}
+
+AsmStorage*
+AsmStorage::getInstance(void)
+{
+       if(__this != NULL) {
+               return __this;
+       }
+
+       AsmStorage* thisInstance = new AsmStorage();
+       if(thisInstance == NULL) {
+               return NULL;
+       }
+
+       __this = thisInstance;
+
+       /*int ret = __this->initDb(FIDO_ASM);
+       if(ret == SQLITE_OK) {
+               _INFO("Asm database created Successfully / already exists");
+       }
+
+       ret = __this->initDb(FIDO_AUTH);
+       if(ret == SQLITE_OK) {
+               _INFO("Auth database created Successfully / already exists");
+       }
+
+       ret = __this->initDb(FIDO_SECRET);
+       if(ret == SQLITE_OK) {
+               _INFO("Pin enroll database created Successfully / already exists");
+       }*/
+       return __this;
+}
diff --git a/server/src/ClientListener.cpp b/server/src/ClientListener.cpp
new file mode 100644 (file)
index 0000000..157907e
--- /dev/null
@@ -0,0 +1,446 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "ClientListener.h"
+#include <app_manager.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <tizen.h>
+#include <gio/gio.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <aul.h>
+#include "JsonUtil.h"
+#include "AsmOp.h"
+#include "AsmOpFactory.h"
+#include "AsmHelper.h"
+#include "TCUiAdaptor.h"
+#include "AcUiAdaptor.h"
+#include "AuthUiFactory.h"
+#include "RoamingUtil.h"
+
+//#define ASM_UI_TEST
+
+#define ASM_DBUS_PATH "/org/tizen/fidoasm"
+#define ASM_DBUS_NAME "org.tizen.fidoasm"
+
+#define _FREEDESKTOP_SERVICE   "org.freedesktop.DBus"
+#define _FREEDESKTOP_PATH      "/org/freedesktop/DBus"
+#define _FREEDESKTOP_INTERFACE "org.freedesktop.DBus"
+
+#define FIDO_CLIENT_SVC_PATH "/usr/bin/fido-service"
+#define FIDO_RAGENT_SVC_PATH "/usr/bin/fido-roaming-agent-service"
+#define FIDO_BLE_RAGENT_SVC_PATH "/usr/bin/fido-ble-ragent-service"
+#define FIDO_BT_RAGENT_SVC_PATH "/usr/bin/fido-bt-ragent-service"
+
+guint ClientListner::__ownerId = 0;
+Fidoasm* ClientListner::__dbusObj = NULL;
+
+ClientListner* ClientListner::__this = NULL;
+
+#define RESP_NEG "{\"statusCode\":1}"
+
+ClientListner::ClientListner(void)
+{
+}
+
+ClientListner::~ClientListner(void)
+{
+
+}
+
+ClientListner*
+ClientListner::getInstance(void)
+{
+       if (__this != NULL)
+               return __this;
+
+       /*TODO: thread-safe singleton*/
+       ClientListner *thisTemp = new ClientListner();
+       if (thisTemp == NULL)
+               return NULL;
+
+       __this = thisTemp;
+
+       return __this;
+}
+
+int
+ClientListner::readProc(const char *path, char *buf, int size)
+{
+       int fd = 0;
+       int ret = 0;
+
+       if (buf == NULL || path == NULL) {
+               _ERR("path and buffer is mandatory\n");
+               return -1;
+       }
+
+       fd = open(path, O_RDONLY);
+       if (fd < 0) {
+               _ERR("fd open error(%d)\n", fd);
+               return -1;
+       }
+
+       ret = read(fd, buf, size - 1);
+       if (ret <= 0) {
+               _ERR("fd read error(%d)\n", fd);
+               close(fd);
+               return -1;
+       } else
+               buf[ret] = 0;
+
+       close(fd);
+
+       return ret;
+}
+
+std::string
+ClientListner::getCallerId(GDBusMethodInvocation *invocation)
+{
+       pid_t remote_pid = 0;
+       GError *error = NULL;
+       GDBusConnection *connection = NULL;
+       GVariant *response = NULL;
+       guint32 upid;
+       const gchar *sender = NULL;
+
+       sender = g_dbus_method_invocation_get_sender (invocation);
+       if (!sender) {
+               _ERR("Failed to get sender");
+               return "";
+       }
+
+       connection = g_dbus_method_invocation_get_connection(invocation);
+       if (connection == NULL) {
+               _ERR("Failed to open connection for the invocation");
+               return "";
+       }
+
+       error = NULL;
+       response = g_dbus_connection_call_sync (connection,
+                       _FREEDESKTOP_SERVICE, _FREEDESKTOP_PATH,
+                       _FREEDESKTOP_INTERFACE, "GetConnectionUnixProcessID",
+                       g_variant_new ("(s)", sender), ((const GVariantType *) "(u)"),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+
+
+       if (response == NULL) {
+               _ERR("Failed to get caller id [%s]", error->message);
+               g_error_free (error);
+               return "";
+       }
+
+       g_variant_get (response, "(u)", &upid);
+       _INFO("Remote msg-bus peer service=%s pid=%u", sender, upid);
+       remote_pid = (pid_t) upid;
+
+       g_variant_unref (response);
+
+       char *app_id = NULL;
+       int ret = app_manager_get_app_id(remote_pid, &app_id);
+
+       if (app_id == NULL) {
+               _ERR("app_manager_get_app_id for %d failed = %d", remote_pid, ret);
+
+               /* Exception case : Daemons will not have app-ids, for them path will be set : /usr/bin/sample-service */
+               char buf[128];
+               int ret = 0;
+
+               snprintf(buf, sizeof(buf), "/proc/%d/cmdline", upid);
+               ret = readProc(buf, buf, sizeof(buf));
+               if (ret <= 0) {
+                       _ERR("No proc directory (%d)\n", upid);
+                       return "";
+               }
+
+               _INFO("Caller=[%s]", buf);
+
+               app_id = strdup(buf);
+       }
+
+
+       std::string appIdStr(app_id, strlen(app_id));
+       return appIdStr;
+}
+
+#define ASM_RESP_ACCESS_DENIED "{\"statusCode\":2}"
+#define ASM_RESP_DEREG "{\"statusCode\":0}"
+
+gboolean
+ClientListner::onClientRequest(Fidoasm *object, GDBusMethodInvocation *invocation,
+                                                                       const gchar *asmReqJson)
+{
+       _BEGIN;
+
+       /*TODO: Caller Id check*/
+
+       AsmRequest *req = NULL;
+
+       std::string callerId = FIDO_CLIENT_SVC_PATH;
+
+       _INFO("FIDO client request");
+       req = JsonUtil::parseAsmRequestJson(asmReqJson);
+       _INFO("");
+       if (req == NULL) {
+               fidoasm_complete_asm_request(__dbusObj, invocation, -1, ASM_RESP_ACCESS_DENIED);
+               return true;
+       }
+       req->setCallerId(callerId);
+
+       AsmOp *operation = AsmOpFactory::createOperation(req);
+       if (operation == NULL) {
+               _ERR("AsmOp creation failed");
+               fidoasm_complete_asm_request(__dbusObj, invocation, -1, ASM_RESP_ACCESS_DENIED);
+               return true;
+       }
+
+       _INFO("Before operation exec ");
+       char *asmResp = operation->execute();
+       /*For Dereg request coming from Client, there should not be any indication about success/failure*/
+       if ((req->getRequesttype() == "Deregister")) {
+               _INFO("");
+               fidoasm_complete_asm_request(__dbusObj, invocation, -1, ASM_RESP_DEREG);
+               return true;
+       }
+       if (asmResp == NULL) {
+               _ERR("");
+               fidoasm_complete_asm_request(__dbusObj, invocation, -1, ASM_RESP_ACCESS_DENIED);
+               return true;
+       }
+
+       _INFO("After operation exec ");
+       if (asmResp != NULL) {
+               _INFO("%s", asmResp);
+               fidoasm_complete_asm_request(__dbusObj, invocation, 0, asmResp);
+       } else {
+               _INFO("");
+               fidoasm_complete_asm_request(__dbusObj, invocation, -1, RESP_NEG);
+       }
+       _END;
+
+       return true;
+}
+
+gboolean
+ClientListner::onAgentRequest(Fidoasm *object, GDBusMethodInvocation *invocation,
+                                                                       const gchar *tlvReqB64)
+{
+       _BEGIN;
+
+       /*TODO: Caller Id check*/
+
+       AsmRequest *req = NULL;
+
+       std::string callerId = FIDO_BT_RAGENT_SVC_PATH;
+
+       _INFO("Roaming Agent request");
+       if (RoamingUtil::isRASupported() == false) {
+               _ERR("RA feature not supported");
+
+               fidoasm_complete_ra_request(__dbusObj, invocation, -1, ASM_RESP_ACCESS_DENIED);
+               return true;
+       }
+
+       req = RoamingUtil::createAuthReq(tlvReqB64);
+       if (req == NULL) {
+               _ERR("");
+               fidoasm_complete_ra_request(__dbusObj, invocation, -1, ASM_RESP_ACCESS_DENIED);
+               return true;
+       }
+       req->setCallerId(callerId);
+
+
+       AsmOp *operation = AsmOpFactory::createOperation(req);
+       if (operation == NULL) {
+               _ERR("AsmOp creation failed");
+               fidoasm_complete_ra_request(__dbusObj, invocation, -1, ASM_RESP_ACCESS_DENIED);
+               return true;
+       }
+
+       _INFO("Before operation exec ");
+       char *asmResp = operation->execute();
+       if (asmResp == NULL) {
+               _ERR("");
+               fidoasm_complete_ra_request(__dbusObj, invocation, -1, ASM_RESP_ACCESS_DENIED);
+               return true;
+       }
+
+       _INFO("After operation exec ");
+       if (asmResp != NULL) {
+               _INFO("%s", asmResp);
+               fidoasm_complete_ra_request(__dbusObj, invocation, 0, asmResp);
+       } else {
+               _INFO("");
+               fidoasm_complete_ra_request(__dbusObj, invocation, -1, RESP_NEG);
+       }
+       _END;
+
+       return true;
+}
+
+gboolean
+ClientListner::onTCUiResponse(Fidoasm *object, GDBusMethodInvocation *invocation,
+                                          const gchar *nonce, int result)
+{
+       /*TODO: Allow only from org.tizen.asmui*/
+       TcUiAdaptor::OnTcResponseFromUi(nonce, result);
+
+       return true;
+}
+
+gboolean
+ClientListner::onAccountUiResponse(Fidoasm *object, GDBusMethodInvocation *invocation,
+                                          const gchar *nonce, int result, const gchar *account)
+{
+       /*TODO: Allow only from org.tizen.asmui*/
+       AcUiAdaptor::OnAccountResponseFromUi(nonce, result, account);
+
+       return true;
+}
+
+gboolean
+ClientListner::onAuthUiResponse(Fidoasm *object, GDBusMethodInvocation *invocation,
+                                          int uiType, const gchar *nonce, int error,
+                                                               const gchar *token)
+{
+       /*TODO: Allow only from org.tizen.asmui*/
+       IAuthUiAdaptor *uiAd = AuthUiFactory::getAuthUiAdaptor((auth_ui_type_e)uiType);
+       RET_IF_FAIL(uiAd != NULL, false);
+
+       if (nonce == NULL)
+               _INFO("Nonce received from to UI=[NULL]");
+       else
+               _INFO("Nonce received from to UI=[%s]", nonce);
+
+       uiAd->OnAuthResponseFromUi(nonce, token, error);
+
+       return true;
+}
+
+void
+ClientListner::onBusAcquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
+{
+
+       _BEGIN;
+
+       GDBusInterfaceSkeleton* interface = NULL;
+       __dbusObj = fidoasm_skeleton_new();
+       if (__dbusObj == NULL) {
+               return;
+       }
+
+       interface = G_DBUS_INTERFACE_SKELETON(__dbusObj);
+       if (!g_dbus_interface_skeleton_export(interface, connection, ASM_DBUS_PATH, NULL)) {
+               return;
+       }
+
+       g_signal_connect(__dbusObj, "handle_asm_request",
+                                       G_CALLBACK(ClientListner::onClientRequest), NULL);
+
+       g_signal_connect(__dbusObj, "handle_ra_request",
+                                       G_CALLBACK(ClientListner::onAgentRequest), NULL);
+
+       g_signal_connect(__dbusObj, "handle_asm_ui_confirm_tc",
+                                       G_CALLBACK(ClientListner::onTCUiResponse), NULL);
+
+       g_signal_connect(__dbusObj, "handle_asm_ui_confirm_acc",
+                                       G_CALLBACK(ClientListner::onAccountUiResponse), NULL);
+
+       g_signal_connect(__dbusObj, "handle_auth_ui_result",
+                                       G_CALLBACK(ClientListner::onAuthUiResponse), NULL);
+
+       _END;
+
+}
+
+void
+ClientListner::onNameAcquired(GDBusConnection *connection,
+                                               const gchar *name,
+                                               gpointer user_data)
+{
+
+
+}
+
+void
+ClientListner::onNameLost(GDBusConnection *connection,
+                                               const gchar *name,
+                                               gpointer user_data)
+{
+               exit (1);
+}
+
+bool
+ClientListner::initDbus(void)
+{
+
+       _BEGIN;
+
+       __ownerId = g_bus_own_name (G_BUS_TYPE_SYSTEM,
+                                                        ASM_DBUS_NAME,
+                                                        G_BUS_NAME_OWNER_FLAGS_NONE,
+                                                        ClientListner::onBusAcquired,
+                                                        ClientListner::onNameAcquired,
+                                                        ClientListner::onNameAcquired,
+                                                        NULL,
+                                                        NULL);
+
+
+       if(__ownerId == 0) {
+                       return false;
+       }
+
+       _END;
+
+       return true;
+}
+
+void
+ClientListner::initialize(void)
+{
+#if !GLIB_CHECK_VERSION(2,35,0)
+       g_type_init();
+#endif
+
+       if (initDbus() == false) {
+               exit(1);
+       }
+}
+
+int
+ClientListner::start(void)
+{
+       if (__this == NULL)
+               return -1;
+
+       _BEGIN;
+
+       GMainLoop *mainloop = NULL;
+
+       mainloop = g_main_loop_new(NULL, FALSE);
+
+       initialize();
+
+       g_main_loop_run(mainloop);
+
+       _END;
+
+       return 0;
+}
diff --git a/server/src/asm_main.cpp b/server/src/asm_main.cpp
new file mode 100644 (file)
index 0000000..72e2481
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 - 2015 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 <tizen.h>
+#include "ClientListener.h"
+
+int
+main(int argc, char *argv[])
+{
+       ClientListner::getInstance()->start();
+       return 0;
+}
diff --git a/server/states/inc/AuthenticateState.h b/server/states/inc/AuthenticateState.h
new file mode 100644 (file)
index 0000000..f896856
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014 - 2015 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 AUTHENTICATESTATE_H_
+#define AUTHENTICATESTATE_H_
+
+#include "IAsmOpState.h"
+#include "AsmRegRequest.h"
+#include "AsmAuthRequest.h"
+#include "AuthnrTypes.h"
+
+class AuthenticateState : public IAsmOpState {
+public:
+       AuthenticateState(void);
+       virtual ~AuthenticateState(void);
+
+       virtual int handle(IAuthStub *stub, AsmRequest *asmReq, const char *str, char **out);
+private:
+       int selectUsernameKeyHandle(AuthenticateReq *signAuthReq, AuthenticateResp *stubResp);
+       AuthenticateReq* createStubRequestSign(AsmRequest *asmReq, const char *vTok);
+};
+
+
+
+#endif /* AUTHENTICATESTATE_H_ */
diff --git a/server/states/inc/DeregState.h b/server/states/inc/DeregState.h
new file mode 100644 (file)
index 0000000..0d63527
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014 - 2015 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 DEREGSTATE_H_
+#define DEREGSTATE_H_
+
+#include "IAsmOpState.h"
+#include "AsmRegRequest.h"
+#include "AuthnrTypes.h"
+
+class DeregState : public IAsmOpState {
+public:
+       DeregState(void);
+       virtual ~DeregState(void);
+
+       virtual int handle(IAuthStub *authStub, AsmRequest *asmReq, const char *str, char **out);
+
+private:
+       int deleteAsmRecord(char *appId, char *keyId);
+       DeregReq* createStubRequestDereg(AsmRequest *asmReq, bool isBound);
+};
+
+
+
+#endif /* DEREGSTATE_H_ */
diff --git a/server/states/inc/EnrollState.h b/server/states/inc/EnrollState.h
new file mode 100644 (file)
index 0000000..25d5a9e
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014 - 2015 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 ENROLLSTATE_H_
+#define ENROLLSTATE_H_
+
+#include "IAsmOpState.h"
+#include "AsmRegRequest.h"
+
+class EnrollState : public IAsmOpState {
+public:
+       EnrollState(void);
+       virtual ~EnrollState(void);
+
+       virtual int handle(IAuthStub *stub, AsmRequest *asmReq, const char *str, char **out);
+
+private:
+       char *composeEnrollRequest(const char *appId, const char *aaid);
+};
+
+
+
+#endif /* ENROLLSTATE_H_ */
diff --git a/server/states/inc/GetRegsState.h b/server/states/inc/GetRegsState.h
new file mode 100644 (file)
index 0000000..f6747f1
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef GETREGSSTATE_H
+#define GETREGSSTATE_H
+
+#include "IAsmOpState.h"
+#include "AsmDeregRequest.h"
+#include "AuthnrTypes.h"
+
+class GetRegsState : public IAsmOpState {
+public:
+       GetRegsState(void);
+       virtual ~GetRegsState(void);
+
+       virtual int handle(IAuthStub *authStub, AsmRequest *asmReq, const char *str, char **out);
+};
+
+#endif // GETREGSSTATE_H
diff --git a/server/states/inc/IAsmOpState.h b/server/states/inc/IAsmOpState.h
new file mode 100644 (file)
index 0000000..ee47833
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2014 - 2015 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 IASMOPSTATE_H_
+#define IASMOPSTATE_H_
+
+#include <vector>
+#include <string>
+#include "AsmRequest.h"
+
+class IAuthStub;
+
+class IAsmOpState {
+public:
+       virtual ~IAsmOpState(void){}
+
+       virtual int handle(IAuthStub *stub, AsmRequest *asmReq, const char *str, char **out) = 0;
+};
+
+
+
+#endif /* IASMOPSTATE_H_ */
diff --git a/server/states/inc/InitState.h b/server/states/inc/InitState.h
new file mode 100644 (file)
index 0000000..7c9c5c2
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014 - 2015 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 INITSTATE_H_
+#define INITSTATE_H_
+
+#include "IAsmOpState.h"
+#include "AsmRegRequest.h"
+
+class InitState : public IAsmOpState {
+public:
+       InitState(void);
+       virtual ~InitState(void);
+
+       virtual int handle(IAuthStub *stub, AsmRequest *asmReq, const char *str, char **out);
+};
+
+
+#endif /* INITSTATE_H_ */
diff --git a/server/states/inc/RegisterState.h b/server/states/inc/RegisterState.h
new file mode 100644 (file)
index 0000000..1d57533
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014 - 2015 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 REGISTERSTATE_H_
+#define REGISTERSTATE_H_
+
+#include "IAsmOpState.h"
+#include "AuthnrTypes.h"
+
+class AsmRequest;
+
+class RegisterState : public IAsmOpState {
+public:
+       RegisterState(void);
+       virtual ~RegisterState();
+
+       virtual int handle(IAuthStub *stub, AsmRequest *asmReq, const char *str, char **out);
+
+private:
+       RegisterReq* createStubRequestRegister(AsmRequest *asmReq, const char *vTok);
+};
+
+
+
+#endif /* REGISTERSTATE_H_ */
diff --git a/server/states/inc/TCState.h b/server/states/inc/TCState.h
new file mode 100644 (file)
index 0000000..1b3b003
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014 - 2015 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 TCSTATE_H
+#define TCSTATE_H
+
+#include "IAsmOpState.h"
+#include "AuthnrTypes.h"
+
+class AsmRequest;
+
+class TCState : public IAsmOpState {
+public:
+       TCState(void);
+       virtual ~TCState();
+
+       virtual int handle(IAuthStub *stub, AsmRequest *asmReq, const char *str, char **out);
+
+private:
+       int getInfoForUi(AsmRequest *asmReq,
+                                        std::vector<std::string> **tcList, char **appId);
+};
+
+#endif // TCSTATE_H
diff --git a/server/states/inc/VerifyState.h b/server/states/inc/VerifyState.h
new file mode 100644 (file)
index 0000000..1f167e9
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014 - 2015 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 VERIFYSTATE_H_
+#define VERIFYSTATE_H_
+
+#include "IAsmOpState.h"
+#include "AsmRegRequest.h"
+
+class VerifyState : public IAsmOpState {
+public:
+       VerifyState(void);
+       virtual ~VerifyState(void);
+
+       virtual int handle(IAuthStub *stub, AsmRequest *asmReq, const char *str, char **out);
+};
+
+
+
+#endif /* VERIFYSTATE_H_ */
diff --git a/server/states/src/AuthenticateState.cpp b/server/states/src/AuthenticateState.cpp
new file mode 100644 (file)
index 0000000..1170927
--- /dev/null
@@ -0,0 +1,456 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "AuthenticateState.h"
+#include "AsmAuthRequest.h"
+#include "AsmAuthResponse.h"
+#include "AsmHelper.h"
+#include "IAuthStub.h"
+#include "JsonUtil.h"
+#include "asmcrypto.h"
+#include "AsmStorage.h"
+#include "AuthManager.h"
+#include "AsmResponse.h"
+#include "AuthManager.h"
+#include <stdlib.h>
+#include <vector>
+#include "RoamingUtil.h"
+#include "TCUiAdaptor.h"
+#include "AcUiAdaptor.h"
+
+AuthenticateState::AuthenticateState(void)
+{
+
+}
+
+AuthenticateState::~AuthenticateState()
+{
+
+}
+
+int
+AuthenticateState::selectUsernameKeyHandle(AuthenticateReq *signAuthReq, AuthenticateResp *stubResp)
+{
+       AcUiAdaptor *uiAd = AcUiAdaptor::getInstance();
+       if (uiAd == NULL) {
+               _INFO("AcUiAdaptor FAILED");
+               return -1;
+       }
+
+       _INFO("Waiting User Input...");
+
+       std::vector<std::string> accList;
+       std::map<char*, Buffer*> ukHmap;
+       Buffer *keyHandle = NULL;
+
+       GList *uKhListIter = NULL;
+       uKhListIter = g_list_first(stubResp->uKhList);
+
+       while(uKhListIter != NULL) {
+               UserNameKeyHandle *uKh = (UserNameKeyHandle*)uKhListIter->data;
+               //Case:: Two same usernames in the list
+               bool isFound = false;
+               std::vector<std::string>::iterator it = accList.begin();
+
+               for(; it != accList.end(); it++) {
+                       if(strcmp(uKh->userName, (*it).c_str()) == 0) {
+                               isFound = true;
+                               break;
+                       }
+               }
+
+               if(isFound == true) {
+                       ukHmap[uKh->userName] = uKh->kh;
+               }
+               else {
+                       std::string usrStr(uKh->userName);
+                       accList.push_back(usrStr);
+                       char *userName = uKh->userName;
+                       keyHandle = uKh->kh;
+                       ukHmap.insert(std::pair<char*, Buffer*>(userName, keyHandle));
+               }
+               uKhListIter = uKhListIter->next;
+       }
+
+       /*
+        * TODO: AsmCrypto::getAppId is crashing inside pkgmgrinfo_pkginfo_get_list
+        * after callback processing is done, temp blocking
+        *
+       std::string appIdPubKey = signAuthReq->appId;
+       char *appId = AsmCrypto::getAppId(strdup(appIdPubKey.c_str()));
+       RET_IF_FAIL(appId != NULL, -1);
+
+       _INFO("");
+       char *savePtr;
+       strtok_r(appId, ".", &savePtr);
+       strtok_r(NULL, ".", &savePtr);
+       char *appName = savePtr;
+       RET_IF_FAIL(appName != NULL, -1);
+       std::string appNameStr(appName);
+
+       int uiErr = -1;
+       //TODO If accList length is 1, then no need of UI, just select the one based on timestamp.
+       std::string acc = uiAd->confirmAccount(appNameStr, accList, &uiErr);
+       if(acc.empty() == true)
+               return -1;
+       */
+
+       std::string acc = accList.at(0);
+       _INFO("AuthenticateState::handle:: confirmAccount = [%s]", acc.c_str());
+
+       std::map<char*, Buffer*>::iterator it = ukHmap.begin();
+       keyHandle = NULL;
+       for(; it != ukHmap.end(); it++) {
+               if(strcmp(it->first, acc.c_str()) == 0)
+                       keyHandle = it->second;
+       }
+       signAuthReq->khHList = NULL;
+       signAuthReq->khHList = g_list_append(signAuthReq->khHList, keyHandle->data);
+
+       return 0;
+}
+
+AuthenticateReq*
+AuthenticateState::createStubRequestSign(AsmRequest *asmReq, const char *vTok)
+{
+       _BEGIN;
+
+       RET_IF_FAIL(asmReq != NULL, NULL);
+
+       int authId = asmReq->getAuthIndex();
+
+       IAuthStub *authStub = AuthManager::getInstance()->getAuthStub(authId);
+       if (authStub == NULL) {
+               _ERR("Stub not found for [%d]", authId);
+               return NULL;
+       }
+
+       AuthenticateReq *signAuthReq = (AuthenticateReq*)calloc(1, sizeof(AuthenticateReq));
+
+       AsmAuthRequest *asmSignReq = (AsmAuthRequest*)(asmReq->getArgs());
+
+       signAuthReq->authIdx    = authId;
+       signAuthReq->appId = _SAFE_DUP(asmSignReq->getAppId().c_str());
+       signAuthReq->fch = authStub->hash(asmSignReq->getFCH().c_str());
+       signAuthReq->userVToken = _SAFE_DUP(vTok);
+
+       std::vector<Transaction*> trList = asmSignReq->getTCs();
+       _INFO("TC list  size = [%d]", trList.size());
+       if (trList.size() > 0) {
+               std::vector<Transaction*>::iterator it = trList.begin();
+               Transaction *trans = *it;
+               signAuthReq->tc = (char*)trans->__content.c_str();
+               _INFO("AuthenticateState::createStubRequestSign:: Transaction Content = [%s]", signAuthReq->tc);
+       }
+
+       bool isBound = false;
+
+       _INFO("");
+       GList *authList = authStub->getInfo()->authList;
+       GList *authListIter = g_list_first(authList);
+       if (authListIter != NULL) {
+               AuthenticatorInfo *authInfo = (AuthenticatorInfo*)(authListIter->data);
+               if (authInfo->__isRoamingAuthenticator == false) {
+                       isBound = true;
+               }
+       }
+
+       if (isBound == false) {
+
+               _INFO("To Roaming Authenticator");
+               if (asmSignReq->getKeyIds().size() > 0) {
+                       std::vector<std::string> kIdList = asmSignReq->getKeyIds();
+                       std::vector<std::string>::iterator kIdIter = kIdList.begin();
+                       for (; kIdIter != kIdList.end(); ++kIdIter) {
+                               std::string kIdStr = *kIdIter;
+                               signAuthReq->khHList = g_list_append(signAuthReq->khHList, strdup(kIdStr.c_str()));
+                       }
+               }
+       }
+       else {
+
+               _INFO("To Bound Authenticator");
+               std::vector<std::string> kIdList = asmSignReq->getKeyIds();
+
+               if(!kIdList.empty()) {
+
+                       std::vector<std::string>::iterator kIdIter = kIdList.begin();
+
+                       for (; kIdIter != kIdList.end(); ++kIdIter) {
+
+                               std::string kIdStr = *kIdIter;
+                               _INFO("AuthenticateState::createStubRequestSign:: key id = [%s]", kIdStr.c_str());
+
+                               IStorageParcel *searchParcel = new AsmStorageParcel();
+
+                               searchParcel->setString(STR_PROP_APP_ID, asmSignReq->getAppId());
+                               searchParcel->setString(STR_PROP_KEY_ID, kIdStr);
+                               std::vector<IStorageParcel*> *searchRes = AsmStorage::getInstance()->searchData(searchParcel);
+
+                               if (searchRes != NULL) {
+
+                                       _INFO("AuthenticateState::createStubRequestSign:: Records found in database corresponding to keyId = [%d]", searchRes->size());
+                                       std::vector<IStorageParcel*>::iterator searchResIter = searchRes->begin();
+
+                                       for (; searchResIter != searchRes->end(); ++searchResIter) {
+
+                                               _INFO("AuthenticateState::createStubRequestSign:: inside searchRes loop");
+                                               IStorageParcel *parcel = *searchResIter;
+                                               char *kh = NULL;
+                                               int res = parcel->getString(STR_PROP_KEY_HANDLE, &kh);
+
+                                               if (res == 0)
+                                               {
+                                                       _INFO("AuthenticateState::createStubRequestSign:: Length of b64 encoded keyHandle : [%d]", strlen(kh));
+                                                       signAuthReq->khHList = g_list_append(signAuthReq->khHList, kh);
+                                               }
+                                               else
+                                                       _INFO("AuthenticateState::createStubRequestSign:: AsmStorageParcel::getString FAIL");
+                                       }
+                                       signAuthReq->khHList = g_list_first(signAuthReq->khHList);
+                               }
+                       }
+               }
+               else {
+                       _INFO("AuthenticateState::createStubRequestSign:: KeyId empty");
+                       IStorageParcel *searchParcel = new AsmStorageParcel();
+
+                       searchParcel->setString(STR_PROP_APP_ID, asmSignReq->getAppId());
+                       std::vector<IStorageParcel*> *searchRes = AsmStorage::getInstance()->searchData(searchParcel);
+
+                       if (searchRes != NULL) {
+
+                               _INFO("AuthenticateState::createStubRequestSign::Records found in database corresponding to appId = [%d]", searchRes->size());
+                               std::vector<IStorageParcel*>::iterator searchResIter = searchRes->begin();
+
+                               for (; searchResIter != searchRes->end(); ++searchResIter) {
+
+                                       IStorageParcel *parcel = *searchResIter;
+                                       char *kh = NULL;
+                                       int res = parcel->getString(STR_PROP_KEY_HANDLE, &kh);
+
+                                       if (res == 0)
+                                       {
+                                               _INFO("AuthenticateState::createStubRequestSign:: Length of b64 encoded keyHandle : [%d]", strlen(kh));
+                                               signAuthReq->khHList = g_list_append(signAuthReq->khHList, kh);
+                                       }
+                               }
+                               signAuthReq->khHList = g_list_first(signAuthReq->khHList);
+                       }
+               }
+       }
+
+       _INFO("");
+       /*KHAccessToken = Hash(AppId, FIDO Client ID, PersonaId, AsmToken)*/
+       signAuthReq->khATok = authStub->hash(AsmCrypto::getKHAccessToken(asmSignReq->getAppId(), isBound));
+
+       _END;
+       return signAuthReq;
+}
+
+int
+AuthenticateState::handle(IAuthStub *stub, AsmRequest *asmReq, const char *str, char **out)
+{
+       _BEGIN;
+
+       RET_IF_FAIL(stub != NULL, -1);
+
+       /*Coming from Roaming Agent Service*/
+       /*Only Bound Auth allowed*/
+       if(asmReq->getCustomRequest() != NULL) {
+               AuthenticateReq *signAuthReq = (AuthenticateReq*)asmReq->getCustomRequest();
+               RET_IF_FAIL(signAuthReq != NULL, -1);
+
+               if ((signAuthReq->khHList == NULL) ||
+                               (g_list_length(signAuthReq->khHList) <= 0)) {
+                       _INFO("No keys specified, selecting all");
+
+                       IStorageParcel *searchParcel = new AsmStorageParcel();
+
+                       std::string appIdStr(signAuthReq->appId);
+                       searchParcel->setString(STR_PROP_APP_ID, appIdStr);
+                       std::vector<IStorageParcel*> *searchRes = AsmStorage::getInstance()->searchData(searchParcel);
+
+                       if (searchRes != NULL) {
+
+                               int recFound = searchRes->size();
+                               _INFO("Records found in database corresponding to appId = [%d]", recFound);
+                               if (recFound <= 0) {
+                                       _ERR("No key registered for this app");
+                                       return -1;
+                               }
+
+                               std::vector<IStorageParcel*>::iterator searchResIter = searchRes->begin();
+
+                               for (; searchResIter != searchRes->end(); ++searchResIter) {
+
+                                       IStorageParcel *parcel = *searchResIter;
+                                       char *kh = NULL;
+                                       int res = parcel->getString(STR_PROP_KEY_HANDLE, &kh);
+
+                                       if (res == 0) {
+                                               _INFO("Length of b64 encoded keyHandle : [%d]", strlen(kh));
+                                               signAuthReq->khHList = g_list_append(signAuthReq->khHList, kh);
+                                       }
+                               }
+                               signAuthReq->khHList = g_list_first(signAuthReq->khHList);
+                       }
+
+               } else {
+                       /* RA mode, Client dev ASM sends keyID as keyHandle, so we need to get the
+                        * actual keyHandle from storage (search key = keyID)
+                       */
+
+                       IStorageParcel *searchParcel = new AsmStorageParcel();
+                       std::string appIdStr(signAuthReq->appId);
+                       searchParcel->setString(STR_PROP_APP_ID, appIdStr);
+
+                       GList *storedKhList = NULL;
+                       GList *recvdKhListIter = g_list_first(signAuthReq->khHList);
+
+                       while (recvdKhListIter != NULL) {
+
+                                       char *recvKh = (char*)(recvdKhListIter->data);
+                                       unsigned char *recvKhDec = AsmCrypto::ToBase64Url((unsigned char*)recvKh, strlen(recvKh));
+                                       if (recvKhDec != NULL) {
+
+                                               std::string kIdStr((char*)recvKhDec);
+                                               searchParcel->setString(STR_PROP_KEY_ID, kIdStr);
+                                               _INFO("search=[%s][%s]", appIdStr.c_str(), kIdStr.c_str());
+
+                                               std::vector<IStorageParcel*> *searchRes = AsmStorage::getInstance()->searchData(searchParcel);
+                                               if (searchRes != NULL) {
+
+                                                       int recFound = searchRes->size();
+                                                       _INFO("Records found in database corresponding to appId = [%d]", recFound);
+                                                       if (recFound <= 0) {
+                                                               _INFO("No key registered for this app");
+                                                       }
+
+                                                       std::vector<IStorageParcel*>::iterator searchResIter = searchRes->begin();
+
+                                                       for (; searchResIter != searchRes->end(); ++searchResIter) {
+
+                                                               IStorageParcel *parcel = *searchResIter;
+                                                               char *kh = NULL;
+                                                               int res = parcel->getString(STR_PROP_KEY_HANDLE, &kh);
+
+                                                               if (res == 0) {
+                                                                       _INFO("Length of b64 encoded keyHandle : [%d]", strlen(kh));
+                                                                       storedKhList = g_list_append(storedKhList, kh);
+                                                               }
+                                                       }
+                                               }
+                               }
+
+                               recvdKhListIter = recvdKhListIter->next;
+                       }
+                       if (storedKhList != NULL) {
+                               storedKhList = g_list_first(storedKhList);
+                               signAuthReq->khHList = storedKhList;
+                               _INFO("Matched khlist count =[%d]", g_list_length(signAuthReq->khHList));
+                       } else {
+                               signAuthReq->khHList = NULL;
+                               _ERR("NO Matched khlist");
+                       }
+               }
+
+               AuthenticateResp *stubResp = stub->processAuthenticate(signAuthReq);
+               RET_IF_FAIL(stubResp != NULL, -1);
+
+               if(stubResp->uKhList != NULL) {
+                       int ret = selectUsernameKeyHandle(signAuthReq, stubResp);
+                       RET_IF_FAIL(ret == 0, -1);
+
+                       stubResp = NULL;
+                       stubResp = stub->processAuthenticate(signAuthReq);
+                       RET_IF_FAIL(stubResp != NULL, -1);
+               }
+
+               char *tlvRespB64 = RoamingUtil::composeAuthSignResponse(stubResp);
+               if (tlvRespB64 != NULL) {
+                       *out = tlvRespB64;
+               }
+       }
+       else
+       {
+               /*Coming from FIDO Client Service*/
+
+               AuthenticateReq *signAuthReq = createStubRequestSign(asmReq, str);
+               RET_IF_FAIL(signAuthReq != NULL, -1);
+
+               if ((signAuthReq->khHList == NULL) ||
+                               (g_list_length(signAuthReq->khHList) <= 0)) {
+
+                       if (stub->getType() != AUTH_TYPE_ROAMING) {
+                               _ERR("No keys registered");
+
+                               return UAF_CMD_STATUS_ACCESS_DENIED;
+                       } else {
+                               _INFO("For roaming there will not be any previous stored keyids");
+                       }
+               }
+
+               AuthenticateResp *stubResp = stub->processAuthenticate(signAuthReq);
+               RET_IF_FAIL(stubResp != NULL, -1);
+
+               /* ASM UI call when username-keyHandle list is not NULL*/
+               if(stub->getType() == AUTH_TYPE_BOUND) {
+                       if(stubResp->uKhList != NULL) {
+                               int ret = selectUsernameKeyHandle(signAuthReq, stubResp);
+                               RET_IF_FAIL(ret == 0, -1);
+                       }
+
+                       stubResp = NULL;
+                       stubResp = stub->processAuthenticate(signAuthReq);
+                       RET_IF_FAIL(stubResp != NULL, -1);
+               }
+
+               AsmResponse *asmSignResp = new AsmResponse();
+               AsmAuthResponse *respData = new AsmAuthResponse();
+
+               asmSignResp->__statusCode = 0;
+
+
+               char *assrtScheme = NULL;
+               Buffer *assrtInfo = stub->encodeSignRespone(stubResp->authAssertion, &assrtScheme);
+               if (assrtInfo == NULL || assrtInfo->data == NULL) {
+                       _ERR("encodeSignRespone failed");
+                       return -1;
+               }
+
+               _INFO("Authenticate Assertion length = [%d]", assrtInfo->len);
+               _INFO("Authenticate Assertion : [%s]", assrtInfo->data);
+
+               unsigned char *assrtStrData = AsmCrypto::ToBase64Url(assrtInfo->data, assrtInfo->len);
+
+               std::string assrtStr((const char *)assrtStrData, strlen((char*)assrtStrData));
+               std::string assrtSchemeStr((const char *)(assrtScheme), strlen(assrtScheme));
+
+               respData->__assertion = assrtStr;
+               respData->__assertionScheme = assrtSchemeStr;
+               asmSignResp->__respData = respData;
+
+               char *signRespJson = JsonUtil::composeAsmAuthenticateResponse(asmSignResp);
+               RET_IF_FAIL(signRespJson != NULL, -1);
+
+               *out = signRespJson;
+       }
+
+       _END;
+       return 0;
+}
diff --git a/server/states/src/DeregState.cpp b/server/states/src/DeregState.cpp
new file mode 100644 (file)
index 0000000..fcf5b48
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "DeregState.h"
+
+#include "AuthManager.h"
+#include "AsmHelper.h"
+#include "JsonUtil.h"
+#include "AsmRegRequest.h"
+#include "asmcrypto.h"
+#include "AsmStorage.h"
+#include "AsmDeregRequest.h"
+#include "AsmDeregResponse.h"
+#include "AsmResponse.h"
+#include "RoamingUtil.h"
+#include <vector>
+
+#include <stdlib.h>
+
+DeregState::DeregState(void)
+{
+
+}
+
+DeregState::~DeregState(void)
+{
+
+}
+
+int
+DeregState::deleteAsmRecord(char *appId, char *keyId)
+{
+       IStorageParcel *parcel = new AsmStorageParcel();
+
+       int setAppId = parcel->setString(STR_PROP_APP_ID, appId);
+       int setKeyId = parcel->setString(STR_PROP_KEY_ID, keyId);
+
+       if(setAppId == 0 && setKeyId == 0) {
+               int ret = AsmStorage::getInstance()->deleteData(parcel);
+
+               if(ret == SQLITE_ERROR) {
+                       _INFO("Record Deleted :: FAIL");
+                       return -1;
+               }
+               _INFO("Record Deleted :: SUCCESS");
+       }
+
+       return 0;
+}
+
+DeregReq*
+DeregState::createStubRequestDereg(AsmRequest *asmReq, bool isBound)
+{
+       RET_IF_FAIL(asmReq != NULL, NULL);
+
+       int authId = asmReq->getAuthIndex();
+
+       IAuthStub *authStub = AuthManager::getInstance()->getAuthStub(authId);
+       if (authStub == NULL) {
+               _ERR("Stub not found for [%d]", authId);
+               return NULL;
+       }
+
+       DeregReq *deRegAuthReq = (DeregReq*)calloc(1, sizeof(DeregReq));
+
+       AsmDeregRequest *asmDeRegReq = (AsmDeregRequest*)(asmReq->getArgs());
+
+       deRegAuthReq->authIdx   = authId;
+       deRegAuthReq->appId = _SAFE_DUP(asmDeRegReq->getAppId().c_str());
+       deRegAuthReq->keyId = _SAFE_DUP(asmDeRegReq->getKeyId().c_str());
+
+       /*KHAccessToken = Hash(AppId, FIDO Client ID, PersonaId, AsmToken)*/
+       deRegAuthReq->khATok = authStub->hash(AsmCrypto::getKHAccessToken(asmDeRegReq->getAppId(),isBound));
+
+       return deRegAuthReq;
+}
+
+int
+DeregState::handle(IAuthStub *authStub, AsmRequest *asmReq, const char *str, char **out)
+{
+       _INFO("");
+       RET_IF_FAIL(authStub != NULL, -1);
+
+       /*Coming from Roaming Agent Service*/
+       /*Only Bound Auth allowed*/
+       if(asmReq->getCustomRequest() != NULL) {
+
+               _INFO("");
+               DeregReq *deRegAuthReq = (DeregReq*)asmReq->getCustomRequest();
+               if (deRegAuthReq->keyId == NULL) {
+                       _ERR("KeyID to deregister can not be NULL");
+                       return -1;
+               }
+
+               unsigned char *keyIdEnc = AsmCrypto::ToBase64Url((unsigned char*)deRegAuthReq->keyId,
+                                                                                               strlen(deRegAuthReq->keyId));
+               if (keyIdEnc == NULL) {
+                       _ERR("KeyID ToBase64Url failed");
+                       return -1;
+               }
+
+               _INFO("About to delete=[%s][%s]", deRegAuthReq->appId, (char*)keyIdEnc);
+               int deleteRecord = deleteAsmRecord(deRegAuthReq->appId, (char*)keyIdEnc);
+               if(deleteRecord == -1)
+                       return -1;
+
+               DeregResp *stubResp = authStub->processDeregister(deRegAuthReq);
+               RET_IF_FAIL(stubResp != NULL, -1);
+
+               char *tlvRespB64 = RoamingUtil::composeAuthDeregResponse(stubResp);
+               if (tlvRespB64 != NULL) {
+                       *out = tlvRespB64;
+               }
+       }
+       else {
+
+               _INFO("");
+               /*Coming from FIDO Client Service*/
+
+               AsmDeregRequest *asmDeRegReq = (AsmDeregRequest*)(asmReq->getArgs());
+
+               bool isBound = false;
+
+               GList *authList = authStub->getInfo()->authList;
+               GList *authListIter = g_list_first(authList);
+               if (authListIter != NULL) {
+                       AuthenticatorInfo *authInfo = (AuthenticatorInfo*)(authListIter->data);
+                       if (authInfo->__isRoamingAuthenticator == false) {
+                               isBound = true;
+                               _INFO("");
+                       }
+               }
+
+               if(authStub->getType() == AUTH_TYPE_BOUND) {
+                       if(isBound == true) {
+
+                               _INFO("");
+                               std::string appIdStr = asmDeRegReq->getAppId();
+                               std::string keyIdStr = asmDeRegReq->getKeyId();
+
+                               char *appId = strdup(appIdStr.c_str());
+                               char *keyId = strdup(keyIdStr.c_str());
+                               int deleteRecord = deleteAsmRecord(appId, keyId);
+                               if(deleteRecord == -1)
+                                       return -1;
+                       }
+               }
+
+               _INFO("");
+               DeregReq *deRegAuthReq = createStubRequestDereg(asmReq, isBound);
+               RET_IF_FAIL(deRegAuthReq != NULL, -1);
+
+               _INFO("");
+               DeregResp *stubResp = authStub->processDeregister(deRegAuthReq);
+               RET_IF_FAIL(stubResp != NULL, -1);
+
+               /*ASM need not send any data for dereg response*/
+       }
+
+       _INFO("");
+       return 0;
+}
diff --git a/server/states/src/EnrollState.cpp b/server/states/src/EnrollState.cpp
new file mode 100644 (file)
index 0000000..67cad53
--- /dev/null
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "EnrollState.h"
+
+#include "AsmHelper.h"
+#include "IAuthStub.h"
+#include "AsmRequest.h"
+#include "AsmRegRequest.h"
+#include "AsmAuthRequest.h"
+#include "AsmStorage.h"
+#include "asmcrypto.h"
+#include <vector>
+
+#define STRING_OP_TYPE_GET_INFO "GetInfo"
+#define STRING_OP_TYPE_REG "Register"
+#define STRING_OP_TYPE_AUTH "Authenticate"
+#define STRING_OP_TYPE_DEREG "Deregister"
+#define STRING_OP_TYPE_OPEN_SETTINGS "OpenSettings"
+#define STRING_OP_TYPE_GET_REGS "GetRegistrations"
+
+#define uid 5001
+
+EnrollState::EnrollState(void)
+{
+
+}
+
+EnrollState::~EnrollState()
+{
+
+}
+
+char *
+EnrollState::composeEnrollRequest(const char *appId, const char *aaid)
+{
+       JsonBuilder *builder = json_builder_new();
+
+       json_builder_begin_object(builder);
+
+       json_builder_set_member_name(builder, "appId");
+       json_builder_add_string_value(builder, appId);
+
+       json_builder_set_member_name(builder, "aaid");
+       json_builder_add_string_value(builder, aaid);
+
+       json_builder_end_object(builder);
+
+       JsonNode *root_builder = json_builder_get_root(builder);
+
+       JsonGenerator *gen = json_generator_new();
+       json_generator_set_root(gen, root_builder);
+
+       json_node_free(root_builder);
+       g_object_unref(builder);
+
+       gsize len = 0;
+       char *json = json_generator_to_data(gen, &len);
+       if (json != NULL) {
+               _INFO("compose enroll request success");
+
+               if (gen != NULL)
+                       g_object_unref(gen);
+
+               _INFO("enroll request = [%s]", json);
+               return json;
+       }
+
+       _INFO("compose enroll request failed");
+       g_object_unref(gen);
+
+       return NULL;
+}
+
+int
+EnrollState::handle(IAuthStub *stub, AsmRequest *asmReq, const char *str, char **out)
+{
+       _BEGIN;
+       _INFO("Stub [%p]", stub);
+       RET_IF_FAIL(stub != NULL, -1);
+
+       if (stub->getType() == AUTH_TYPE_ROAMING) {
+               _INFO("Local enrollment not required for Roaming Stub");
+               return 0;
+       }
+
+       if (stub->hasAuthUi() == true) {
+               _INFO("Auth has inbuilt ui, no need of ASM UI");
+               return stub->enroll(str);
+       }
+
+       char *vToken = NULL;
+       std::string aaid;
+       std::string appId;
+       std::string reqType = asmReq->getRequesttype();
+       int mappedIndex = asmReq->getAuthIndex();
+
+       if(strcmp(reqType.c_str(), STRING_OP_TYPE_REG) == 0) {
+               if (asmReq->getCustomRequest() != NULL) {
+                       _INFO("Custom req reg");
+                       RegisterReq *regAuthReq = (RegisterReq*)(asmReq->getCustomRequest());
+                       _INFO("Custom req reg [%p]", regAuthReq);
+                       std::string appIdStr(regAuthReq->appId);
+                       _INFO("Custom req reg [%s]", appIdStr.c_str());
+                       appId = appIdStr;
+                       mappedIndex = regAuthReq->authIdx;
+                       _INFO("Mapped Index=[%d]", mappedIndex);
+               } else {
+                       AsmRegRequest *asmRegReq = (AsmRegRequest*)asmReq->getArgs();
+                       appId = asmRegReq->getAppId();
+               }
+       } else if(strcmp(reqType.c_str(), STRING_OP_TYPE_AUTH) == 0) {
+               if (asmReq->getCustomRequest() != NULL) {
+                       _INFO("Custom req auth");
+                       AuthenticateReq *authAuthReq = (AuthenticateReq*)(asmReq->getCustomRequest());
+                       std::string appIdStr(authAuthReq->appId);
+                       appId = appIdStr;
+                       mappedIndex = authAuthReq->authIdx;
+                       _INFO("Mapped Index=[%d]", mappedIndex);
+               } else {
+                       AsmAuthRequest *asmAuthReq = (AsmAuthRequest*)asmReq->getArgs();
+                       appId = asmAuthReq->getAppId();
+               }
+       } else {
+               return -1;
+       }
+
+       _INFO("Custom req before getInfo");
+       GetAuthInfoResp *getAuthInfoResp = stub->getInfo();
+       if (getAuthInfoResp == NULL) {
+               _ERR("Stub has NULL getinfo");
+               return -1;
+       }
+
+       _INFO("Custom req after getInfo");
+       if (getAuthInfoResp->authList != NULL) {
+
+               _INFO("Iter authlist");
+               GList *authListIter = g_list_first(getAuthInfoResp->authList);
+               while(authListIter != NULL) {
+                       /*TODO __authenticatorIndex is RealIndex, asmReq->AuthIndex is MappedIndex*/
+                       AuthenticatorInfo *authInfo = (AuthenticatorInfo*)(authListIter->data);
+                       _INFO("[%d] vs [%d]", authInfo->__authenticatorIndex, mappedIndex);
+                       if(authInfo->__authenticatorIndex == mappedIndex) {
+                               aaid = authInfo->__aaid;
+                               break;
+                       }
+                       authListIter = authListIter->next;
+               }
+       }
+
+       RET_IF_FAIL(aaid.empty() == false, -1);
+       _INFO("EnrollState::handle:: appId = [%s]", appId.c_str());
+       _INFO("EnrollState::handle:: aaid = [%s]", aaid.c_str());
+
+       IStorageParcel *parcel = new SecretStorageParcel();
+       int res = parcel->setString(STR_PROP_AAID, aaid);
+       if(res != 0)
+               return -1;
+       res = parcel->setString(STR_PROP_DEV_ID, AsmCrypto::getDeviceId());
+       if(res != 0)
+               return -1;
+       res = parcel->setInt(INT_PROP_UID, uid);
+       if(res != 0)
+               return -1;
+
+       std::vector<IStorageParcel*> *resultList = AsmStorage::getInstance()->searchData(parcel);
+       if((resultList == NULL) || resultList->size() == 0) {
+               _INFO("EnrollState::handle:: User not enrolled");
+               _INFO("EnrollState::handle:: Enrolling User...");
+
+               char *enrollJson = composeEnrollRequest(appId.c_str(), aaid.c_str());
+               RET_IF_FAIL(enrollJson != NULL, -1);
+
+               _INFO("enroll json composed success");
+               return stub->enroll(enrollJson);
+       }
+       else {
+               _INFO("EnrollState::handle:: User already enrolled");
+               if(resultList->size() > 1) {
+                       _INFO("EnrollState::handle:: More than one records obtained from Secret Database");
+                       return -1;
+               }
+               std::vector<IStorageParcel*>::iterator it = resultList->begin();
+               IStorageParcel *parcel = (*it);
+               parcel->getString(STR_PROP_SECRET1, &vToken);
+
+               RET_IF_FAIL(vToken != NULL, -1);
+
+               *out = vToken;
+               return 0;
+       }
+
+       return -1;
+}
+
diff --git a/server/states/src/GetRegsState.cpp b/server/states/src/GetRegsState.cpp
new file mode 100644 (file)
index 0000000..27027de
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "GetRegsState.h"
+#include "AsmHelper.h"
+#include "AsmStorage.h"
+#include "AsmGetRegsRequest.h"
+#include "AsmGetRegsResponse.h"
+#include "JsonUtil.h"
+#include "AuthManager.h"
+#include "AsmResponse.h"
+#include <map>
+#include <vector>
+
+#include <stdlib.h>
+
+GetRegsState::GetRegsState(void)
+{
+
+}
+
+GetRegsState::~GetRegsState(void)
+{
+
+}
+
+
+int
+GetRegsState::handle(IAuthStub *authStub, AsmRequest *asmReq, const char *str, char **out)
+{
+       _BEGIN;
+       RET_IF_FAIL(authStub != NULL, -1);
+
+       bool isBound = false;
+
+       GList *authList = authStub->getInfo()->authList;
+       GList *authListIter = g_list_first(authList);
+       if (authListIter != NULL) {
+               AuthenticatorInfo *authInfo = (AuthenticatorInfo*)(authListIter->data);
+               if (authInfo->__isRoamingAuthenticator == false) {
+                       isBound = true;
+               }
+       }
+       if (isBound == false) {
+               /*TODO: Propietary Auth Commands to get reg data*/
+               return -1;
+       }
+
+       std::map<std::string, std::vector<std::string> > regMap;
+
+
+       AsmResponse *asmGetRegResp = new AsmResponse();
+       AsmGetRegsResponse *respData = new AsmGetRegsResponse();
+
+       IStorageParcel *searchParcel = new AsmStorageParcel();
+
+       searchParcel->setInt(INT_PROP_AUTH_IDX, asmReq->getAuthIndex());
+
+       std::vector<IStorageParcel*>* searchRes = AsmStorage::getInstance()->searchData(searchParcel);
+       RET_IF_FAIL(searchRes != NULL, -1);
+
+       std::vector<IStorageParcel*>::iterator searchResIter = searchRes->begin();
+       for (; searchResIter != searchRes->end(); ++searchResIter) {
+               IStorageParcel *parcel = *searchResIter;
+
+               char *appId = NULL;
+               char *kId = NULL;
+               int res = parcel->getString(STR_PROP_APP_ID, &appId);
+               int res1 = parcel->getString(STR_PROP_KEY_ID, &kId);
+
+               if ((res == 0) &&
+                               (res1 == 0)) {
+
+                       std::string appIdStr((const char *)appId, strlen(appId));
+                       std::string kIdStr((const char *)kId, strlen(kId));
+
+                       std::vector<std::string> keyIdList;
+                       std::map<std::string, std::vector<std::string> >::iterator it = regMap.find(appIdStr);
+                       if (it != regMap.end()) {
+                               /*append to key id list*/
+                               keyIdList = it->second;
+                               keyIdList.push_back(kIdStr);
+                               it->second = keyIdList;
+                       }
+                       else {
+                               keyIdList.push_back(kIdStr);
+                               regMap.insert(std::pair<std::string, std::vector<std::string> >(appIdStr, keyIdList));
+                       }
+               }
+       }
+
+
+       std::map<std::string, std::vector<std::string> >::iterator it = regMap.begin();
+       for (; it != regMap.end(); ++it) {
+               AppRegistration appRegdata;
+               appRegdata.__appId = it->first;
+               appRegdata.__keyIdList = it->second;
+
+               respData->__appRegList.push_back(appRegdata);
+       }
+
+       asmGetRegResp->__statusCode = UAF_ASM_STATUS_OK;
+       asmGetRegResp->__respData = respData;
+
+       char *asmResp = JsonUtil::composeAsmGetRegsResponse(asmGetRegResp);
+       RET_IF_FAIL(asmResp != NULL, -1);
+
+       *out = asmResp;
+
+       _END;
+       return 0;
+}
diff --git a/server/states/src/InitState.cpp b/server/states/src/InitState.cpp
new file mode 100644 (file)
index 0000000..c537abb
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "InitState.h"
+
+#include "AsmHelper.h"
+#include "IAuthStub.h"
+#include <vector>
+
+InitState::InitState(void)
+{
+       _INFO("");
+}
+
+InitState::~InitState(void)
+{
+       _INFO("");
+}
+
+int
+InitState::handle(IAuthStub *stub, AsmRequest *asmReq, const char *str, char **out)
+{
+       RET_IF_FAIL(stub != NULL, -1);
+
+       return 0;//stub->connect();
+}
diff --git a/server/states/src/RegisterState.cpp b/server/states/src/RegisterState.cpp
new file mode 100644 (file)
index 0000000..1eff7d0
--- /dev/null
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "RegisterState.h"
+
+#include "AsmHelper.h"
+#include "IAuthStub.h"
+#include "JsonUtil.h"
+#include "AuthManager.h"
+#include "AsmRegRequest.h"
+#include "asmcrypto.h"
+#include "AsmStorage.h"
+#include "AsmResponse.h"
+#include "AsmRegResponse.h"
+#include "AsmRegResponse.h"
+#include "RoamingUtil.h"
+#include "AuthIndexHanlder.h"
+
+#include <stdlib.h>
+
+RegisterState::RegisterState(void)
+{
+
+}
+
+RegisterState::~RegisterState()
+{
+
+}
+
+RegisterReq*
+RegisterState::createStubRequestRegister(AsmRequest *asmReq, const char *vTok)
+{
+       RET_IF_FAIL(asmReq != NULL, NULL);
+
+       int mappedIndex = asmReq->getAuthIndex();
+       int authIndex = mappedIndex;//AuthIndexHandler::getInstance()->getAuthIndex(mappedIndex);
+
+       IAuthStub *authStub = AuthManager::getInstance()->getAuthStub(authIndex);
+       if (authStub == NULL) {
+               _ERR("Stub not found for [%d]", authIndex);
+               return NULL;
+       }
+
+       RegisterReq *regAuthReq = (RegisterReq*)calloc(1, sizeof(RegisterReq));
+
+       AsmRegRequest *asmRegReq = static_cast<AsmRegRequest*>(asmReq->getArgs());
+
+       regAuthReq->authIdx     = authIndex;
+       regAuthReq->appId = _SAFE_DUP(asmRegReq->getAppId().c_str());
+       regAuthReq->attType = asmRegReq->getAttestationType();
+       regAuthReq->fch = authStub->hash(asmRegReq->getFinalChallenge().c_str());
+       regAuthReq->userName = _SAFE_DUP(asmRegReq->getUserName().c_str());
+       regAuthReq->userVToken = _SAFE_DUP(vTok);
+
+       bool isBound = false;
+
+       GList *authList = authStub->getInfo()->authList;
+       GList *authListIter = g_list_first(authList);
+       if (authListIter != NULL) {
+               AuthenticatorInfo *authInfo = (AuthenticatorInfo*)(authListIter->data);
+               if (authInfo->__isRoamingAuthenticator == false) {
+                       isBound = true;
+               }
+       }
+       /*KHAccessToken = Hash(AppId, FIDO Client ID, PersonaId, AsmToken)*/
+       regAuthReq->khAccessToken = authStub->hash(AsmCrypto::getKHAccessToken(asmRegReq->getAppId()
+                                                                                                                                                  , isBound));
+
+       return regAuthReq;
+}
+
+int
+RegisterState::handle(IAuthStub *stub, AsmRequest *asmReq, const char *str, char **out)
+{
+       RET_IF_FAIL(stub != NULL, -1);
+
+       _INFO("Stub = [%p]", stub);
+
+       /*Coming from Roaming Agent Service*/
+       /*Only Bound Auth allowed*/
+       if (asmReq->getCustomRequest() != NULL) {
+
+               /*Since this is TLV request, so this is expected to have proper AuthIndex*/
+               RegisterReq *regAuthReq = (RegisterReq*)(asmReq->getCustomRequest());
+               RegisterResp *stubResp = stub->processRegister(regAuthReq);
+               RET_IF_FAIL(stubResp != NULL, -1);
+
+               GList *authList = stub->getInfo()->authList;
+               GList *authListIter = g_list_first(authList);
+               if (authListIter != NULL) {
+                       AuthenticatorInfo *authInfo = (AuthenticatorInfo*)(authListIter->data);
+
+                       IStorageParcel *regParcel = new AsmStorageParcel();
+                       regParcel->setInt(INT_PROP_AUTH_IDX, authInfo->__authenticatorIndex);
+
+                       std::string appIdStr((const char *)(regAuthReq->appId), strlen(regAuthReq->appId));
+                       unsigned char *keyHandleStr = AsmCrypto::ToBase64Url((unsigned  char*)(stubResp->kh->data), stubResp->kh->len);
+                       std::string khStr((const char *)(keyHandleStr), strlen((char*)keyHandleStr));
+
+                       regParcel->setString(STR_PROP_CALLER_ID, asmReq->getCallerId());
+                       regParcel->setString(STR_PROP_APP_ID, appIdStr);
+                       regParcel->setString(STR_PROP_KEY_HANDLE, khStr);
+
+                       unsigned char *kIdEnc = AsmCrypto::ToBase64Url(stubResp->regAssertion->krd->keyId->data,
+                                                                  stubResp->regAssertion->krd->keyId->len);
+                       if (kIdEnc == NULL) {
+                               _ERR("ToBase64Url failed");
+                               return -1;
+                       }
+
+
+                       std::string kIdStr((const char *)(kIdEnc),
+                                                          strlen((char *)kIdEnc));
+
+                       regParcel->setString(STR_PROP_KEY_ID, kIdStr);
+
+
+                       AsmStorage::getInstance()->insertData(regParcel);
+
+                       /*TODO: KeyHandle should not be returned for roaming*/
+                       /*stubResp->kh = NULL;
+                       _INFO("Removing key handle intentinally for roaming response");*/
+                       char *tlvRespB64 = RoamingUtil::composeAuthRegisterResponse(stubResp);
+                       if (tlvRespB64 != NULL) {
+                               *out = tlvRespB64;
+                       }
+               }
+
+       } else {
+               /*Coming from FIDO Client Service*/
+
+               /*AuthIndex mapping is required*/
+               RegisterReq *regAuthReq = createStubRequestRegister(asmReq, str);
+               RET_IF_FAIL(regAuthReq != NULL, -1);
+               _INFO("[%p]", regAuthReq);
+               /*_INFO("Before getAuthIndex");
+               regAuthReq->authIdx = AuthIndexHandler::getInstance()->getAuthIndex(regAuthReq->authIdx);
+
+               _INFO("After getAuthIndex");*/
+               _INFO("[%p]", stub);
+               RegisterResp *stubResp = stub->processRegister(regAuthReq);
+               RET_IF_FAIL(stubResp != NULL, -1);
+               _INFO("");
+
+               if (stub->getType() == AUTH_TYPE_BOUND) {
+                       _INFO("");
+                       /*Bound Authenticators / Authenticators provided as plugin / Non RA*/
+                       GList *authList = stub->getInfo()->authList;
+                       GList *authListIter = g_list_first(authList);
+                       if (authListIter != NULL) {
+                               _INFO("");
+                               AuthenticatorInfo *authInfo = (AuthenticatorInfo*)(authListIter->data);
+                               if (authInfo->__isRoamingAuthenticator == false) {
+
+                                       IStorageParcel *regParcel = new AsmStorageParcel();
+                                       regParcel->setInt(INT_PROP_AUTH_IDX, authInfo->__authenticatorIndex);
+
+                                       std::string appIdStr((const char *)(regAuthReq->appId), strlen(regAuthReq->appId));
+                                       unsigned char *keyHandleStr = AsmCrypto::ToBase64Url((unsigned  char*)(stubResp->kh->data), stubResp->kh->len);
+                                       std::string khStr((const char *)(keyHandleStr), strlen((char*)keyHandleStr));
+
+
+                                       regParcel->setString(STR_PROP_CALLER_ID, asmReq->getCallerId());
+                                       regParcel->setString(STR_PROP_APP_ID, appIdStr);
+                                       regParcel->setString(STR_PROP_KEY_HANDLE, khStr);
+
+                                       unsigned char *kIdEnc = AsmCrypto::ToBase64Url(stubResp->regAssertion->krd->keyId->data,
+                                                                                  stubResp->regAssertion->krd->keyId->len);
+                                       if (kIdEnc == NULL) {
+                                               _ERR("ToBase64Url failed");
+                                               return -1;
+                                       }
+
+                                       std::string kIdStr((const char *)(kIdEnc),
+                                                                          strlen((char *)kIdEnc));
+
+
+                                       regParcel->setString(STR_PROP_KEY_ID, kIdStr);
+
+                                       AsmStorage::getInstance()->insertData(regParcel);
+
+
+                                       _INFO("");
+                               }
+                       }
+               }
+
+               _INFO("");
+               AsmResponse *asmRegResp = new AsmResponse();
+               AsmRegResponse *respData = new AsmRegResponse();
+
+               asmRegResp->__statusCode = 0;
+
+               char *assrtScheme = NULL;
+               _INFO("");
+               Buffer *regAssrt = stub->encodeRegisterRespone(stubResp->regAssertion, &assrtScheme);
+               _INFO("");
+               RET_IF_FAIL(regAssrt != NULL, -1);
+
+               unsigned char *assrtStrData = AsmCrypto::ToBase64Url(regAssrt->data, regAssrt->len);
+               RET_IF_FAIL(assrtStrData != NULL, -1);
+
+               std::string assrtStr((const char *)assrtStrData, strlen((char*)assrtStrData));
+               std::string assrtSchemeStr((const char *)(assrtScheme), strlen(assrtScheme));
+               respData->__assertion = assrtStr;
+               respData->__assertionScheme = assrtSchemeStr;
+               asmRegResp->__respData = respData;
+
+               _INFO("");
+               char *regRespJson = JsonUtil::composeAsmRegisterResponse(asmRegResp);
+               RET_IF_FAIL(regRespJson != NULL, -1);
+
+               _INFO("");
+               *out = regRespJson;
+       }
+
+       _INFO("");
+       return 0;
+}
diff --git a/server/states/src/TCState.cpp b/server/states/src/TCState.cpp
new file mode 100644 (file)
index 0000000..830694b
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "TCState.h"
+
+#include "AsmHelper.h"
+#include "IAuthStub.h"
+#include "stdlib.h"
+#include <vector>
+#include "string.h"
+#include "asmcrypto.h"
+#include "TCUiAdaptor.h"
+#include "AsmAuthRequest.h"
+#include "AuthnrTypes.h"
+
+TCState::TCState(void)
+{
+
+}
+
+TCState::~TCState()
+{
+
+}
+
+#define ASM_UI_SUPPORTED_TYPE "text/plain"
+
+int
+TCState::getInfoForUi(AsmRequest *asmReq, std::vector<std::string> **tcList,
+                                       char **appId)
+{
+       if (asmReq == NULL)
+               return -1;
+
+       if (asmReq->getCustomRequest() == NULL) {
+               AsmAuthRequest *asmAuthReq = (AsmAuthRequest*)(asmReq->getArgs());
+               RET_IF_FAIL(asmAuthReq != NULL, -1);
+
+               /*TC list null is not error, it means no TC is required*/
+               std::vector<Transaction*> tcFullList = asmAuthReq->getTCs();
+               RET_IF_FAIL(tcFullList.size() > 0, 0);
+
+               std::string appIdPubKey = asmAuthReq->getAppId();
+               char *appIdReal = AsmCrypto::getAppId(strdup(appIdPubKey.c_str()));
+               RET_IF_FAIL(appIdReal != NULL, -1);
+
+               std::vector<std::string> *tcListLoc = new std::vector<std::string>();
+               std::vector<Transaction*>::iterator tcIter = tcFullList.begin();
+               for (; tcIter != tcFullList.end(); ++tcIter) {
+                       Transaction *tc = *tcIter;
+
+                       if ((tc != NULL) && (tc->__content.empty() == false)) {
+                               std::string contentStr(tc->__content);
+                               tcListLoc->push_back(contentStr);
+                       }
+               }
+               *tcList = tcListLoc;
+
+               *appId = appIdReal;
+               return 0;
+
+       }
+
+       if (asmReq->getCustomRequest() != NULL) {
+
+               AuthenticateReq *authAuthReq = (AuthenticateReq*)(asmReq->getCustomRequest());
+               RET_IF_FAIL(authAuthReq != NULL, -1);
+
+               /*TC list null is not error, it means no TC is required*/
+               if (authAuthReq->tc == NULL) {
+                       return 0;
+               }
+
+               char *appIdReal = (char*)calloc(128, sizeof(char));
+               snprintf(appIdReal, 127, "%s", "Remote Device");
+               /*TODO For requests coming from remote device, we can not use pkgmgr to
+               * find out App-Id, instead Client Device's ASM must send it explicitly
+               */
+               /*AsmCrypto::getAppId(strdup(authAuthReq->appId));*/
+               /*RET_IF_FAIL(appIdReal != NULL, -1);*/
+
+               std::vector<std::string> *tcListLoc = new std::vector<std::string>();
+               if (authAuthReq->tc != NULL) {
+                       std::string contentStr(authAuthReq->tc);
+                       tcListLoc->push_back(contentStr);
+               }
+               *tcList = tcListLoc;
+
+               *appId = appIdReal;
+               return 0;
+       }
+
+       return -1;
+}
+
+int
+TCState::handle(IAuthStub *stub, AsmRequest *asmReq, const char *str, char **out)
+{
+       _BEGIN;
+       RET_IF_FAIL(stub != NULL, -1);
+
+       if (stub->getType() == AUTH_TYPE_ROAMING) {
+               _INFO("Local TC not required for Roaming Stub");
+               return 0;
+       }
+
+       /*TODO: TC UI is disabled for Solis until integrated with fido-syspopup*/
+       _INFO("");
+       return 0;
+
+
+       /*TODO: Add provision so that Authenticators can use their own UI if required*/
+
+       TcUiAdaptor *uiAd = TcUiAdaptor::getInstance();
+       RET_IF_FAIL(uiAd != NULL, -1);
+
+       std::vector<std::string> *tcList = NULL;
+       char *appId = NULL;
+
+       int ret = getInfoForUi(asmReq, &tcList, &appId);
+       _INFO("[%d]", ret);
+
+       if ((tcList == NULL) || (appId == NULL)) {
+               if (ret == 0) {
+                       _INFO("No TC UI required");
+                       return 0;
+               }
+               return -1;
+       }
+
+       char *savePtr;
+       strtok_r(appId, ".", &savePtr);
+       strtok_r(NULL, ".", &savePtr);
+       char *appName = savePtr;
+       RET_IF_FAIL(appName != NULL, -1);
+       std::string appNameStr(appName);
+
+       std::vector<std::string>::iterator it = tcList->begin();
+       for (; it < tcList->end(); it++) {
+               std::string tcStr = *it;
+
+               /*Multiple transactions of same ASM_UI_SUPPORTED_TYPE not supported*/
+               /*TODO Select tc based on the current display characterstics*/
+               /*if (strcmp(tc->__contentType.c_str(), ASM_UI_SUPPORTED_TYPE) == 0) {*/
+                       _INFO("Found matched TC");
+                       /*Base64 url decode tc->__content*/
+                       unsigned char *trans = AsmCrypto::FromBase64Url((unsigned char*)tcStr.c_str(),
+                                                                                                                       tcStr.length());
+                       std::string transStr((char*)trans);
+                       _END;
+                       return uiAd->confirmTransaction(transStr, appNameStr);
+/*             }*/
+       }
+
+       _ERR("No matching UI to display TC found");
+       return -1;
+}
diff --git a/server/states/src/VerifyState.cpp b/server/states/src/VerifyState.cpp
new file mode 100644 (file)
index 0000000..b69289f
--- /dev/null
@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "VerifyState.h"
+
+#include "AsmHelper.h"
+#include "IAuthStub.h"
+#include <vector>
+#include <stdio.h>
+#include <stdlib.h>
+#include "AsmRequest.h"
+#include "AsmRegRequest.h"
+#include "AsmAuthRequest.h"
+#include "AsmStorage.h"
+#include "asmcrypto.h"
+
+#define STRING_OP_TYPE_GET_INFO "GetInfo"
+#define STRING_OP_TYPE_REG "Register"
+#define STRING_OP_TYPE_AUTH "Authenticate"
+#define STRING_OP_TYPE_DEREG "Deregister"
+#define STRING_OP_TYPE_OPEN_SETTINGS "OpenSettings"
+#define STRING_OP_TYPE_GET_REGS "GetRegistrations"
+
+/*TODO get Uid of owner*/
+#define uid 5001
+
+VerifyState::VerifyState(void)
+{
+
+}
+
+VerifyState::~VerifyState()
+{
+
+}
+
+int
+VerifyState::handle(IAuthStub *stub, AsmRequest *asmReq, const char *str, char **out)
+{
+       _BEGIN;
+       RET_IF_FAIL(stub != NULL, -1);
+       RET_IF_FAIL(asmReq != NULL, -1);
+
+       if (stub->getType() == AUTH_TYPE_ROAMING) {
+               _INFO("Local verification not required for Roaming Stub");
+               return 0;
+       }
+
+       if (stub->hasAuthUi() == true) {
+               _INFO("Auth has inbuilt ui, no need of ASM UI");
+
+               std::string reqType = asmReq->getRequesttype();
+               char *cmd = NULL;
+               char *fch = NULL;
+
+               if (asmReq->getCustomRequest() == NULL) {
+                       if(strcmp(reqType.c_str(), STRING_OP_TYPE_REG) == 0) {
+                               AsmRegRequest *asmRegReq = (AsmRegRequest*)asmReq->getArgs();
+                               if (asmRegReq == NULL) {
+                                       _ERR("");
+                                       return -1;
+                               }
+
+                               if (asmRegReq->getFinalChallenge().empty() == true) {
+                                       _ERR("");
+                                       return -1;
+                               }
+
+                               /*TODO B64 encode?*/
+                               fch = _SAFE_DUP(asmRegReq->getFinalChallenge().c_str());
+                               cmd = (char*)calloc(128, sizeof(char));
+                               snprintf(cmd, 128 - 1, "%s", "registration");
+
+
+                       } else if(strcmp(reqType.c_str(), STRING_OP_TYPE_AUTH) == 0) {
+
+                               AsmAuthRequest *asmAuthReq = (AsmAuthRequest*)asmReq->getArgs();
+                               if (asmAuthReq == NULL) {
+                                       _ERR("");
+                                       return -1;
+                               }
+
+                               if (asmAuthReq->getFCH().empty() == true) {
+                                       _ERR("");
+                                       return -1;
+                               }
+
+                               /*TODO B64 encode?*/
+                               fch = _SAFE_DUP(asmAuthReq->getFCH().c_str());
+                               cmd = (char*)calloc(128, sizeof(char));
+                               snprintf(cmd, 128 - 1, "%s", "authentication");
+                       }
+
+
+               } else {
+                       _INFO("");
+                       if(strcmp(reqType.c_str(), STRING_OP_TYPE_REG) == 0) {
+                               RegisterReq *regAuthReq = (RegisterReq*)(asmReq->getCustomRequest());
+                               if (regAuthReq == NULL) {
+                                       _ERR("");
+                                       return -1;
+                               }
+
+                               if ((regAuthReq->fch == NULL) || (regAuthReq->fch->data == NULL)) {
+                                       _ERR("");
+                                       return -1;
+                               }
+
+                               unsigned char *fcE = AsmCrypto::ToBase64Url(regAuthReq->fch->data, regAuthReq->fch->len);
+                               fch = (char*)fcE;
+
+                               cmd = (char*)calloc(128, sizeof(char));
+                               snprintf(cmd, 128 - 1, "%s", "registration");
+
+                       } else if(strcmp(reqType.c_str(), STRING_OP_TYPE_AUTH) == 0) {
+
+                               AuthenticateReq *signAuthReq = (AuthenticateReq*)(asmReq->getCustomRequest());
+                               if (signAuthReq == NULL) {
+                                       _ERR("");
+                                       return -1;
+                               }
+
+                               if ((signAuthReq->fch == NULL) || (signAuthReq->fch->data == NULL)) {
+                                       _ERR("");
+                                       return -1;
+                               }
+
+                               unsigned char *fcE = AsmCrypto::ToBase64Url(signAuthReq->fch->data, signAuthReq->fch->len);
+                               fch = (char*)fcE;
+
+                               cmd = (char*)calloc(128, sizeof(char));
+                               snprintf(cmd, 128 - 1, "%s", "authentication");
+                       }
+
+               }
+               _INFO("");
+               return stub->verify(cmd, fch, out);
+       }
+
+       if (stub->isUserVerificationNeeded() == false) {
+               _INFO("User verification not needed");
+               return 0;
+       }
+
+       /*TODO: Verif token searching on DB must be done via Auth plugin*/
+
+       char *vToken = NULL;
+       std::string aaid;
+       std::string appId;
+       std::string reqType = asmReq->getRequesttype();
+
+       int mappedIndex = asmReq->getAuthIndex();
+
+       if(strcmp(reqType.c_str(), STRING_OP_TYPE_REG) == 0) {
+               if (asmReq->getCustomRequest() != NULL) {
+                       _INFO("Custom req reg");
+                       RegisterReq *regAuthReq = (RegisterReq*)(asmReq->getCustomRequest());
+                       _INFO("Custom req reg [%p]", regAuthReq);
+                       std::string appIdStr(regAuthReq->appId);
+                       _INFO("Custom req reg [%s]", appIdStr.c_str());
+                       appId = appIdStr;
+                       mappedIndex = regAuthReq->authIdx;
+                       _INFO("Mapped Index=[%d]", mappedIndex);
+               } else {
+                       AsmRegRequest *asmRegReq = (AsmRegRequest*)asmReq->getArgs();
+                       appId = asmRegReq->getAppId();
+               }
+       } else if(strcmp(reqType.c_str(), STRING_OP_TYPE_AUTH) == 0) {
+               _INFO("Request Type is Authenticate");
+               if (asmReq->getCustomRequest() != NULL) {
+                       _INFO("Custom auth reg");
+                       AuthenticateReq *authAuthReq = (AuthenticateReq*)(asmReq->getCustomRequest());
+                       _INFO("Custom req auth [%p]", authAuthReq);
+                       std::string appIdStr(authAuthReq->appId);
+                       _INFO("Custom req auth [%s]", appIdStr.c_str());
+                       appId = appIdStr;
+                       mappedIndex = authAuthReq->authIdx;
+                       _INFO("Mapped Index=[%d]", mappedIndex);
+               } else {
+                       AsmAuthRequest *asmAuthReq = (AsmAuthRequest*)asmReq->getArgs();
+                       appId = asmAuthReq->getAppId();
+               }
+
+               GetAuthInfoResp *getAuthInfoResp = stub->getInfo();
+
+               if (getAuthInfoResp->authList != NULL) {
+
+                       GList *authListIter = g_list_first(getAuthInfoResp->authList);
+                       while(authListIter != NULL) {
+                               AuthenticatorInfo *authInfo = (AuthenticatorInfo*)(authListIter->data);
+                               if(authInfo->__authenticatorIndex == mappedIndex) {
+                                       aaid = authInfo->__aaid;
+                                       break;
+                               }
+                               authListIter = authListIter->next;
+                       }
+               }
+
+               RET_IF_FAIL(aaid.empty() == false, -1);
+               _INFO("VerifyState::handle:: appId = [%s]", appId.c_str());
+               _INFO("VerifyState::handle:: aaid = [%s]", aaid.c_str());
+
+               /*TODO: Verif token searching on DB must be done via Auth plugin*/
+               IStorageParcel *parcel = new SecretStorageParcel();
+               int res = parcel->setString(STR_PROP_AAID, aaid);
+               if(res != 0)
+                       return -1;
+               res = parcel->setString(STR_PROP_DEV_ID, AsmCrypto::getDeviceId());
+               if(res != 0)
+                       return -1;
+               res = parcel->setInt(INT_PROP_UID, uid);
+               if(res != 0)
+                       return -1;
+
+               std::vector<IStorageParcel*> *resultList = AsmStorage::getInstance()->searchData(parcel);
+               if(resultList->size() == 0) {
+                       _ERR("VerifyState::handle:: User not registerd");
+                       return -1;
+               }
+               else {
+                       _INFO("VerifyState::handle:: User is registerd");
+                       if(resultList->size() > 1) {
+                               _INFO("VerifyState::handle:: More than one records obtained from Secret Database");
+                               return -1;
+                       }
+                       std::vector<IStorageParcel*>::iterator it = resultList->begin();
+                       IStorageParcel *parcel = (*it);
+                       parcel->getString(STR_PROP_SECRET1, &vToken);
+
+                       RET_IF_FAIL(vToken != NULL, -1);
+
+                       *out = vToken;
+               }
+       }
+       else {
+               return -1;
+       }
+
+       _END;
+       return stub->verify(appId.c_str(), NULL, out);
+}
diff --git a/silent_auth/CMakeLists.txt b/silent_auth/CMakeLists.txt
new file mode 100644 (file)
index 0000000..4021531
--- /dev/null
@@ -0,0 +1,56 @@
+
+IF(NOT DEFINED SILENT_PACKAGE_NAME)
+        SET(SILENT_PACKAGE_NAME "fido_silent_auth")
+ENDIF(NOT DEFINED SILENT_PACKAGE_NAME)
+
+FILE( GLOB SILENT_AUTH_SRCS
+    silent_auth_entry.cpp
+    ../common/uafv1tlvutil/src/*.cpp
+    ../common/cryptoutil/src/*.cpp
+    ##../common/uiutil/src/*.cpp
+)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/cryptoutil/inc/)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/datatypes/auth/)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/uafv1tlvutil/inc/)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/uiutil/inc/)
+##INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/jsonutil/inc/)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(SILENT_AUTH_PKGS REQUIRED
+               dlog
+               glib-2.0
+               capi-base-common
+               pkgmgr-info
+               openssl
+               json-glib-1.0
+               capi-network-connection
+               aul
+               libtzplatform-config
+)
+
+FOREACH(flag ${SILENT_AUTH_PKGS_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror -Wno-unused-result")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -Wno-unused-result")
+SET(CMAKE_LDFLAGS "-Wl,-zdefs")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
+ADD_DEFINITIONS("-DSLP_DEBUG")
+
+ADD_LIBRARY(${SILENT_PACKAGE_NAME} SHARED ${SILENT_AUTH_SRCS})
+
+SET_TARGET_PROPERTIES(${SILENT_PACKAGE_NAME} PROPERTIES SOVERSION 0)
+SET_TARGET_PROPERTIES(${SILENT_PACKAGE_NAME} PROPERTIES VERSION 1)
+
+TARGET_LINK_LIBRARIES(${SILENT_PACKAGE_NAME} ${SILENT_AUTH_PKGS_LDFLAGS})
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/fido_tizen_auth.der DESTINATION /opt/usr/data/silent_auth/)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/fido_tizen_auth.key DESTINATION /opt/usr/data/silent_auth/)
+
+INSTALL(TARGETS ${SILENT_PACKAGE_NAME} DESTINATION ${LIBDIR}/fido/asm/auth)
diff --git a/silent_auth/silent_auth_entry.cpp b/silent_auth/silent_auth_entry.cpp
new file mode 100644 (file)
index 0000000..4235647
--- /dev/null
@@ -0,0 +1,1147 @@
+/*
+ * Copyright (c) 2014 - 2015 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 <stdlib.h>
+#include <stdio.h>
+#include <tizen.h>
+#include <json-glib/json-glib.h>
+#include <openssl/evp.h>
+#include <string>
+#include "silent_auth_entry.h"
+
+#include "GetInfoReqTlvEncoder.h"
+#include "GetInfoRespTlvEncoder.h"
+#include "RegReqTlvEncoder.h"
+#include "RegRespTlvEncoder.h"
+#include "Tlv.h"
+#include "AsmHelper.h"
+#include "asmcrypto.h"
+#include "AuthnrTypes.h"
+#include "AuthUiFactory.h"
+#include "IAuthUiAdaptor.h"
+#include "PinAuthUiAdaptor.h"
+
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <aul.h>
+
+#define BIG_STRING_SIZE 5000
+#define DIGEST_LEN 32
+
+/*#define JSON_BUILDER*/
+
+/*TODO Fix*/
+#define FIDO_TIZEN_AUTH_KEY_PATH "/opt/usr/data/silent_auth/fido_tizen_auth.key"
+#define FIDO_TIZEN_AUTH_DER_PATH "/opt/usr/data/silent_auth/fido_tizen_auth.der"
+
+/*#define FIDO_TIZEN_AUTH_KEY_PATH tzplatform_mkpath(TZ_SYS_DATA, "/gear_auth/fido_tizen_auth.key")*/
+/*#define FIDO_TIZEN_AUTH_DER_PATH tzplatform_mkpath(TZ_SYS_DATA, "/gear_auth/fido_tizen_auth.der")*/
+
+const char *AAID = "TEST#1111";
+const char *tcDispConType = "text/plain";
+
+//#define KH_SYMM_KEY "tizen@123";
+const int chunk_size = 200;
+
+/*TODO : Generate proper key-iv and store in a file*/
+/* A 256 bit key */
+const unsigned char *key = (unsigned char *)"01234567890123456789012345678901";
+
+/* A 128 bit IV */
+const unsigned char *iv = (unsigned char *)"01234567890123456";
+
+//static char *KH_SYMM_KEY = "tizen@123";
+
+/*TODO: Create new DB Table to store counters*/
+/*Global*/
+static int __reg_counter = 1;
+/*Per private key signing basis*/
+static int __sign_counter = 1;
+
+#define AUTH_EXTENSION_ID_INIT "init"
+#define AUTH_EXTENSION_ID_DE_INIT "deinit"
+
+#define AUTH_EXTENSION_RESPONSE_SUCCESS "success"
+#define AUTH_EXTENSION_RESPONSE_SUCCESS_LEN 128
+
+#ifdef JSON_BUILDER
+static void
+__add_string_to_json_object(JsonBuilder *json_obj, const char *key, const char *val)
+{
+       if (key == NULL || val == NULL)
+               return;
+
+       json_builder_set_member_name(json_obj, key);
+       json_builder_add_string_value(json_obj, val);
+}
+#else
+static void
+__add_string_to_json_object(JsonObject *obj, const char *key, const char *val)
+{
+       if ((key == NULL) || (val == NULL))
+               return;
+
+       json_object_set_string_member(obj, key, val);
+}
+
+static gboolean
+__init_json_object(JsonGenerator **generator, JsonObject **root_obj)
+{
+       _INFO("");
+       JsonNode *root_node = NULL;
+
+       *generator = json_generator_new();
+       if(*generator == NULL) {
+               _INFO("json_generator_new is NULL");
+               goto CATCH;
+       }
+
+       root_node = json_node_new(JSON_NODE_OBJECT);
+       if (root_node == NULL) {
+               _INFO("*json_node_new is NULL");
+               goto CATCH;
+       }
+
+       *root_obj = json_object_new();
+       if(*root_obj == NULL) {
+               _INFO("json_object_new is NULL");
+               goto CATCH;
+       }
+
+       json_node_take_object(root_node, *root_obj);
+       json_generator_set_root(*generator, root_node);
+
+       return TRUE;
+
+
+CATCH:
+       if (generator != NULL && *generator != NULL) {
+               g_object_unref(*generator);
+               *generator = NULL;
+       }
+
+       if (root_node != NULL) {
+               json_node_free(root_node);
+               root_node = NULL;
+       }
+
+       if (root_obj != NULL && *root_obj != NULL) {
+               g_object_unref(*root_obj);
+               *root_obj = NULL;
+       }
+       return FALSE;
+}
+
+#endif
+
+static void
+__print_big_string(const char *str)
+{
+       int len = strlen(str);
+       int i = 0;
+       for (; i < len; i+= chunk_size)
+       {
+               char sub_str[chunk_size + 2] = {0, };
+               strncpy(sub_str, str + i, chunk_size);
+               _INFO("log : [%s]", sub_str);
+       }
+
+}
+
+static char *
+__create_raw_key_handle_string(char *khAccToken, const char *pri_key, char *userName)
+{
+#ifdef JSON_BUILDER
+       _INFO("__create_raw_key_handle_string start");
+       _INFO("khAccToken : [%s]", khAccToken);
+       __print_big_string(pri_key);
+       _INFO("userName : [%s]", userName);
+
+       char *json = NULL;
+
+       JsonBuilder *builder = json_builder_new();
+       json_builder_begin_object(builder);
+
+       _INFO("After json_builder_begin_object");
+       __add_string_to_json_object(builder, "KHAccessToken", khAccToken);
+
+       _INFO("After __add_string_to_json_object");
+       __add_string_to_json_object(builder, "priv", pri_key);
+
+       _INFO("After __add_string_to_json_object");
+       __add_string_to_json_object(builder, "userName", userName);
+
+       _INFO("After __add_string_to_json_object");
+       json_builder_end_object(builder);
+
+       _INFO("After json_builder_end_object");
+       JsonGenerator *gen = json_generator_new();
+       JsonNode *root_builder = json_builder_get_root(builder);
+       json_generator_set_root(gen, root_builder);
+
+       json_node_free(root_builder);
+       g_object_unref(builder);
+
+       _INFO("Before json_generator_to_data");
+       gsize len = 0;
+       json = json_generator_to_data(gen, &len);
+
+       g_object_unref(gen);
+
+       _INFO("%s", json);
+       _INFO("__create_raw_key_handle_string end");
+       return json;
+#else
+       gsize len = 0;
+       char *json = NULL;
+       JsonGenerator *generator = NULL;
+       JsonObject *root_obj = NULL;
+       bool ret = __init_json_object(&generator, &root_obj);
+       if (ret == FALSE) {
+               _ERR("initObject failed");
+               goto CATCH;
+       }
+
+       _INFO("After json_builder_begin_object");
+       __add_string_to_json_object(root_obj, "KHAccessToken", khAccToken);
+
+       _INFO("After __add_string_to_json_object");
+       __add_string_to_json_object(root_obj, "priv", pri_key);
+
+       _INFO("After __add_string_to_json_object");
+       __add_string_to_json_object(root_obj, "userName", userName);
+
+
+       json = json_generator_to_data(generator, &len);
+       if (json != NULL) {
+               _INFO("%s", json);
+
+       }
+       return json;
+
+CATCH:
+       if (generator != NULL) {
+               g_object_unref(generator);
+               generator = NULL;
+       }
+       return NULL;
+#endif
+}
+
+static int
+__parse_key_handle_json(const unsigned char *kh, char **khA, char **pri_key, char **user_name)
+{
+       __print_big_string((char*)kh);
+       _INFO("Input len=[%d]", strlen((char*)kh));
+
+       /*TODO*/
+       JsonParser *parser  = json_parser_new();
+
+       GError *err = NULL;
+       json_parser_load_from_data(parser, (char*)kh, -1, &err);
+       if (err != NULL)
+       {
+               _ERR("Parsing failed=[%s]", err->message);
+               return -1;
+       }
+
+       JsonNode *root = json_parser_get_root(parser);
+
+       JsonObject *root_obj = json_node_get_object(root);
+
+       const char *khA_temp = json_object_get_string_member(root_obj, "KHAccessToken");
+       const char *pri_key_temp = json_object_get_string_member(root_obj, "priv");
+       const char *user_name_temp = json_object_get_string_member(root_obj, "userName");
+
+       if (khA_temp != NULL)
+       {
+               *khA = strdup(khA_temp);
+       }
+
+       if (pri_key_temp != NULL)
+       {
+               *pri_key = strdup(pri_key_temp);
+       }
+
+       if (user_name_temp != NULL)
+       {
+               *user_name = strdup(user_name_temp);
+       }
+
+       if (parser != NULL)
+               g_object_unref(parser);
+
+       return 0;
+}
+
+void *
+processDeRegister(unsigned char *assert_req)
+{
+       _INFO("========ProcessDeRegister start=========");
+
+       Buffer *getDeRegRespInfoBuff = NULL;
+       DeregResp *getDeRegRespInfo = ALLOC(DeregResp);
+       getDeRegRespInfo->statusCode = UAF_CMD_STATUS_OK;
+
+       _INFO("===========================DEREGISTER RESPONSE ENCODE=============================");
+
+       TlvEncodable<DeregResp> encodableDeReg(getDeRegRespInfo);
+       int ret = encodableDeReg.setEncoder(EID_UAFV1_DEREG_RESP);
+       if (ret == 0) {
+               _INFO("setEncoder EID_UAFV1_DEREG_RESP PASS \n");
+       }
+       else {
+               _INFO("setEncoder EID_UAFV1_DEREG_RESP FAIL \n");
+               return NULL;
+       }
+
+       getDeRegRespInfoBuff = encodableDeReg.encode();
+       if (getDeRegRespInfoBuff != NULL) {
+               _INFO("encode EID_UAFV1_DEREG_RESP PASS \n");
+       }
+       else {
+               _INFO("encode EID_UAFV1_DEREG_RESP FAIL \n");
+               return NULL;
+       }
+
+       _INFO("===========================DEREGISTER RESPONSE ENCODE=============================");
+
+       _INFO("========ProcessDeRegister start=========");
+       return getDeRegRespInfoBuff;
+}
+
+void *
+processAuthenticate(unsigned char *assert_req)
+{
+       _INFO("========ProcessAuthenticate start PIN Auth=========");
+       OpenSSL_add_all_algorithms();
+
+       AuthenticateReq *getAuthReqInfo = NULL;
+       AuthenticateResp *getAuthRespInfo = NALLOC(1, AuthenticateResp);
+       getAuthRespInfo->authAssertion = NULL;
+       getAuthRespInfo->uKhList = NULL;
+
+       TlvEncodable<AuthenticateReq> encodableAuthReq;
+
+       _INFO("===========================AUTHENTICATE REQUEST DECODE=============================");
+       int ret = encodableAuthReq.setEncoder(EID_UAFV1_SIGN_REQ);
+       if (ret == 0) {
+               _INFO("setEncoder EID_UAFV1_SIGN_REQ PASS \n");
+       }
+       else {
+               _INFO("setEncoder EID_UAFV1_SIGN_REQ FAIL \n");
+               return NULL;
+       }
+
+       getAuthReqInfo = encodableAuthReq.decode(assert_req);
+       if (getAuthReqInfo != NULL) {
+               _INFO("decode EID_UAFV1_SIGN_REQ PASS \n");
+       }
+       else {
+               _INFO("decode EID_UAFV1_SIGN_REQ FAIL \n");
+               return NULL;
+       }
+       _INFO("===========================AUTHENTICATE REQUEST DECODE=============================");
+
+       _INFO("===========================AUTHENTICATE REPONSE ENCODE=============================");
+
+       bool response_parsed = false;
+
+       getAuthRespInfo->statusCode = UAF_CMD_STATUS_OK;
+
+       int khHListSize = g_list_length(getAuthReqInfo->khHList);
+
+       if(khHListSize > 1)     {
+
+               _INFO("Keyhandle size > 1 = [%d]", khHListSize);
+
+               /*Copy {Command.KeyHandle, RawKeyHandle.username}*/
+               GList *ukhIter = NULL;
+               ukhIter = g_list_first(getAuthReqInfo->khHList);
+
+               while (ukhIter != NULL)
+               {
+                       unsigned char *khStr = (unsigned char*)ukhIter->data;
+
+                       _INFO("processAuthenticate:: Length of b64 encoded keyHandle : [%d]", strlen((char*)khStr));
+
+                       /*b64 decode of keyHandle*/
+                       int inputSz = strlen((char*)khStr);
+                       unsigned char* output = NULL;
+
+                       output = (unsigned char*)calloc(1, inputSz*1.5);
+                       int outputSz = 0;
+
+                       if (0 != AsmCrypto::genB64Decodes(khStr,
+                                                                                               inputSz,
+                                                                                               output,
+                                                                                               &outputSz))
+                       {
+                               _ERR("Failed to decode base64.");
+                               free(output);
+                               return NULL;
+                       }
+
+                       unsigned char *kh_str_enc = output;
+                       int kh_str_enc_len = outputSz;
+                       _INFO("processAuthenticate:: Length of keyHandle from Auth Req to decrypt = [%d]", kh_str_enc_len);
+
+
+                       _INFO("Before AESDecrypt");
+                       unsigned char kh_str_dec[BIG_STRING_SIZE] = {0, };
+                       int dec_len = AsmCrypto::aesDecrypt(kh_str_enc,
+                                                                                               kh_str_enc_len,
+                                                                                               key,//(const unsigned char*)symKey.c_str(),
+                                                                                               iv,//(const unsigned char*)symKey.c_str(),
+                                                                                               kh_str_dec);
+                       if (dec_len > 0)
+                       {
+                               char *khA = NULL;
+                               char *pri_key = NULL;
+                               char *user_name = NULL;
+
+                               kh_str_dec[dec_len] = '\0';
+
+                               _INFO("Before __parse_key_handle_json");
+                               __parse_key_handle_json(kh_str_dec, &khA, &pri_key, &user_name);
+
+                               if ((khA != NULL) && (pri_key != NULL) && (user_name != NULL))
+                                               /*TODO strcmp((char*)khATkn_b64_enc, khA) == 0)*/
+                               {
+                                       /*pri_key and khAccessToken are b64 encoded*/
+                                       _INFO("Key Handle Parameters : [%s][%s][%s]", user_name, pri_key, khA);
+
+                                       UserNameKeyHandle *ukhInfoNew = ALLOC(UserNameKeyHandle);
+                                       ukhInfoNew->userName = user_name;
+
+                                       ukhInfoNew->kh = ALLOC(Buffer);
+                                       ukhInfoNew->kh->data = NALLOC(BIG_STRING_SIZE, uint8_t);
+                                       ukhInfoNew->kh->len = strlen((char*)khStr);
+                                       memcpy(ukhInfoNew->kh->data, khStr, strlen((char*)khStr));
+
+                                       GList *ukhList = NULL;
+                                       ukhList = g_list_append(ukhList, ukhInfoNew);
+                                       getAuthRespInfo->uKhList = g_list_first(ukhList);
+
+                                       response_parsed = true;
+                               }
+                        }
+
+                       ukhIter = ukhIter->next;
+               }
+
+       } else {
+
+               _INFO("processAuthenticate:: Keyhandle size = 1.");
+               /*Set Authentication Mode*/
+               int authMode = 0x01;
+
+               unsigned char nonce[128] = {0, };
+               AsmCrypto::genRandom(nonce, 128);
+
+               //string tcHash((char*)PIN_TCHASH_AUTH,32); /*TODO: Implement*/
+
+               _INFO("");
+
+               unsigned char digest[32];
+
+               GList *khHLIter = g_list_first(getAuthReqInfo->khHList);
+               unsigned char *khString = (unsigned char*)khHLIter->data;
+
+               /*b64 decode of keyHandle*/
+               int khString_len = strlen((char*)khString);
+               unsigned char* khString_raw = NULL;
+
+               khString_raw = (unsigned char*)calloc(1, khString_len*1.5);
+               int khString_raw_len = 0;
+
+               if (0 != AsmCrypto::genB64Decodes(khString,
+                                                                                       khString_len,
+                                                                                       khString_raw,
+                                                                                       &khString_raw_len))
+               {
+                       _ERR("Failed to decode base64.");
+                       free(khString_raw);
+                       return NULL;
+               }
+               /*b64 decode of keyHandle*/
+
+               _INFO("Before genHash256");
+               AsmCrypto::genHash256(khString_raw, khString_raw_len, digest);
+               _INFO("genHash256 Length = %d", strlen((char*)digest));
+               _INFO("After genHash256 = %s", digest);
+
+               //std::string keyID(digest, strlen(digest));
+               unsigned char *keyId_b64_enc = AsmCrypto::ToBase64Url(digest, DIGEST_LEN);
+
+
+               getAuthRespInfo->authAssertion = ALLOC(AuthAssertion);
+               getAuthRespInfo->authAssertion->sigData = ALLOC(SigData);
+
+               getAuthRespInfo->authAssertion->sigData->aaid = (char*)AAID;
+
+               getAuthRespInfo->authAssertion->sigData->assrtInfo = ALLOC(AssertionInfo);
+               getAuthRespInfo->authAssertion->sigData->assrtInfo->authMode = authMode;
+               getAuthRespInfo->authAssertion->sigData->assrtInfo->authVersion = 1;
+               getAuthRespInfo->authAssertion->sigData->assrtInfo->signatureAlgAndEncoding = UAF_ALG_SIGN_RSASSA_PSS_SHA256_RAW;
+               getAuthRespInfo->authAssertion->sigData->assrtInfo->publicKeyAlgAndEncoding = UAF_ALG_KEY_RSA_2048_PSS_RAW;
+
+               getAuthRespInfo->authAssertion->sigData->authNonce = ALLOC(Buffer);
+               getAuthRespInfo->authAssertion->sigData->authNonce->data = NALLOC(strlen((char*)nonce), uint8_t);
+               getAuthRespInfo->authAssertion->sigData->authNonce->len = strlen((char*)nonce);
+               memcpy(getAuthRespInfo->authAssertion->sigData->authNonce->data, nonce, strlen((char*)nonce));
+
+               getAuthRespInfo->authAssertion->sigData->fch = getAuthReqInfo->fch;
+
+               /*Transaction Content Hash*/
+               getAuthRespInfo->authAssertion->sigData->tcHash = ALLOC(Buffer);
+
+               /*tcHash when authMode = 0x02 i.e transaction content is not empty*/
+               if(getAuthReqInfo->tc != NULL) {
+
+                       unsigned char tcHash[32];
+                       getAuthRespInfo->authAssertion->sigData->assrtInfo->authMode = 0x02;
+                       int ret = AsmCrypto::genHash256(getAuthReqInfo->tc, strlen(getAuthReqInfo->tc), tcHash);
+                       if(ret == false) {
+                               _ERR("processAuthenticate:: Failed to create Transaction content hash.");
+                               return NULL;
+                       }
+
+                       getAuthRespInfo->authAssertion->sigData->tcHash->len = DIGEST_LEN;
+                       getAuthRespInfo->authAssertion->sigData->tcHash->data = NALLOC(DIGEST_LEN, uint8_t);
+                       memcpy(getAuthRespInfo->authAssertion->sigData->tcHash->data, tcHash, DIGEST_LEN);
+               }
+               /*authMode = 0x01*/
+               else {
+                       getAuthRespInfo->authAssertion->sigData->tcHash->len = 0;
+               }
+
+               getAuthRespInfo->authAssertion->sigData->keyId = ALLOC(Buffer);
+               getAuthRespInfo->authAssertion->sigData->keyId->data = NALLOC(strlen((char*)keyId_b64_enc), uint8_t);
+               getAuthRespInfo->authAssertion->sigData->keyId->len = strlen((char*)keyId_b64_enc);
+               memcpy(getAuthRespInfo->authAssertion->sigData->keyId->data, keyId_b64_enc, strlen((char*)keyId_b64_enc));
+               _INFO("gear_auth_keyid AUTH = [%s]", keyId_b64_enc);
+               _INFO("gear_auth_keyid AUTH len = [%d]", getAuthRespInfo->authAssertion->sigData->keyId->len);
+
+               getAuthRespInfo->authAssertion->sigData->counter = ALLOC(Counters);
+               getAuthRespInfo->authAssertion->sigData->counter->signCounter = __sign_counter;
+               /*TODO store _sign_counter in Auth DB*/
+
+               /*Get UAuth.priv from keyhandle*/
+               _INFO("processAuthenticate:: Length of b64 encoded keyHandle : [%d]", strlen((char*)khHLIter->data));
+
+               int inputSz = strlen((char*)khHLIter->data);
+               unsigned char* output = NULL;
+
+               output = (unsigned char*)calloc(1, inputSz*1.5);
+               int outputSz = 0;
+
+               if (0 != AsmCrypto::genB64Decodes((unsigned char*)khHLIter->data,
+                                                                                       inputSz,
+                                                                                       output,
+                                                                                       &outputSz))
+               {
+                       _ERR("Failed to decode base64.");
+                       free(output);
+                       return NULL;
+               }
+
+               unsigned char *kh_str_enc = output;
+               int kh_str_enc_len = outputSz;
+               _INFO("processAuthenticate:: Length of keyHandle from Auth Req to decrypt = [%d]", kh_str_enc_len);
+
+               _INFO("Before AESDecrypt");
+               unsigned char kh_str_dec[BIG_STRING_SIZE] = {0, };
+               int dec_len = AsmCrypto::aesDecrypt(kh_str_enc,
+                                                                                       kh_str_enc_len,
+                                                                                       key,//(const unsigned char*)symKey.c_str(),
+                                                                                       iv,//(const unsigned char*)symKey.c_str(),
+                                                                                       kh_str_dec);
+
+               if (dec_len <= 0)
+               {
+                       _ERR("AESDecryptof keyhandle failed");
+                       return NULL;
+               }
+
+               _INFO("After AESDecrypt, len=[%d]", dec_len);
+
+               kh_str_dec[dec_len] = '\0';
+
+               char *khA = NULL;
+               char *pri_key = NULL;
+               char *user_name = NULL;
+               __parse_key_handle_json(kh_str_dec, &khA, &pri_key, &user_name);
+               /* pri_key and khA are b64 encoded */
+               _INFO("Key Handle Parameters : [%s][%s][%s]", user_name, pri_key, khA);
+
+               unsigned char *khATkn_b64_dec = AsmCrypto::FromBase64Url((unsigned char*)khA, strlen(khA));
+               if (memcmp(getAuthReqInfo->khATok->data, khATkn_b64_dec, DIGEST_LEN) != 0) {
+                       _INFO("ERR::processAuthenticate:: khAcessToken not matching");
+                       return NULL;
+               }
+               _INFO("processAuthenticate:: khAcessToken matchining");
+
+               /*Signature = Sign TAG_UAFV1_SIGNED_DATA with UAuth.priv*/
+
+               Buffer *getSigDataInfoBuff = NULL;
+               TlvEncodable<SigData> encodableSigData(getAuthRespInfo->authAssertion->sigData);
+               int ret = encodableSigData.setEncoder(EID_UAFV1_SIGN_DATA_RESP);
+               if (ret == 0) {
+                       _INFO("setEncoder EID_UAFV1_SIGN_DATA_RESP PASS");
+               }
+               else {
+                       _INFO("setEncoder EID_UAFV1_SIGN_DATA_RESP FAIL");
+                       return NULL;
+               }
+
+               getSigDataInfoBuff = encodableSigData.encode();
+               if (getSigDataInfoBuff != NULL) {
+                       _INFO("encode EID_UAFV1_SIGN_DATA_RESP PASS");
+               }
+               else {
+                       _INFO("encode EID_UAFV1_SIGN_DATA_RESP FAIL");
+                       return NULL;
+               }
+
+               unsigned char * pri_key_b64_dec = AsmCrypto::FromBase64Url((unsigned char*)pri_key, strlen(pri_key));
+               /*TODO*/
+               int priv_key_len = strlen((char*)pri_key_b64_dec);
+               int sig_len = 0;
+               unsigned char *sig_str = AsmCrypto::fidoSignWithKey((const unsigned char *)getSigDataInfoBuff->data,
+                                                                                                       getSigDataInfoBuff->len,
+                                                                                                       pri_key_b64_dec, priv_key_len,
+                                                                                                       &sig_len);
+
+               if (sig_str == NULL) {
+                       _ERR("SignRSA failed for signature");
+                       return NULL;
+               }
+
+               getAuthRespInfo->authAssertion->sig = ALLOC(Buffer);
+               getAuthRespInfo->authAssertion->sig->data = NALLOC(strlen((char*)sig_str), uint8_t);
+               getAuthRespInfo->authAssertion->sig->len = sig_len;/*strlen((char*)sig_str);*/
+               memcpy(getAuthRespInfo->authAssertion->sig->data, sig_str, strlen((char*)sig_str));
+
+               response_parsed = true;
+
+               _INFO("SignRSA success for signature");
+       }
+
+       if (response_parsed == false)
+       {
+               _ERR("processAuthenticate:: Failed to Get Sign Response");
+               return NULL;
+
+       }
+
+       if (getAuthReqInfo->khHList != NULL)
+               _INFO("getAuthRespInfo khHList=[%p]", getAuthReqInfo->khHList);
+       else
+               _INFO("getAuthRespInfo khHList=[NULL]");
+
+       if (getAuthRespInfo->uKhList!= NULL)
+               _INFO("getAuthRespInfo uKhList=[%p]", getAuthRespInfo->uKhList);
+       else
+               _INFO("getAuthRespInfo uKhList=[NULL], normal");
+
+
+       Buffer *getAuthRespInfoBuff = ALLOC(Buffer);
+       TlvEncodable<AuthenticateResp> encodableAuthResp(getAuthRespInfo);
+
+       ret = encodableAuthResp.setEncoder(EID_UAFV1_SIGN_RESP);
+       if (ret == 0) {
+               _INFO("setEncoder EID_UAFV1_SIGN_RESP PASS \n");
+       }
+       else {
+               _INFO("setEncoder EID_UAFV1_SIGN_RESP FAIL \n");
+               return NULL;
+       }
+
+       getAuthRespInfoBuff = encodableAuthResp.encode();
+       if (getAuthRespInfoBuff != NULL) {
+               _INFO("encode EID_UAFV1_SIGN_RESP PASS \n");
+       }
+       else {
+               _INFO("encode EID_UAFV1_SIGN_RESP FAIL \n");
+               return NULL;
+       }
+
+       _INFO("===========================AUTHENTICATE REPONSE ENCODE=============================");
+
+       _INFO("========ProcessAuthenticate end PIN Auth=========");
+       return getAuthRespInfoBuff;
+}
+
+void *
+processRegister(unsigned char *assert_req)
+{
+
+       _INFO("========ProcessRegister start=========");
+       OpenSSL_add_all_algorithms();
+
+       RegisterReq *getRegReqInfo = NULL;
+       RegisterResp *getRegRespInfo = NULL;
+       getRegRespInfo = ALLOC(RegisterResp);
+       TlvEncodable<RegisterReq> encodableRegReq;
+
+       _INFO("===========================REGISTER REQUEST DECODE=============================");
+       int ret = encodableRegReq.setEncoder(EID_UAFV1_REGISTER_REQ);
+       if (ret == 0) {
+               _INFO("setEncoder EID_UAFV1_REGISTER_REQ PASS \n");
+       }
+       else {
+               _INFO("setEncoder EID_UAFV1_REGISTER_REQ FAIL \n");
+               return NULL;
+       }
+
+       getRegReqInfo = encodableRegReq.decode(assert_req);
+       if (getRegReqInfo != NULL) {
+               _INFO("decode EID_UAFV1_REGISTER_REQ PASS \n");
+       }
+       else {
+               _INFO("decode EID_UAFV1_REGISTER_REQ FAIL \n");
+               return NULL;
+       }
+       _INFO("===========================REGISTER REQUEST DECODE=============================");
+
+       _INFO("===========================REGISTER REPONSE ENCODE=============================");
+       getRegRespInfo->statusCode = UAF_CMD_STATUS_OK;
+
+       /*Generate a new UAuth.Pub UAuth.Priv key pair*/
+       char *priv_key_raw = NULL;
+       char *pub_key_raw = NULL;
+       int pri_len = 0;
+       int pub_len = 0;
+       int ret_c = AsmCrypto::createRSAKeyPair(2048, &pub_key_raw, &pub_len, &priv_key_raw, &pri_len);
+       if (ret_c != 0)
+       {
+               return NULL;
+       }
+
+       _INFO("After CreateRSAKeyPair");
+
+       _INFO("Before __create_raw_key_handle_string");
+       unsigned char *priv_key_b64_enc = NULL;
+       priv_key_b64_enc = AsmCrypto::ToBase64Url((unsigned char*)priv_key_raw, pri_len);
+       unsigned char *khATkn_b64_enc = NULL;
+       khATkn_b64_enc = AsmCrypto::ToBase64Url((unsigned char*)getRegReqInfo->khAccessToken->data, DIGEST_LEN);
+       char *kh_str = NULL;
+       kh_str = __create_raw_key_handle_string((char*)khATkn_b64_enc, (char*)priv_key_b64_enc, getRegReqInfo->userName);
+
+       __print_big_string(kh_str);
+
+       if (kh_str == NULL) {
+               return NULL;
+       }
+
+       _INFO("After __create_raw_key_handle_string");
+
+       int kh_str_enc_len = 0;
+       unsigned char kh_str_enc[BIG_STRING_SIZE] = {0, };
+       kh_str_enc_len = AsmCrypto::aesEncrypt((const unsigned char*)kh_str,
+                                                                                                         strlen(kh_str),
+                                                                                                         key,//(const unsigned char*)symKey.c_str(),
+                                                                                                         iv,//(const unsigned char*)symKey.c_str(),
+                                                                                                         kh_str_enc);
+
+       _INFO("After AESEncrypt, length = [%d]", kh_str_enc_len);
+       kh_str_enc[kh_str_enc_len] = '\0';
+
+       unsigned char digest[32];
+
+       AsmCrypto::genHash256(kh_str_enc, kh_str_enc_len, digest);
+       _INFO("genHash256 Length = %d", strlen((char*)digest));
+       _INFO("After genHash256 = %s", digest);
+
+       /*b64 encode of keyId*/
+       unsigned char *keyId_b64_enc = NULL;
+       keyId_b64_enc = AsmCrypto::ToBase64Url(digest, DIGEST_LEN);
+       /*b64 encode of keyId*/
+
+       getRegRespInfo->kh = ALLOC(Buffer);
+       getRegRespInfo->kh->data = NALLOC(kh_str_enc_len, uint8_t);;
+       memcpy(getRegRespInfo->kh->data, kh_str_enc, kh_str_enc_len);
+       getRegRespInfo->kh->len = kh_str_enc_len;
+
+
+       getRegRespInfo->regAssertion = ALLOC(RegAssertion);
+       getRegRespInfo->regAssertion->krd = ALLOC(Krd);
+
+       getRegRespInfo->regAssertion->krd->aaid = (char*)calloc(1, 128);
+       snprintf(getRegRespInfo->regAssertion->krd->aaid, 127, "%s", "TEST#1111");
+
+
+       getRegRespInfo->regAssertion->krd->assrtInfo = ALLOC(AssertionInfo);
+       getRegRespInfo->regAssertion->krd->assrtInfo->authVersion = 1;
+       getRegRespInfo->regAssertion->krd->assrtInfo->authMode = 1;
+       getRegRespInfo->regAssertion->krd->assrtInfo->signatureAlgAndEncoding = UAF_ALG_SIGN_RSASSA_PSS_SHA256_RAW;
+       getRegRespInfo->regAssertion->krd->assrtInfo->publicKeyAlgAndEncoding = UAF_ALG_KEY_RSA_2048_PSS_RAW;
+
+       getRegRespInfo->regAssertion->krd->fch = ALLOC(Buffer);
+       getRegRespInfo->regAssertion->krd->fch->len = getRegReqInfo->fch->len;
+       getRegRespInfo->regAssertion->krd->fch->data = NALLOC(getRegReqInfo->fch->len, uint8_t);
+       memcpy(getRegRespInfo->regAssertion->krd->fch->data, getRegReqInfo->fch->data, getRegReqInfo->fch->len);
+
+       getRegRespInfo->regAssertion->krd->keyId = ALLOC(Buffer);
+       getRegRespInfo->regAssertion->krd->keyId->data = NALLOC(strlen((char*)keyId_b64_enc), uint8_t);
+       memcpy(getRegRespInfo->regAssertion->krd->keyId->data, keyId_b64_enc, strlen((char*)keyId_b64_enc));
+       getRegRespInfo->regAssertion->krd->keyId->len = strlen((char*)keyId_b64_enc);
+       _INFO("gear_auth_keyid REG = [%s]", keyId_b64_enc);
+       _INFO("gear_auth_keyid REG len = [%d]", getRegRespInfo->regAssertion->krd->keyId->len);
+
+       getRegRespInfo->regAssertion->krd->counter = ALLOC(Counters);
+       getRegRespInfo->regAssertion->krd->counter->signCounter = __sign_counter;
+       getRegRespInfo->regAssertion->krd->counter->regCounter = __reg_counter;
+
+
+       getRegRespInfo->regAssertion->krd->pubKey = ALLOC(Buffer);
+       getRegRespInfo->regAssertion->krd->pubKey->data = NALLOC(pub_len, uint8_t);
+       memcpy(getRegRespInfo->regAssertion->krd->pubKey->data, pub_key_raw, pub_len);
+       getRegRespInfo->regAssertion->krd->pubKey->len = pub_len;
+
+
+
+       /*Signature = KRD data signed with attestation private key*/
+
+       Buffer *uafv1KrdBuff = NULL;
+       Krd *uafv1KrdInfo = NULL;
+       uafv1KrdInfo = getRegRespInfo->regAssertion->krd;
+       TlvEncodable<Krd> encodableKrd(uafv1KrdInfo);
+
+       ret = encodableKrd.setEncoder(EID_UAFV1_REG_ASSERTION_KRD_RESP);
+       if (ret == 0) {
+               _INFO("setEncoder EID_UAFV1_REG_ASSERTION_KRD_RESP PASS");
+       }
+       else {
+               _INFO("setEncoder EID_UAFV1_REG_ASSERTION_KRD_RESP FAIL");
+       }
+
+       uafv1KrdBuff = encodableKrd.encode();
+       if (uafv1KrdBuff != NULL) {
+               _INFO("encode EID_UAFV1_REG_ASSERTION_KRD_RESP PASS, length of encoded UAFV1KRD is = [%d]", uafv1KrdBuff->len);
+       }
+       else {
+               _INFO("encode EID_UAFV1_REG_ASSERTION_KRD_RESP FAIL");
+       }
+
+       unsigned char *krdStr = (unsigned char*)calloc(1, uafv1KrdBuff->len);
+       memcpy(krdStr, uafv1KrdBuff->data, uafv1KrdBuff->len);
+
+       int krdStr_len = uafv1KrdBuff->len;
+
+       _INFO("Before SignWithPrivateKeyFile");
+       int sig_len = 0;
+       unsigned char *sign_raw = AsmCrypto::fidoSign(krdStr, krdStr_len,
+                                                                                               FIDO_TIZEN_AUTH_KEY_PATH,
+                                                                                               "tizen", &sig_len);
+
+       if (sign_raw == NULL) {
+               _ERR("FIDO SignWithPrivateKeyFile failed");
+               return NULL;
+       }
+
+       _INFO("After SignWithPrivateKeyFile, Length of signature is = [%d]", sig_len);
+
+       int cert_len = 0;
+
+       unsigned char *cert_raw = NULL;
+       cert_raw = AsmCrypto::readDer(FIDO_TIZEN_AUTH_DER_PATH, &cert_len);
+       _INFO("After ReadRawCertFile");
+
+       getRegRespInfo->regAssertion->attFull = ALLOC(AttestationBasicFull);
+
+       getRegRespInfo->regAssertion->attFull->sig = ALLOC(Buffer);
+       getRegRespInfo->regAssertion->attFull->sig->data = NALLOC(sig_len, uint8_t);
+       memcpy(getRegRespInfo->regAssertion->attFull->sig->data, sign_raw, sig_len);
+       getRegRespInfo->regAssertion->attFull->sig->len = sig_len;
+
+       getRegRespInfo->regAssertion->attFull->cert = ALLOC(Buffer);
+       getRegRespInfo->regAssertion->attFull->cert->data = NALLOC(cert_len, uint8_t);
+       memcpy(getRegRespInfo->regAssertion->attFull->cert->data, cert_raw, cert_len);
+       getRegRespInfo->regAssertion->attFull->cert->len = cert_len;
+
+
+       TlvEncodable<RegisterResp> encodableRegResp(getRegRespInfo);
+       Buffer *getRegRespInfoBuff = NULL;
+
+       ret = encodableRegResp.setEncoder(EID_UAFV1_REGISTER_RESP);
+       if (ret == 0) {
+               _INFO("setEncoder EID_UAFV1_REGISTER_RESP PASS \n");
+       }
+       else {
+               _INFO("setEncoder EID_UAFV1_REGISTER_RESP FAIL \n");
+               return NULL;
+       }
+
+       getRegRespInfoBuff = encodableRegResp.encode();
+       if (getRegRespInfoBuff != NULL) {
+               _INFO("decode EID_UAFV1_REGISTER_RESP PASS \n");
+       }
+       else {
+               _INFO("decode EID_UAFV1_REGISTER_RESP FAIL \n");
+               return NULL;
+       }
+
+       _INFO("===========================REGISTER REPONSE ENCODE=============================");
+
+       __reg_counter++;
+       __sign_counter++;
+       _INFO("========ProcessRegister end=========");
+       return getRegRespInfoBuff;
+}
+
+void *
+processGetInfo()
+{
+       AuthenticatorInfo *authInfo = ALLOC(AuthenticatorInfo);
+
+       authInfo->__authenticatorIndex = 1;
+       authInfo->__aaid = strdup(AAID);
+
+       authInfo->__meta = ALLOC(AuthenticatorMetaData);
+       authInfo->__meta->authenticatorType = AUTHNR_REQUIRE_TAG_APPID | AUTHNR_HAS_BUILTIN_ENROLL_VERIFY_UI;// DIFFER;
+       authInfo->__meta->maxKeyHandles = 10;
+
+       authInfo->__meta->userVerification = USER_VERIFY_PASSCODE;//4
+
+       authInfo->__meta->keyProtection = KEY_PROTECTION_HARDWARE | KEY_PROTECTION_TEE;//6;
+       authInfo->__meta->matcherProtection = MATCHER_PROTECTION_TEE;//2
+
+       authInfo->__meta->transactionConfirmationDisplay =
+                       TRANSACTION_CONFIRMATION_DISPLAY_PRIVILEGED_SOFTWARE | TRANSACTION_CONFIRMATION_DISPLAY_ANY;//3;
+       authInfo->__meta->authenticationAlg = UAF_ALG_SIGN_RSASSA_PSS_SHA256_RAW;//3
+
+       authInfo->__tcDispConType = strdup(tcDispConType);
+
+       GList *tcDispList = NULL;
+       DisplayTc *tcPngGetInfo = ALLOC(DisplayTc);
+       tcPngGetInfo->width = 320;
+       tcPngGetInfo->height = 240;
+       tcPngGetInfo->bitDepth = 16;
+       tcPngGetInfo->colorType = 2;
+       tcPngGetInfo->compression = 0;
+       tcPngGetInfo->filter = 0;
+       tcPngGetInfo->interlace = 0;
+       tcPngGetInfo->plte = (char*)"";
+       tcDispList = g_list_append(tcDispList, tcPngGetInfo);
+       authInfo->__tcDisplayPNGCharacteristics = g_list_first(tcDispList);
+
+       authInfo->__assertionScheme = (char*)"UAFV1TLV";
+
+       GList *attTypes = NULL;
+       attTypes = g_list_append(attTypes, GINT_TO_POINTER(TAG_ATTESTATION_BASIC_FULL));
+       authInfo->__attestationTypes = g_list_first(attTypes);
+
+       GList *extList = NULL;
+       extList = g_list_append(extList, (char*)"abc");
+       authInfo->__extList = g_list_first(extList);
+
+       //out
+       GetAuthInfoResp *getAuthInfoRespInfo = ALLOC(GetAuthInfoResp);
+       getAuthInfoRespInfo->statusCode = UAF_CMD_STATUS_OK;
+       getAuthInfoRespInfo->apiVersion = 0;
+       GList *authList = NULL;
+       authList = g_list_append(authList, authInfo);
+       getAuthInfoRespInfo->authList = g_list_first(authList);
+
+       Buffer *getInfoRespBuff = NULL;
+       TlvEncodable<GetAuthInfoResp> encodableResp(getAuthInfoRespInfo);;
+
+       _INFO("===========================RESPONSE ENCODE=============================");
+       int ret = encodableResp.setEncoder(EID_UAFV1_GETINFO_RESP);
+       if (ret == 0) {
+               _INFO("setEncoder EID_UAFV1_GETINFO_RESP PASS \n");
+       }
+       else {
+               _INFO("setEncoder EID_UAFV1_GETINFO_RESP FAIL \n");
+               return NULL;
+       }
+
+       /*2) Create TLV encoded buffer*/
+       getInfoRespBuff = encodableResp.encode();
+       if (getInfoRespBuff != 0) {
+               _INFO("encode EID_UAFV1_GETINFO_RESP PASS \n");
+       }
+       else {
+               _INFO("encode EID_UAFV1_GETINFO_RESP FAIL \n");
+               return NULL;
+       }
+       _INFO("===========================RESPONSE ENCODE=============================");
+
+       return getInfoRespBuff;
+}
+
+static int
+fido_auth_plugin_fido_command_process_internal(unsigned char *assert_req,
+                                                                                          unsigned char **assrt_resp)
+{
+       _INFO("fido_auth_plugin_fido_command_process:: start");
+
+       tlv_s *root = tlv_decode(assert_req);
+
+       Buffer *getRespBuff = NULL;
+
+       bool foundMember = false;
+
+       switch(root->tag) {
+
+       case TAG_UAFV1_GETINFO_CMD:
+               getRespBuff = (Buffer*)processGetInfo();
+               if(getRespBuff != NULL)
+                       *assrt_resp = getRespBuff->data;
+               foundMember = true;
+               break;
+
+       case TAG_UAFV1_REGISTER_CMD:
+               getRespBuff = (Buffer*)processRegister(assert_req);
+               if(getRespBuff != NULL)
+                       *assrt_resp = getRespBuff->data;
+               foundMember = true;
+               break;
+
+       case TAG_UAFV1_SIGN_CMD:
+               getRespBuff = (Buffer*)processAuthenticate(assert_req);
+               if(getRespBuff != NULL)
+                       *assrt_resp = getRespBuff->data;
+               foundMember = true;
+               break;
+
+       case TAG_UAFV1_DEREGISTER_CMD:
+               getRespBuff = (Buffer*)processDeRegister(assert_req);
+               if(getRespBuff != NULL)
+                       *assrt_resp = getRespBuff->data;
+               foundMember = true;
+               break;
+
+       default:
+               foundMember = false;
+               break;
+       }
+
+       if(foundMember == false)
+               return -1;
+
+       _INFO("fido_auth_plugin_fido_command_process:: end");
+       return getRespBuff->len;
+}
+
+extern "C" {
+
+EXPORT_API int
+fido_auth_plugin_init(void)
+{
+       return 0;
+}
+
+EXPORT_API bool
+fido_auth_plugin_is_connected(void)
+{
+       return true;
+}
+
+EXPORT_API int
+fido_auth_plugin_de_init(void)
+{
+       return 0;
+}
+
+/*int fido_auth_plugin_get_assertion_scheme(char **scheme);
+unsigned char* fido_auth_plugin_encode_assertion(int tag, const void *data);
+void* fido_auth_plugin_decode_assertion(int tag, unsigned char *assrt);*/
+
+
+EXPORT_API int
+fido_auth_plugin_fido_command_process(unsigned char *assert_req,
+                                                                                  unsigned char **assrt_resp)
+{
+       return fido_auth_plugin_fido_command_process_internal(assert_req, assrt_resp);
+}
+
+EXPORT_API int
+fido_auth_plugin_command_process_custom(const char *id, const char *data,
+                                                                               bool fail_if_unknown, char **custom_op)
+{
+       _INFO("process_custom");
+
+       if (id == NULL) {
+               _ERR("NULL extension id");
+               return -1;
+       }
+
+       if (strcmp(id, AUTH_EXTENSION_ID_INIT) == 0) {
+               _INFO("Init custom command");
+               char *resp = (char*)(calloc(AUTH_EXTENSION_RESPONSE_SUCCESS_LEN, sizeof(char)));
+               snprintf(resp, AUTH_EXTENSION_RESPONSE_SUCCESS_LEN - 1, "%s", AUTH_EXTENSION_RESPONSE_SUCCESS);
+
+               *custom_op = resp;
+               return 0;
+       }
+
+       if (strcmp(id, AUTH_EXTENSION_ID_DE_INIT) == 0) {
+               _INFO("De-Init custom command");
+               char *resp = (char*)(calloc(AUTH_EXTENSION_RESPONSE_SUCCESS_LEN, sizeof(char)));
+               snprintf(resp, AUTH_EXTENSION_RESPONSE_SUCCESS_LEN - 1, "%s", AUTH_EXTENSION_RESPONSE_SUCCESS);
+
+               *custom_op = resp;
+               return 0;
+       }
+
+       _ERR("Unknown extension id = [%s]", id);
+       return -1;
+}
+
+EXPORT_API bool
+fido_auth_plugin_is_uv_required(void)
+{
+       return true;
+}
+
+EXPORT_API int
+fido_auth_plugin_is_enrolled(const char *args)
+{
+       /*TODO*/
+       return true;
+}
+
+EXPORT_API int
+fido_auth_plugin_enroll(const char *args)
+{
+       _INFO("");
+       /*TODO: user verification*/
+       return 0;
+}
+
+EXPORT_API int
+fido_auth_plugin_verify(const char *cmd, const char *fch, char **verif_token)
+{
+       _INFO("");
+       /*TODO: user verification*/
+       return 0;
+}
+
+EXPORT_API int
+fido_auth_plugin_get_attachment_hint(void)
+{
+       return ATTACHMENT_HINT_INTERNAL;
+}
+
+}
+
+/*int fido_auth_plugin_hash(const char *ip, char **op);
+int fido_auth_plugin_confirm_account(GList *acc_list, char **selected_acc);
+int fido_auth_plugin_confirm_tc(const transaction_s *tr);*/
diff --git a/silent_auth/silent_auth_entry.h b/silent_auth/silent_auth_entry.h
new file mode 100644 (file)
index 0000000..3c65036
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014 - 2015 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 <stdlib.h>
+#include <tizen.h>
+
+extern "C" {
+
+EXPORT_API int
+fido_auth_plugin_init(void);
+
+EXPORT_API bool
+fido_auth_plugin_is_connected(void);
+
+EXPORT_API int
+fido_auth_plugin_de_init(void);
+
+//int fido_auth_plugin_get_assertion_scheme(char **scheme);
+//unsigned char* fido_auth_plugin_encode_assertion(int tag, const void *data);
+//void* fido_auth_plugin_decode_assertion(int tag, unsigned char *assrt);
+
+EXPORT_API int
+fido_auth_plugin_fido_command_process(unsigned char *assert_req,
+                                                                                  unsigned char **assrt_resp);
+
+EXPORT_API bool
+fido_auth_plugin_is_uv_required(void);
+
+EXPORT_API int
+fido_auth_plugin_is_enrolled(const char *args);
+
+EXPORT_API int
+fido_auth_plugin_enroll(const char *args);
+
+EXPORT_API int
+fido_auth_plugin_verify(const char *opt, const char *fch, char **verif_token);
+
+}
+//int fido_auth_plugin_hash(const char *ip, char **op);
+
+
+
+//int fido_auth_plugin_confirm_account(GList *acc_list, char **selected_acc);
+//int fido_auth_plugin_confirm_tc(const transaction_s *tr);
diff --git a/test/RADemoTV/.cproject b/test/RADemoTV/.cproject
new file mode 100644 (file)
index 0000000..ebc8598
--- /dev/null
@@ -0,0 +1,609 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+       <storageModule moduleId="org.eclipse.cdt.core.settings">
+               <cconfiguration id="org.tizen.nativecore.config.sbi.gcc45.app.debug.1512528877">
+                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.tizen.nativecore.config.sbi.gcc45.app.debug.1512528877" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+                               <externalSettings/>
+                               <extensions>
+                                       <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+                                       <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.tizen.nativecore.NativeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                               </extensions>
+                       </storageModule>
+                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                               <configuration artifactName="rademotv" buildArtefactType="org.tizen.nativecore.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.tizen.nativecore.buildArtefactType.app,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;" id="org.tizen.nativecore.config.sbi.gcc45.app.debug.1512528877" name="Debug" parent="org.tizen.nativecore.config.sbi.gcc45.app.debug">
+                                       <folderInfo id="org.tizen.nativecore.config.sbi.gcc45.app.debug.1512528877." name="/" resourcePath="">
+                                               <toolChain id="org.tizen.nativecore.toolchain.sbi.gcc45.app.debug.2128411953" name="Tizen Native Toolchain" superClass="org.tizen.nativecore.toolchain.sbi.gcc45.app.debug">
+                                                       <targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.tizen.nativeide.target.sbi.gnu.platform.base.2087151131" osList="linux,win32" superClass="org.tizen.nativeide.target.sbi.gnu.platform.base"/>
+                                                       <builder autoBuildTarget="all" buildPath="${workspace_loc:/RADemoTV}/Debug" enableAutoBuild="true" id="org.tizen.nativecore.target.sbi.gnu.builder.1779026547" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Tizen Application Builder" superClass="org.tizen.nativecore.target.sbi.gnu.builder"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.1906707124" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/>
+                                                       <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.1627298761" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
+                                                               <option id="gnu.cpp.compiler.option.optimization.level.1832676570" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
+                                                               <option defaultValue="gnu.cpp.compiler.debugging.level.max" id="sbi.gnu.cpp.compiler.option.debugging.level.core.443203115" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core" valueType="enumerated"/>
+                                                               <option defaultValue="false" id="sbi.gnu.cpp.compiler.option.misc.pic.core.1032630338" name="-fPIC option" superClass="sbi.gnu.cpp.compiler.option.misc.pic.core" valueType="boolean"/>
+                                                               <option id="sbi.gnu.cpp.compiler.option.97336528" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs">
+                                                                       <listOptionValue builtIn="false" value="mobile-3.0-device.core_llvm36.armel.core.app"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.528370229" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES3&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/KHR&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/SDL2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appcore-agent&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appfw&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/attach-panel&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/badge&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/base&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/cairo&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/calendar-service2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/chromium-ewk&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ckm&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/contacts-svc&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/content&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/context-service&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/csr&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dali&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dali-toolkit&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dbus-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/device&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dlog&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-buffer-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-con-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-file-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-imf-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-imf-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-input-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-input-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-ipc-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ector-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/e_dbus-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/edje-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-extension&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efreet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1/eina&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eio-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eldbus-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/elementary-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/embryo-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/emile-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eo-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eom&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-client-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/feedback&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/fontconfig&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/freetype2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/geofence&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/gio-unix-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/glib-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/harfbuzz&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/iotcon&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/location&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/maps&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media-content&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/messaging&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/metadata-editor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minicontrol&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minizip&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/network&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/notification&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/nsd/&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/phonenumber-utils&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/sensor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/service-adaptor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/shortcut&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/storage&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/system&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/tzsh&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ui&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vulkan&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/web&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_service&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_viewer_evas&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/wifi-direct&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/yaca&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/dbus-1.0/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/glib-2.0/include&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.cpp.compiler.option.frameworks_cflags.core.1926291965" name="Tizen-Frameworks-Other-Cflags" superClass="sbi.gnu.cpp.compiler.option.frameworks_cflags.core" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="${TC_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value=" -fPIE"/>
+                                                                       <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="-mthumb"/>
+                                                               </option>
+                                                               <option id="gnu.cpp.compiler.option.include.paths.1768510976" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.cpp.compiler.option.frameworks.core.452293025" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs">
+                                                                       <listOptionValue builtIn="false" value="Native_API"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.512106004" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+                                                       </tool>
+                                                       <tool command="clang" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.1672312251" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
+                                                               <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.1367597950" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
+                                                               <option defaultValue="gnu.c.debugging.level.max" id="sbi.gnu.c.compiler.option.debugging.level.core.802572851" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core" valueType="enumerated"/>
+                                                               <option defaultValue="false" id="sbi.gnu.c.compiler.option.misc.pic.core.532674276" name="-fPIC option" superClass="sbi.gnu.c.compiler.option.misc.pic.core" valueType="boolean"/>
+                                                               <option id="sbi.gnu.c.compiler.option.2053704903" name="Tizen-Target" superClass="sbi.gnu.c.compiler.option" valueType="userObjs">
+                                                                       <listOptionValue builtIn="false" value="mobile-3.0-device.core_llvm36.armel.core.app"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.c.compiler.option.frameworks_inc.core.943960353" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES3&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/KHR&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/SDL2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appcore-agent&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appfw&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/attach-panel&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/badge&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/base&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/cairo&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/calendar-service2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/chromium-ewk&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ckm&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/contacts-svc&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/content&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/context-service&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/csr&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dali&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dali-toolkit&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dbus-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/device&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dlog&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-buffer-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-con-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-file-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-imf-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-imf-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-input-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-input-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-ipc-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ector-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/e_dbus-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/edje-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-extension&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efreet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1/eina&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eio-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eldbus-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/elementary-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/embryo-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/emile-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eo-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eom&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-client-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/feedback&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/fontconfig&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/freetype2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/geofence&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/gio-unix-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/glib-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/harfbuzz&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/iotcon&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/location&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/maps&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media-content&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/messaging&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/metadata-editor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minicontrol&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minizip&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/network&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/notification&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/nsd/&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/phonenumber-utils&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/sensor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/service-adaptor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/shortcut&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/storage&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/system&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/tzsh&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ui&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vulkan&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/web&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_service&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_viewer_evas&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/wifi-direct&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/yaca&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/dbus-1.0/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/glib-2.0/include&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.c.compiler.option.frameworks_cflags.core.2124951658" name="Tizen-Frameworks-Other-Cflags" superClass="sbi.gnu.c.compiler.option.frameworks_cflags.core" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="${TC_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value=" -fPIE"/>
+                                                                       <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="-mthumb"/>
+                                                               </option>
+                                                               <option id="gnu.c.compiler.option.include.paths.1693506999" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.c.compiler.option.frameworks.core.1754572152" name="Tizen-Frameworks" superClass="sbi.gnu.c.compiler.option.frameworks.core" valueType="userObjs">
+                                                                       <listOptionValue builtIn="false" value="Native_API"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.305632530" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+                                                       </tool>
+                                                       <tool id="org.tizen.nativeide.tool.sbi.gnu.c.linker.base.2109713866" name="C Linker" superClass="org.tizen.nativeide.tool.sbi.gnu.c.linker.base"/>
+                                                       <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.linker.69237816" name="C++ Linker" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.linker">
+                                                               <option defaultValue="false" id="sbi.gnu.cpp.linker.option.shared_flag.core.1953164636" name="Linker.Shared" superClass="sbi.gnu.cpp.linker.option.shared_flag.core" valueType="boolean"/>
+                                                               <option defaultValue="false" id="sbi.gnu.cpp.linker.option.noundefined.core.1704139821" name="Report unresolved symbol references (-Wl,--no-undefined)" superClass="sbi.gnu.cpp.linker.option.noundefined.core" valueType="boolean"/>
+                                                               <option id="sbi.gnu.cpp.linker.option.frameworks_lflags.core.1922255059" name="Tizen-Frameworks-Other-Lflags" superClass="sbi.gnu.cpp.linker.option.frameworks_lflags.core" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="${TC_LINKER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="${RS_LINKER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="-pie -lpthread "/>
+                                                                       <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="-Xlinker --version-script=&quot;${PROJ_PATH}/.exportMap&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="-L&quot;${SBI_SYSROOT}/usr/lib&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="$(RS_LIBRARIES)"/>
+                                                               </option>
+                                                               <option id="gnu.cpp.link.option.paths.1445351437" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/lib}&quot;"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1941869284" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+                                                                       <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+                                                                       <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+                                                               </inputType>
+                                                       </tool>
+                                                       <tool command="arm-linux-gnueabi-as" id="org.tizen.nativeapp.tool.sbi.gnu.assembler.base.1375376176" name="Assembler" superClass="org.tizen.nativeapp.tool.sbi.gnu.assembler.base">
+                                                               <inputType id="cdt.managedbuild.tool.gnu.assembler.input.305854659" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+                                                       </tool>
+                                                       <tool id="org.tizen.nativecore.tool.fnmapgen.874232161" name="C FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen"/>
+                                                       <tool id="org.tizen.nativecore.tool.fnmapgen.cpp.704991409" name="C++ FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen.cpp"/>
+                                                       <tool id="org.tizen.nativecore.tool.ast.2065753143" name="C Static Analyzer" superClass="org.tizen.nativecore.tool.ast"/>
+                                                       <tool id="org.tizen.nativecore.tool.ast.cpp.675935417" name="C++ Static Analyzer" superClass="org.tizen.nativecore.tool.ast.cpp"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib.1209711012" name="Archive Generator" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.po.compiler.237124027" name="PO Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.po.compiler"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.317812481" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler"/>
+                                               </toolChain>
+                                       </folderInfo>
+                                       <sourceEntries>
+                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="res"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="shared"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+                                       </sourceEntries>
+                               </configuration>
+                       </storageModule>
+                       <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+               </cconfiguration>
+               <cconfiguration id="org.tizen.nativecore.config.sbi.gcc45.app.release.32885584">
+                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.tizen.nativecore.config.sbi.gcc45.app.release.32885584" moduleId="org.eclipse.cdt.core.settings" name="Release">
+                               <externalSettings/>
+                               <extensions>
+                                       <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+                                       <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.tizen.nativecore.NativeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                               </extensions>
+                       </storageModule>
+                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                               <configuration artifactName="org.example.rademotv" buildArtefactType="org.tizen.nativecore.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.tizen.nativecore.buildArtefactType.app,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;" id="org.tizen.nativecore.config.sbi.gcc45.app.release.32885584" name="Release" parent="org.tizen.nativecore.config.sbi.gcc45.app.release">
+                                       <folderInfo id="org.tizen.nativecore.config.sbi.gcc45.app.release.32885584." name="/" resourcePath="">
+                                               <toolChain id="org.tizen.nativecore.toolchain.sbi.gcc45.app.release.74008053" name="Tizen Native Toolchain" superClass="org.tizen.nativecore.toolchain.sbi.gcc45.app.release">
+                                                       <targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.tizen.nativeide.target.sbi.gnu.platform.base.1773029908" osList="linux,win32" superClass="org.tizen.nativeide.target.sbi.gnu.platform.base"/>
+                                                       <builder buildPath="${workspace_loc:/RADemoTV}/Release" id="org.tizen.nativecore.target.sbi.gnu.builder.1724736439" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Tizen Application Builder" superClass="org.tizen.nativecore.target.sbi.gnu.builder"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.873491270" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/>
+                                                       <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.765369617" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
+                                                               <option id="gnu.cpp.compiler.option.optimization.level.1087820175" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
+                                                               <option defaultValue="gnu.cpp.compiler.debugging.level.default" id="sbi.gnu.cpp.compiler.option.debugging.level.core.2074049770" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core" valueType="enumerated"/>
+                                                               <option defaultValue="false" id="sbi.gnu.cpp.compiler.option.misc.pic.core.934430413" name="-fPIC option" superClass="sbi.gnu.cpp.compiler.option.misc.pic.core" valueType="boolean"/>
+                                                               <option id="sbi.gnu.cpp.compiler.option.1668281093" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs">
+                                                                       <listOptionValue builtIn="false" value="mobile-3.0-emulator.core_llvm36.i386.core.app"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.933451801" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES3&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/KHR&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/SDL2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appcore-agent&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appfw&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/attach-panel&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/badge&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/base&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/cairo&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/calendar-service2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/chromium-ewk&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ckm&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/contacts-svc&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/content&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/context-service&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/csr&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dali&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dali-toolkit&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dbus-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/device&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dlog&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-buffer-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-con-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-file-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-imf-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-imf-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-input-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-input-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-ipc-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ector-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/e_dbus-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/edje-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-extension&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efreet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1/eina&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eio-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eldbus-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/elementary-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/embryo-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/emile-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eo-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eom&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-client-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/feedback&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/fontconfig&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/freetype2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/geofence&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/gio-unix-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/glib-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/harfbuzz&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/iotcon&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/location&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/maps&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media-content&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/messaging&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/metadata-editor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minicontrol&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minizip&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/network&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/notification&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/nsd/&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/phonenumber-utils&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/sensor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/service-adaptor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/shortcut&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/storage&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/system&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/tzsh&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ui&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vulkan&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/web&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_service&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_viewer_evas&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/wifi-direct&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/yaca&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/dbus-1.0/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/glib-2.0/include&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.cpp.compiler.option.frameworks_cflags.core.1464266591" superClass="sbi.gnu.cpp.compiler.option.frameworks_cflags.core" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="${TC_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value=" -fPIE"/>
+                                                                       <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+                                                               </option>
+                                                               <option id="gnu.cpp.compiler.option.include.paths.800197544" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.cpp.compiler.option.frameworks.core.183608447" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs">
+                                                                       <listOptionValue builtIn="false" value="Native_API"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1108065743" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+                                                       </tool>
+                                                       <tool command="clang" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.1548622916" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
+                                                               <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.1551187703" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
+                                                               <option defaultValue="gnu.c.debugging.level.default" id="sbi.gnu.c.compiler.option.debugging.level.core.333665723" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core" valueType="enumerated"/>
+                                                               <option defaultValue="false" id="sbi.gnu.c.compiler.option.misc.pic.core.788602662" name="-fPIC option" superClass="sbi.gnu.c.compiler.option.misc.pic.core" valueType="boolean"/>
+                                                               <option id="sbi.gnu.c.compiler.option.636615911" superClass="sbi.gnu.c.compiler.option" valueType="userObjs">
+                                                                       <listOptionValue builtIn="false" value="mobile-3.0-emulator.core_llvm36.i386.core.app"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.c.compiler.option.frameworks_inc.core.227609972" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES3&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/KHR&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/SDL2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appcore-agent&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appfw&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/attach-panel&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/badge&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/base&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/cairo&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/calendar-service2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/chromium-ewk&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ckm&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/contacts-svc&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/content&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/context-service&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/csr&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dali&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dali-toolkit&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dbus-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/device&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dlog&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-buffer-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-con-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-file-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-imf-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-imf-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-input-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-input-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-ipc-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ector-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/e_dbus-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/edje-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-extension&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efreet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1/eina&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eio-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eldbus-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/elementary-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/embryo-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/emile-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eo-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eom&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-client-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/feedback&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/fontconfig&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/freetype2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/geofence&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/gio-unix-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/glib-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/harfbuzz&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/iotcon&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/location&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/maps&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media-content&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/messaging&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/metadata-editor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minicontrol&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minizip&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/network&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/notification&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/nsd/&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/phonenumber-utils&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/sensor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/service-adaptor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/shortcut&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/storage&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/system&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/tzsh&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ui&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vulkan&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/web&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_service&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_viewer_evas&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/wifi-direct&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/yaca&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/dbus-1.0/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/glib-2.0/include&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.c.compiler.option.frameworks_cflags.core.2135725134" superClass="sbi.gnu.c.compiler.option.frameworks_cflags.core" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="${TC_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value=" -fPIE"/>
+                                                                       <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+                                                               </option>
+                                                               <option id="gnu.c.compiler.option.include.paths.408957944" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.c.compiler.option.frameworks.core.2039111500" superClass="sbi.gnu.c.compiler.option.frameworks.core" valueType="userObjs">
+                                                                       <listOptionValue builtIn="false" value="Native_API"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.395560190" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+                                                       </tool>
+                                                       <tool id="org.tizen.nativeide.tool.sbi.gnu.c.linker.base.2037186588" name="C Linker" superClass="org.tizen.nativeide.tool.sbi.gnu.c.linker.base"/>
+                                                       <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.linker.2061646251" name="C++ Linker" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.linker">
+                                                               <option defaultValue="false" id="sbi.gnu.cpp.linker.option.shared_flag.core.1742112829" name="Linker.Shared" superClass="sbi.gnu.cpp.linker.option.shared_flag.core" valueType="boolean"/>
+                                                               <option defaultValue="false" id="sbi.gnu.cpp.linker.option.noundefined.core.67868224" name="Report unresolved symbol references (-Wl,--no-undefined)" superClass="sbi.gnu.cpp.linker.option.noundefined.core" valueType="boolean"/>
+                                                               <option id="sbi.gnu.cpp.linker.option.frameworks_lflags.core.1947884829" superClass="sbi.gnu.cpp.linker.option.frameworks_lflags.core" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="${TC_LINKER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="${RS_LINKER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="-pie -lpthread "/>
+                                                                       <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="-Xlinker --version-script=&quot;${PROJ_PATH}/.exportMap&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="-L&quot;${SBI_SYSROOT}/usr/lib&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="$(RS_LIBRARIES)"/>
+                                                               </option>
+                                                               <option id="gnu.cpp.link.option.paths.1097693748" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/lib}&quot;"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1974166046" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+                                                                       <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+                                                                       <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+                                                               </inputType>
+                                                       </tool>
+                                                       <tool command="i386-linux-gnueabi-as" id="org.tizen.nativeapp.tool.sbi.gnu.assembler.base.151612045" name="Assembler" superClass="org.tizen.nativeapp.tool.sbi.gnu.assembler.base">
+                                                               <inputType id="cdt.managedbuild.tool.gnu.assembler.input.845630775" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+                                                       </tool>
+                                                       <tool id="org.tizen.nativecore.tool.fnmapgen.1208142076" name="C FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen"/>
+                                                       <tool id="org.tizen.nativecore.tool.fnmapgen.cpp.1866120657" name="C++ FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen.cpp"/>
+                                                       <tool id="org.tizen.nativecore.tool.ast.1360178249" name="C Static Analyzer" superClass="org.tizen.nativecore.tool.ast"/>
+                                                       <tool id="org.tizen.nativecore.tool.ast.cpp.1447662289" name="C++ Static Analyzer" superClass="org.tizen.nativecore.tool.ast.cpp"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib.898976719" name="Archive Generator" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.po.compiler.1560654730" name="PO Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.po.compiler"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.1696132999" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler"/>
+                                               </toolChain>
+                                       </folderInfo>
+                                       <sourceEntries>
+                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="res"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="shared"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+                                       </sourceEntries>
+                               </configuration>
+                       </storageModule>
+                       <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+               </cconfiguration>
+       </storageModule>
+       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+               <project id="RADemoTV.org.tizen.nativecore.target.sbi.gcc45.app.1131191937" name="Tizen Native Application" projectType="org.tizen.nativecore.target.sbi.gcc45.app"/>
+       </storageModule>
+       <storageModule moduleId="scannerConfiguration">
+               <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+               <scannerConfigBuildInfo instanceId="org.tizen.nativecore.config.sbi.gcc45.app.debug.1512528877">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+               </scannerConfigBuildInfo>
+               <scannerConfigBuildInfo instanceId="org.tizen.nativecore.config.sbi.gcc45.app.release.32885584">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+               </scannerConfigBuildInfo>
+       </storageModule>
+       <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+       <storageModule moduleId="refreshScope"/>
+</cproject>
diff --git a/test/RADemoTV/.exportMap b/test/RADemoTV/.exportMap
new file mode 100644 (file)
index 0000000..43e310e
--- /dev/null
@@ -0,0 +1,4 @@
+{
+       global: main;
+       local: *;
+};
diff --git a/test/RADemoTV/.gitignore b/test/RADemoTV/.gitignore
new file mode 100644 (file)
index 0000000..3df573f
--- /dev/null
@@ -0,0 +1 @@
+/Debug/
diff --git a/test/RADemoTV/.package-stamp b/test/RADemoTV/.package-stamp
new file mode 100644 (file)
index 0000000..40cbe59
--- /dev/null
@@ -0,0 +1 @@
+TPK
\ No newline at end of file
diff --git a/test/RADemoTV/.project b/test/RADemoTV/.project
new file mode 100644 (file)
index 0000000..46db98f
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>RADemoTV</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+                       <triggers>full,incremental,</triggers>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.cdt.core.cnature</nature>
+               <nature>org.eclipse.cdt.core.ccnature</nature>
+               <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+               <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+       </natures>
+       <filteredResources>
+               <filter>
+                       <id>1473239863235</id>
+                       <name></name>
+                       <type>26</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-projectRelativePath-matches-false-false-*/.tpk</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1473239863239</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-project_def.prop</arguments>
+                       </matcher>
+               </filter>
+       </filteredResources>
+</projectDescription>
diff --git a/test/RADemoTV/.rds_delta b/test/RADemoTV/.rds_delta
new file mode 100644 (file)
index 0000000..c18d7b5
--- /dev/null
@@ -0,0 +1,6 @@
+#delete
+#add
+#modify
+author-signature.xml
+signature1.xml
+bin/rademotv
diff --git a/test/RADemoTV/.sdk_delta.info b/test/RADemoTV/.sdk_delta.info
new file mode 100644 (file)
index 0000000..00f10e7
Binary files /dev/null and b/test/RADemoTV/.sdk_delta.info differ
diff --git a/test/RADemoTV/.sign/.manifest.tmp b/test/RADemoTV/.sign/.manifest.tmp
new file mode 100644 (file)
index 0000000..0e0ccde
--- /dev/null
@@ -0,0 +1,33 @@
+bin/rademotv__DEL__6/NykFU4nuwn7JChNFNW40LmK7FZetyAgLHXLXhTzuI=
+res/images/Clock_tabs_icon_alarm.png__DEL__UKIioAnp7EOVknfT7GrjomHAlbgVXDnljL9GL8ItOw0=
+res/images/Clock_tabs_icon_timer.png__DEL__gI5K8dcngljoGhr5KuyKw0Aqhq9ZnykoMcU7F5XakDs=
+res/images/Clock_tabs_icon_world_clock.png__DEL__2ldDLlV6LpIOqzFAJ1CybgkAf/S/sznZPqKzCVSqhrU=
+res/images/Clock_tabs_icon_world_stopwatch.png__DEL__+IafhrGsAODlcITwxeT98j/lOAyT0HbPTZo4jttnFHE=
+res/images/arrow-down.png__DEL__Y6myUm14hX/nPMj+RLmYGRA7KN5+mU1F3SmxR9iORTQ=
+res/images/arrow-left.png__DEL__YejJZt9nNb9xQwV5qenq93ezIbuxC8ZyZVwTgMByPvg=
+res/images/arrow-left1.png__DEL__SMBg7AWZVOu3YPjwx61tdpLIuMlgokp3aPBLj7wRlGI=
+res/images/arrow-right.png__DEL__ghgPMHrtivgImJpXjaPLjklLDOT/WIa0R8zWxNJTt18=
+res/images/arrow-up.png__DEL__Zw9k6AyPpFzAvyRVvdrGZpRZmca1C6mUYCaCQtKC7Q0=
+res/images/btn_style_nor.png__DEL__V4ihVvVB4A6jNxoD5FCJG20I5zqFv2IncqF5vzACvEA=
+res/images/contacts_ic_circle_btn_call.png__DEL__ETR+/vrHSGsgqBk+2/qcFgenAno0K/rt6+RSMMA+3oE=
+res/images/contacts_ic_circle_btn_email.png__DEL__VBhkh+VhOjOqTeXoy8OKkrSjrlGPqdmrkc6HbSJjRFg=
+res/images/contacts_ic_circle_btn_note.png__DEL__x6Gjo2Ll1KzMWaT9R0+Q0O79T4Rq+DGCP29zIvW1Vmo=
+res/images/core_floating_icon_01.png__DEL__mYnkdwSLROPeT/XcO0miEa+qr2ezQ8Cq2IdB/MLRGU4=
+res/images/core_floating_icon_02.png__DEL__CxiRjdTnu+cPuDgCWPwRjALTI0bmUow2KWlLpfKMNBk=
+res/images/core_icon_expand_close.png__DEL__/6zSt3lcSoIucq46eFb6k4dkMcqaTvnqcbXI/MThxp0=
+res/images/core_icon_expand_open.png__DEL__tBixjttIXfanmUvxmDRq2ezNK/KfDbRq/aYSQ3OXR2w=
+res/images/custom_highlight.png__DEL__WGhT3oJZtw3KwIyZpxTsgYYprqZX4G7O0tYFFgbuZAM=
+res/images/custom_highlight2.png__DEL__mSgblCuD523ZVKO7OZcVu1kxhLVB/Ok/YTn6d+gNjl0=
+res/images/grid_image/1_raw.png__DEL__trJ6JwE5vDCxOzBy58lT8mZo8oFej7lYcXA8aM9LrbA=
+res/images/grid_image/2_raw.png__DEL__1/p9dJr33nY1C0XgKEdCpZrZUb8t5qXaihqd6/pCiE4=
+res/images/horz_scrollbar.png__DEL__ZJMOojE8pcti4mJJDD/iNw8d0k139TVGwzwEpGNbNyQ=
+res/images/tizen.png__DEL__0iTqeav2g4RFtoy07o/daD1pm40RTbXVb2/E6Jt25Dk=
+res/offline_auth_req.json__DEL__oZb4hdBo7gfvHQp3Phmi7OrQvOTkYebs+cj0CUB55wQ=
+res/offline_dereg_req.json__DEL__ls9i8E/7YfyG+yCzw/XQC8as8ooSZNM8ItkTCvG3AQ0=
+res/offline_reg_req.json__DEL__rdOHCvLX1D/a4sN49GMCPTDj4spKyHjgXrcTvDmtHmI=
+res/ui-controls.edc__DEL__yT6Ox68AGW/HIfljsxpDJ0/42qHiF0sSTOPCj0hDChM=
+res/ui-controls.edj__DEL__zY+RgwVhayMhI8gOpkbxqIKV8/Sqe8uUkf/hn4wUZcQ=
+shared/res/fido.png__DEL__9DwesXg1NEg1AEHfbtrY6C9YwJoypEr2v6hOyWHW6i8=
+shared/res/rademotv.png__DEL__1d0oEZHqPn+QzNzGIHwj9ODby6x9ggFs9uOsav6jPNs=
+tizen-manifest.xml__DEL__hf3BnDDOp8ZyVZbapG4QNDJtBWqH8Qa24aJD4/kN4dY=
+author-signature.xml__DEL__7K9ckaGz1GQydrpk8zkpnZw1mh7PkeJZQ41FJxuRd3Q=
diff --git a/test/RADemoTV/.sign/author-signature.xml b/test/RADemoTV/.sign/author-signature.xml
new file mode 100644 (file)
index 0000000..845390e
--- /dev/null
@@ -0,0 +1,182 @@
+<Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="AuthorSignature">
+<SignedInfo>
+<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></CanonicalizationMethod>
+<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"></SignatureMethod>
+<Reference URI="bin%2Frademotv">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>6/NykFU4nuwn7JChNFNW40LmK7FZetyAgLHXLXhTzuI=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2FClock_tabs_icon_alarm.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>UKIioAnp7EOVknfT7GrjomHAlbgVXDnljL9GL8ItOw0=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2FClock_tabs_icon_timer.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>gI5K8dcngljoGhr5KuyKw0Aqhq9ZnykoMcU7F5XakDs=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2FClock_tabs_icon_world_clock.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>2ldDLlV6LpIOqzFAJ1CybgkAf/S/sznZPqKzCVSqhrU=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2FClock_tabs_icon_world_stopwatch.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>+IafhrGsAODlcITwxeT98j/lOAyT0HbPTZo4jttnFHE=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Farrow-down.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>Y6myUm14hX/nPMj+RLmYGRA7KN5+mU1F3SmxR9iORTQ=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Farrow-left.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>YejJZt9nNb9xQwV5qenq93ezIbuxC8ZyZVwTgMByPvg=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Farrow-left1.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>SMBg7AWZVOu3YPjwx61tdpLIuMlgokp3aPBLj7wRlGI=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Farrow-right.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>ghgPMHrtivgImJpXjaPLjklLDOT/WIa0R8zWxNJTt18=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Farrow-up.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>Zw9k6AyPpFzAvyRVvdrGZpRZmca1C6mUYCaCQtKC7Q0=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fbtn_style_nor.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>V4ihVvVB4A6jNxoD5FCJG20I5zqFv2IncqF5vzACvEA=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcontacts_ic_circle_btn_call.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>ETR+/vrHSGsgqBk+2/qcFgenAno0K/rt6+RSMMA+3oE=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcontacts_ic_circle_btn_email.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>VBhkh+VhOjOqTeXoy8OKkrSjrlGPqdmrkc6HbSJjRFg=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcontacts_ic_circle_btn_note.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>x6Gjo2Ll1KzMWaT9R0+Q0O79T4Rq+DGCP29zIvW1Vmo=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcore_floating_icon_01.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>mYnkdwSLROPeT/XcO0miEa+qr2ezQ8Cq2IdB/MLRGU4=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcore_floating_icon_02.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>CxiRjdTnu+cPuDgCWPwRjALTI0bmUow2KWlLpfKMNBk=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcore_icon_expand_close.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>/6zSt3lcSoIucq46eFb6k4dkMcqaTvnqcbXI/MThxp0=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcore_icon_expand_open.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>tBixjttIXfanmUvxmDRq2ezNK/KfDbRq/aYSQ3OXR2w=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcustom_highlight.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>WGhT3oJZtw3KwIyZpxTsgYYprqZX4G7O0tYFFgbuZAM=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcustom_highlight2.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>mSgblCuD523ZVKO7OZcVu1kxhLVB/Ok/YTn6d+gNjl0=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fgrid_image%2F1_raw.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>trJ6JwE5vDCxOzBy58lT8mZo8oFej7lYcXA8aM9LrbA=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fgrid_image%2F2_raw.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>1/p9dJr33nY1C0XgKEdCpZrZUb8t5qXaihqd6/pCiE4=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fhorz_scrollbar.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>ZJMOojE8pcti4mJJDD/iNw8d0k139TVGwzwEpGNbNyQ=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Ftizen.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>0iTqeav2g4RFtoy07o/daD1pm40RTbXVb2/E6Jt25Dk=</DigestValue>
+</Reference>
+<Reference URI="res%2Foffline_auth_req.json">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>oZb4hdBo7gfvHQp3Phmi7OrQvOTkYebs+cj0CUB55wQ=</DigestValue>
+</Reference>
+<Reference URI="res%2Foffline_dereg_req.json">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>ls9i8E/7YfyG+yCzw/XQC8as8ooSZNM8ItkTCvG3AQ0=</DigestValue>
+</Reference>
+<Reference URI="res%2Foffline_reg_req.json">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>rdOHCvLX1D/a4sN49GMCPTDj4spKyHjgXrcTvDmtHmI=</DigestValue>
+</Reference>
+<Reference URI="res%2Fui-controls.edc">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>yT6Ox68AGW/HIfljsxpDJ0/42qHiF0sSTOPCj0hDChM=</DigestValue>
+</Reference>
+<Reference URI="res%2Fui-controls.edj">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>zY+RgwVhayMhI8gOpkbxqIKV8/Sqe8uUkf/hn4wUZcQ=</DigestValue>
+</Reference>
+<Reference URI="shared%2Fres%2Ffido.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>9DwesXg1NEg1AEHfbtrY6C9YwJoypEr2v6hOyWHW6i8=</DigestValue>
+</Reference>
+<Reference URI="shared%2Fres%2Frademotv.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>1d0oEZHqPn+QzNzGIHwj9ODby6x9ggFs9uOsav6jPNs=</DigestValue>
+</Reference>
+<Reference URI="tizen-manifest.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>hf3BnDDOp8ZyVZbapG4QNDJtBWqH8Qa24aJD4/kN4dY=</DigestValue>
+</Reference>
+<Reference URI="#prop">
+<Transforms>
+<Transform Algorithm="http://www.w3.org/2006/12/xml-c14n11"></Transform>
+</Transforms>
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>lpo8tUDs054eLlBQXiDPVDVKfw30ZZdtkRs1jd7H5K8=</DigestValue>
+</Reference>
+</SignedInfo>
+<SignatureValue>
+o9X1remP0l3i/1LdxaKEtQungByfq6filBpnmxprmlrLGlbJ8NvlYwLGbiESY21gHajumW4Zyn//
+c/iy8VFQOX04y9Nk2cxLO2Ut3RjUIakHyk32y+KgoBlRZAusGD1EQ/zu0noLLbiSzZcFhe96NO+d
+b74qVqwdHfy9tYxkyao=
+</SignatureValue>
+<KeyInfo>
+<X509Data>
+<X509Certificate>
+MIIClTCCAX2gAwIBAgIGAVWW5WFDMA0GCSqGSIb3DQEBBQUAMFYxGjAYBgNVBAoMEVRpemVuIEFz
+c29jaWF0aW9uMRowGAYDVQQLDBFUaXplbiBBc3NvY2lhdGlvbjEcMBoGA1UEAwwTVGl6ZW4gRGV2
+ZWxvcGVycyBDQTAeFw0xMjExMDEwMDAwMDBaFw0xOTAxMDEwMDAwMDBaMBExDzANBgNVBAMMBmF1
+dGhvcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEApQoQG76AhcGiaETu54POHH1PJlQRJk6y
++e6WWnbO6rc9HxFyA/37KdPO8okqiifUw9q9gRT3vN5dk5QHcS7dtsWcN4wmpf/gunezYMFc76q+
+BR1xEt3di0TSROqHrD+3yS4tyKVSlaXtPFIyR5RMAI3X3k1np9/1SWjpEAt9mskCAwEAAaMyMDAw
+DAYDVR0TAQH/BAIwADALBgNVHQ8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUHAwMwDQYJKoZIhvcN
+AQEFBQADggEBAC+4orztdjnriaP3CHkHMGmNU9VxhfXZqMM8zycz3HYhfffUkWYKKsT+1ZQisKON
+3odhBQGDgQussm9PpQFyQ1epkeLbVTDXRwSE4vAiJpZwKRVmcHzi8/l9i4DxvecI5RgAX1BBBUCw
+6FRDlLmJ2Kvz6wVS8CTRsXp6DyDMQl6OkmMwKbvAGFhpbVmy8l6G+QEpTsU4WY9gigHjJ2tafVI7
+XREhC+8+BrViOTNx7FxqXgoD+cSb8UUEtqSb6H72XQZLgW2FK1WvWzMCyseE2wzi9dUCgAtdF5tI
+FGEd9WPy119WDEzes8sAdkeCxGtiycN99kP/m/2j3Ubt2G7E6LA=
+</X509Certificate>
+<X509Certificate>
+MIIDOTCCAiGgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMRowGAYDVQQKDBFUaXplbiBBc3NvY2lh
+dGlvbjEaMBgGA1UECwwRVGl6ZW4gQXNzb2NpYXRpb24xHjAcBgNVBAMMFVRpemVuIERldmVsb3Bl
+cnMgUm9vdDAeFw0xMjAxMDEwMDAwMDBaFw0yNzAxMDEwMDAwMDBaMFYxGjAYBgNVBAoMEVRpemVu
+IEFzc29jaWF0aW9uMRowGAYDVQQLDBFUaXplbiBBc3NvY2lhdGlvbjEcMBoGA1UEAwwTVGl6ZW4g
+RGV2ZWxvcGVycyBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANVGhRGmMIUyBA7o
+PCz8Sxut6z6HNkF4oDIuzuKaMzRYPeWodwe9O0gmqAkToQHfwg2giRhE5GoPld0fq+OYMMwSasCu
+g8dwODx1eDeSYVuOLWRxpAmbTXOsSFi6VoWeyaPEm18JBHvZBsU5YQtgZ6Kp7MqzvQg3pXOxtajj
+vyHxiatJl+xXrHgcXC1wgyG3buty7u/Fi2mvKXJ0PRJcCjjK81dqe/Vr20sRUCrbk02zbm5ggFt/
+jIEhV8wbFRQpliobc7J4dSTKhFfrqGM8rdd54LYhD7gSI1CFSe16pUXfcVR7FhJztRaiGLnCrwBE
+dyTZ248+D4L/qR/D0axb3jcCAwEAAaMQMA4wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOC
+AQEAnOXXQ/1O/QTDHyrmQDtFziqPY3xWlJBqJtEqXiT7Y+Ljpe66e+Ee/OjQMlZe8gu21/8cKklH
+95RxjopMWCVedXDUbWdvS2+CdyvVW/quT2E0tjqIzXDekUTYwwhlPWlGxvfj3VsxqSFq3p8Brl04
+1Gx5RKAGyKVsMfTLhbbwSWwApuBUxYfcNpKwLWGPXkysu+HctY03OKv4/xKBnVWiN8ex/Sgesi0M
++OBAOMdZMPK32uJBTeKFx1xZgTLIhk45V0hPOomPjZloiv0LSS11eyd451ufjW0iHRE7WlpR6EvI
+W6TFyZgMpQq+kg4hWl2SBTf3s2VI8Ygz7gj8TMlClg==
+</X509Certificate>
+</X509Data>
+</KeyInfo>
+<Object Id="prop"><SignatureProperties xmlns:dsp="http://www.w3.org/2009/xmldsig-properties"><SignatureProperty Id="profile" Target="#AuthorSignature"><dsp:Profile URI="http://www.w3.org/ns/widgets-digsig#profile"></dsp:Profile></SignatureProperty><SignatureProperty Id="role" Target="#AuthorSignature"><dsp:Role URI="http://www.w3.org/ns/widgets-digsig#role-author"></dsp:Role></SignatureProperty><SignatureProperty Id="identifier" Target="#AuthorSignature"><dsp:Identifier></dsp:Identifier></SignatureProperty></SignatureProperties></Object>
+</Signature>
\ No newline at end of file
diff --git a/test/RADemoTV/.sign/signature1.xml b/test/RADemoTV/.sign/signature1.xml
new file mode 100644 (file)
index 0000000..6a21c0d
--- /dev/null
@@ -0,0 +1,184 @@
+<Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="DistributorSignature">
+<SignedInfo>
+<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></CanonicalizationMethod>
+<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"></SignatureMethod>
+<Reference URI="author-signature.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>7K9ckaGz1GQydrpk8zkpnZw1mh7PkeJZQ41FJxuRd3Q=</DigestValue>
+</Reference>
+<Reference URI="bin%2Frademotv">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>6/NykFU4nuwn7JChNFNW40LmK7FZetyAgLHXLXhTzuI=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2FClock_tabs_icon_alarm.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>UKIioAnp7EOVknfT7GrjomHAlbgVXDnljL9GL8ItOw0=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2FClock_tabs_icon_timer.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>gI5K8dcngljoGhr5KuyKw0Aqhq9ZnykoMcU7F5XakDs=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2FClock_tabs_icon_world_clock.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>2ldDLlV6LpIOqzFAJ1CybgkAf/S/sznZPqKzCVSqhrU=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2FClock_tabs_icon_world_stopwatch.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>+IafhrGsAODlcITwxeT98j/lOAyT0HbPTZo4jttnFHE=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Farrow-down.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>Y6myUm14hX/nPMj+RLmYGRA7KN5+mU1F3SmxR9iORTQ=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Farrow-left.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>YejJZt9nNb9xQwV5qenq93ezIbuxC8ZyZVwTgMByPvg=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Farrow-left1.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>SMBg7AWZVOu3YPjwx61tdpLIuMlgokp3aPBLj7wRlGI=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Farrow-right.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>ghgPMHrtivgImJpXjaPLjklLDOT/WIa0R8zWxNJTt18=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Farrow-up.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>Zw9k6AyPpFzAvyRVvdrGZpRZmca1C6mUYCaCQtKC7Q0=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fbtn_style_nor.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>V4ihVvVB4A6jNxoD5FCJG20I5zqFv2IncqF5vzACvEA=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcontacts_ic_circle_btn_call.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>ETR+/vrHSGsgqBk+2/qcFgenAno0K/rt6+RSMMA+3oE=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcontacts_ic_circle_btn_email.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>VBhkh+VhOjOqTeXoy8OKkrSjrlGPqdmrkc6HbSJjRFg=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcontacts_ic_circle_btn_note.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>x6Gjo2Ll1KzMWaT9R0+Q0O79T4Rq+DGCP29zIvW1Vmo=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcore_floating_icon_01.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>mYnkdwSLROPeT/XcO0miEa+qr2ezQ8Cq2IdB/MLRGU4=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcore_floating_icon_02.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>CxiRjdTnu+cPuDgCWPwRjALTI0bmUow2KWlLpfKMNBk=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcore_icon_expand_close.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>/6zSt3lcSoIucq46eFb6k4dkMcqaTvnqcbXI/MThxp0=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcore_icon_expand_open.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>tBixjttIXfanmUvxmDRq2ezNK/KfDbRq/aYSQ3OXR2w=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcustom_highlight.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>WGhT3oJZtw3KwIyZpxTsgYYprqZX4G7O0tYFFgbuZAM=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fcustom_highlight2.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>mSgblCuD523ZVKO7OZcVu1kxhLVB/Ok/YTn6d+gNjl0=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fgrid_image%2F1_raw.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>trJ6JwE5vDCxOzBy58lT8mZo8oFej7lYcXA8aM9LrbA=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fgrid_image%2F2_raw.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>1/p9dJr33nY1C0XgKEdCpZrZUb8t5qXaihqd6/pCiE4=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Fhorz_scrollbar.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>ZJMOojE8pcti4mJJDD/iNw8d0k139TVGwzwEpGNbNyQ=</DigestValue>
+</Reference>
+<Reference URI="res%2Fimages%2Ftizen.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>0iTqeav2g4RFtoy07o/daD1pm40RTbXVb2/E6Jt25Dk=</DigestValue>
+</Reference>
+<Reference URI="res%2Foffline_auth_req.json">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>oZb4hdBo7gfvHQp3Phmi7OrQvOTkYebs+cj0CUB55wQ=</DigestValue>
+</Reference>
+<Reference URI="res%2Foffline_dereg_req.json">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>ls9i8E/7YfyG+yCzw/XQC8as8ooSZNM8ItkTCvG3AQ0=</DigestValue>
+</Reference>
+<Reference URI="res%2Foffline_reg_req.json">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>rdOHCvLX1D/a4sN49GMCPTDj4spKyHjgXrcTvDmtHmI=</DigestValue>
+</Reference>
+<Reference URI="res%2Fui-controls.edc">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>yT6Ox68AGW/HIfljsxpDJ0/42qHiF0sSTOPCj0hDChM=</DigestValue>
+</Reference>
+<Reference URI="res%2Fui-controls.edj">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>zY+RgwVhayMhI8gOpkbxqIKV8/Sqe8uUkf/hn4wUZcQ=</DigestValue>
+</Reference>
+<Reference URI="shared%2Fres%2Ffido.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>9DwesXg1NEg1AEHfbtrY6C9YwJoypEr2v6hOyWHW6i8=</DigestValue>
+</Reference>
+<Reference URI="shared%2Fres%2Frademotv.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>1d0oEZHqPn+QzNzGIHwj9ODby6x9ggFs9uOsav6jPNs=</DigestValue>
+</Reference>
+<Reference URI="tizen-manifest.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>hf3BnDDOp8ZyVZbapG4QNDJtBWqH8Qa24aJD4/kN4dY=</DigestValue>
+</Reference>
+<Reference URI="#prop">
+<Transforms>
+<Transform Algorithm="http://www.w3.org/2006/12/xml-c14n11"></Transform>
+</Transforms>
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>u/jU3U4Zm5ihTMSjKGlGYbWzDfRkGphPPHx3gJIYEJ4=</DigestValue>
+</Reference>
+</SignedInfo>
+<SignatureValue>
+G9pc7RO8mSwrw7f796Ngr1qU37WS3jRv9g8Sm5ugLxsJ23F6D3glkBRwiDvpTMc0/y/JtzINzCgs
+ArloFO39fWP8kEKHcTkkVPXGED3D7jl3eVIYcIcgLD0iFsHFFzBHKRVIrZORmQIt9J3F6Ul8q9rQ
+IwXK4ORO1aTjOqP6lgM=
+</SignatureValue>
+<KeyInfo>
+<X509Data>
+<X509Certificate>
+MIICmzCCAgQCCQDXI7WLdVZwiTANBgkqhkiG9w0BAQUFADCBjzELMAkGA1UEBhMCS1IxDjAMBgNV
+BAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6ZW4gVGVzdCBDQTEiMCAGA1UE
+CwwZVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEkMCIGA1UEAwwbVGl6ZW4gUHVibGljIERpc3Ry
+aWJ1dG9yIENBMB4XDTEyMTAyOTEzMDMwNFoXDTIyMTAyNzEzMDMwNFowgZMxCzAJBgNVBAYTAktS
+MQ4wDAYDVQQIDAVTdXdvbjEOMAwGA1UEBwwFU3V3b24xFjAUBgNVBAoMDVRpemVuIFRlc3QgQ0Ex
+IjAgBgNVBAsMGVRpemVuIERpc3RyaWJ1dG9yIFRlc3QgQ0ExKDAmBgNVBAMMH1RpemVuIFB1Ymxp
+YyBEaXN0cmlidXRvciBTaWduZXIwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALtMvlc5hENK
+90ZdA+y66+Sy0enD1gpZDBh5T9RP0oRsptJv5jjNTseQbQi0SZOdOXb6J7iQdlBCtR343RpIEz8H
+mrBy7mSY7mgwoU4EPpp4CTSUeAuKcmvrNOngTp5Hv7Ngf02TTHOLK3hZLpGayaDviyNZB5PdqQdB
+hokKjzAzAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAvGp1gxxAIlFfhJH1efjb9BJK/rtRkbYn9+Ez
+GEbEULg1svsgnyWisFimI3uFvgI/swzr1eKVY3Sc8MQ3+Fdy3EkbDZ2+WAubhcEkorTWjzWz2fL1
+vKaYjeIsuEX6TVRUugHWudPzcEuQRLQf8ibZWjbQdBmpeQYBMg5x+xKLCJc=
+</X509Certificate>
+<X509Certificate>
+MIICtDCCAh2gAwIBAgIJAMDbehElPNKvMA0GCSqGSIb3DQEBBQUAMIGVMQswCQYDVQQGEwJLUjEO
+MAwGA1UECAwFU3V3b24xDjAMBgNVBAcMBVN1d29uMRYwFAYDVQQKDA1UaXplbiBUZXN0IENBMSMw
+IQYDVQQLDBpUVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEpMCcGA1UEAwwgVGl6ZW4gUHVibGlj
+IERpc3RyaWJ1dG9yIFJvb3QgQ0EwHhcNMTIxMDI5MTMwMjUwWhcNMjIxMDI3MTMwMjUwWjCBjzEL
+MAkGA1UEBhMCS1IxDjAMBgNVBAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6
+ZW4gVGVzdCBDQTEiMCAGA1UECwwZVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEkMCIGA1UEAwwb
+VGl6ZW4gUHVibGljIERpc3RyaWJ1dG9yIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDe
+OTS/3nXvkDEmsFCJIvRlQ3RKDcxdWJJp625pFqHdmoJBdV+x6jl1raGK2Y1sp2Gdvpjc/z92yzAp
+bE/UVLPh/tRNZPeGhzU4ejDDm7kzdr2f7Ia0U98K+OoY12ucwg7TYNItj9is7Cj4blGfuMDzd2ah
+2AgnCGlwNwV/pv+uVQIDAQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACqJ
+KO33YdoGudwanZIxMdXuxnnD9R6u72ltKk1S4zPfMJJv482CRGCI4FK6djhlsI4i0Lt1SVIJEed+
+yc3qckGm19dW+4xdlkekon7pViEBWuyHw8OWv3RXtTum1+PGHjBJ2eYY4ZKIpz73U/1NC16sTB/0
+VhfnkHwPltmrpYVe
+</X509Certificate>
+</X509Data>
+</KeyInfo>
+<Object Id="prop"><SignatureProperties xmlns:dsp="http://www.w3.org/2009/xmldsig-properties"><SignatureProperty Id="profile" Target="#DistributorSignature"><dsp:Profile URI="http://www.w3.org/ns/widgets-digsig#profile"></dsp:Profile></SignatureProperty><SignatureProperty Id="role" Target="#DistributorSignature"><dsp:Role URI="http://www.w3.org/ns/widgets-digsig#role-distributor"></dsp:Role></SignatureProperty><SignatureProperty Id="identifier" Target="#DistributorSignature"><dsp:Identifier></dsp:Identifier></SignatureProperty></SignatureProperties></Object>
+</Signature>
\ No newline at end of file
diff --git a/test/RADemoTV/.tproject b/test/RADemoTV/.tproject
new file mode 100644 (file)
index 0000000..56660b2
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<tproject xmlns="http://www.tizen.org/tproject">
+    <platforms>
+        <platform>
+            <name>mobile-3.0</name>
+        </platform>
+    </platforms>
+    <package>
+        <blacklist/>
+        <resFallback autoGen="true"/>
+    </package>
+</tproject>
diff --git a/test/RADemoTV/Instruction.txt b/test/RADemoTV/Instruction.txt
new file mode 100644 (file)
index 0000000..421e0fa
--- /dev/null
@@ -0,0 +1,188 @@
+This is a simple Demo Application for FIDO Compliant Roaming Authenticator.
+It shows single user Registration, Authentication and Deregistration for Client
+device using Authenticator Device.
+
+
+FIDO RA supports the following transport types for Peer to Peer communication:
+1) IoTivity :
+       - Meant for Tizen 3.0+ Devices.
+       - Tested on TM1.
+
+2) Bluetooth (SDP + SPP) :
+       - Meant for Tizen 2.3+ Devices.
+       - Tested on TM1, 3.0.
+
+3) Bluetooth LE (untested) :
+       - Meant for Tizen 2.3+ Devices.
+       - Untested, due to issue in 3.0 TM1 in BLE.
+
+Based on the requirement please select one of the following steps:
+
+
+================================================================================
+1) RA Over IoTivity
+================================================================================
+
+Before running,-
+please make sure that /opt/dbspace/.fido_* is deleted on both devices
+and only one type of RA agent(RA/BT/BLE) and Authenticator (PIN/Silent) is installed on the
+Authenticator Device.
+
+(A)
+[Pre-Condition]
+- Two Tizen 3.0 TM1 Devices.
+- Both should be connected to same Multicast AP.
+
+(B)
+Build fido-asm SPIN, branch devel_3.0
+
+(C)
+- Lets assume Device1 will act as server, Device2 will act as Client.
+- On Device1 install the following,-
+       - rpm -ivh fido_roaming_agent-0.0.1-1.armv7l.rpm
+       - rpm -ivh fido-asm-0.0.1-1.armv7l.rpm
+       - rpm -ivh fido_pin-0.0.1-1.armv7l.rpm
+       - org.tizen.asmui-0.0.1-1.armv7l.rpm
+               - chsmack -e System::Privileged /usr/bin/tpk-backend (this step is not needed)
+               - rpm -ivh org.tizen.asmui-0.0.1-1.armv7l.rpm
+               - tpk-backend -y org.tizen.asmui --preload
+       - sync
+       - reboot
+- On Device2 install the following,-
+       - rpm -ivh fido-client-0.0.1-1.armv7l.rpm
+       - rpm -ev --nodeps dummyasm-0.0.1-1.armv7l
+       - rpm -ivh fido-asm-0.0.1-1.armv7l.rpm
+       - sync
+       - reboot
+       - DemoApp,-
+               - Import RADemoTV into Tizen Studio IDE.
+               - Make sure Device2 is not in root mode (sdb root off).
+               - Set certificate as manasij.p12 (password: manasij)
+               - Build for armv7l and run.
+               - For first run,-
+                       - It will show "No Previous Registration".
+                       - Click on "Register New User".
+                       - Enter any user name and click ok.
+                       - It will start Roaming Registration Flow.
+                       - On Device1, "Setup New PIN" UI will appear, enter any 4 digit PIN and click on save.
+                       - Device2 will show "Registered Successfully".
+               - Exit the app, from the next time,-
+                       - The app will show Username in the Title Bar.
+                       - Click on Authenticate, it will start the Authentication Flow.
+                       - On Device1, "Verify PIN" UI will appear, enter the PIN saved during Registration.
+                       - Device2 will show "Authenticated Successfully".
+                       - You can also deregister, which deleted the key in remote and local devices.
+
+
+================================================================================
+2) RA Over Bluetooth
+================================================================================
+
+Before running,-
+please make sure that /opt/dbspace/.fido_* is deleted on both devices
+and only one type of RA agent(RA/BT/BLE) and Authenticator (PIN/Silent) is installed on the
+Authenticator Device.
+
+(A)
+[Pre-Condition]
+- Two Tizen 3.0 TM1 Devices.
+- Both devices must be paired via BT (Settings->Bluetooth->Scan->Pair).
+To enforce additional security, RA intentionally allows only pre-paired devices.
+
+(B)
+Build fido-asm SPIN, branch devel_3.0
+
+(C)
+- Lets assume Device1 will act as server, Device2 will act as Client.
+- On Device1 install the following,-
+       - rpm -ivh fido_bt_roaming_agent-0.0.1-1.armv7l.rpm
+       - rpm -ivh fido-asm-0.0.1-1.armv7l.rpm
+       - rpm -ivh fido_pin-0.0.1-1.armv7l.rpm
+       - org.tizen.asmui-0.0.1-1.armv7l.rpm
+               - chsmack -e System::Privileged /usr/bin/tpk-backend (this step is not needed)
+               - rpm -ivh org.tizen.asmui-0.0.1-1.armv7l.rpm
+               - tpk-backend -y org.tizen.asmui --preload
+       - sync
+       - reboot
+- On Device2 install the following,-
+       - rpm -ivh fido-client-0.0.1-1.armv7l.rpm
+       - rpm -ev --nodeps dummyasm-0.0.1-1.armv7l
+       - rpm -ivh fido-asm-0.0.1-1.armv7l.rpm
+       - sync
+       - reboot
+       - DemoApp,-
+               - Import RADemoTV into Tizen Studio IDE.
+               - Make sure Device2 is not in root mode (sdb root off).
+               - Set certificate as manasij.p12 (password: manasij)
+               - Build for armv7l and run.
+               - If the server/client devices show BT message popup during the test, please accept.
+               - For first run,-
+                       - It will show "No Previous Registration".
+                       - Click on "Register New User".
+                       - Enter any user name and click ok.
+                       - It will start Roaming Registration Flow.
+                       - On Device1, "Setup New PIN" UI will appear, enter any 4 digit PIN and click on save.
+                       - Device2 will show "Registered Successfully".
+               - Exit the app, from the next time,-
+                       - The app will show Username in the Title Bar.
+                       - Click on Authenticate, it will start the Authentication Flow.
+                       - On Device1, "Verify PIN" UI will appear, enter the PIN saved during Registration.
+                       - Device2 will show "Authenticated Successfully".
+                       - You can also deregister, which deleted the key in remote and local devices.
+
+
+================================================================================
+3) RA Over BLE (Untested, Disabled)
+================================================================================
+
+Before running,-
+please make sure that /opt/dbspace/.fido_* is deleted on both devices
+and only one type of RA agent(RA/BT/BLE) and Authenticator (PIN/Silent) is installed on the
+Authenticator Device.
+
+(A)
+[Pre-Condition]
+- Two Tizen 3.0 TM1 Devices.
+- Both devices must be paired via BT (Settings->Bluetooth->Scan->Pair).
+To enforce additional security, RA intentionally allows only pre-paired devices.
+
+(B)
+Build fido-asm SPIN, branch devel_3.0
+
+(C)
+- Lets assume Device1 will act as server, Device2 will act as Client.
+- On Device1 install the following,-
+       - rpm -ivh fido_ble_roaming_agent-0.0.1-1.armv7l.rpm
+       - rpm -ivh fido-asm-0.0.1-1.armv7l.rpm
+       - rpm -ivh fido_pin-0.0.1-1.armv7l.rpm
+       - org.tizen.asmui-0.0.1-1.armv7l.rpm
+               - chsmack -e System::Privileged /usr/bin/tpk-backend (this step is not needed)
+               - rpm -ivh org.tizen.asmui-0.0.1-1.armv7l.rpm
+               - tpk-backend -y org.tizen.asmui --preload
+       - sync
+       - reboot
+- On Device2 install the following,-
+       - rpm -ivh fido-client-0.0.1-1.armv7l.rpm
+       - rpm -ev --nodeps dummyasm-0.0.1-1.armv7l
+       - rpm -ivh fido-asm-0.0.1-1.armv7l.rpm
+       - sync
+       - reboot
+       - DemoApp,-
+               - Import RADemoTV into Tizen Studio IDE.
+               - Make sure Device2 is not in root mode (sdb root off).
+               - Set certificate as manasij.p12 (password: manasij)
+               - Build for armv7l and run.
+               - If the server/client devices show BT message popup during the test, please accept.
+               - For first run,-
+                       - It will show "No Previous Registration".
+                       - Click on "Register New User".
+                       - Enter any user name and click ok.
+                       - It will start Roaming Registration Flow.
+                       - On Device1, "Setup New PIN" UI will appear, enter any 4 digit PIN and click on save.
+                       - Device2 will show "Registered Successfully".
+               - Exit the app, from the next time,-
+                       - The app will show Username in the Title Bar.
+                       - Click on Authenticate, it will start the Authentication Flow.
+                       - On Device1, "Verify PIN" UI will appear, enter the PIN saved during Registration.
+                       - Device2 will show "Authenticated Successfully".
+                       - You can also deregister, which deleted the key in remote and local devices.
diff --git a/test/RADemoTV/accessibility/screen_reader/custom_frame.edc b/test/RADemoTV/accessibility/screen_reader/custom_frame.edc
new file mode 100644 (file)
index 0000000..c520bda
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "custom_frame_layout";
+   parts {
+      part { name: "bg";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            visible: 1;
+            color: BG_DEFAULT_COLOR_INC;
+         }
+      }
+      part { name: "button_name_lbl";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.0 0.05;
+               to: "bg";
+            }
+            rel2 {
+               relative: 1.0 0.1;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_name";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.3 0.1;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.7 0.2;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_custom_frame_lbl";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.0 0.3;
+               to: "bg";
+            }
+            rel2 {
+               relative: 1.0 0.35;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+      part { name: "button_custom_frame";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.2 0.35;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.8 0.45;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+      part { name: "button_custom_frame_lbl2";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.1 0.55;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.9 0.6;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+      part { name: "button_custom_frame2";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.2 0.6;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.8 0.8;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+   }//end parts
+} //end group
+
diff --git a/test/RADemoTV/accessibility/screen_reader/description.edc b/test/RADemoTV/accessibility/screen_reader/description.edc
new file mode 100644 (file)
index 0000000..4b7ed54
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "description_layout";
+   parts {
+      part { name: "bg";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            visible: 1;
+            color: 200 200 200 255;
+         }
+      }
+      part { name: "button_name_lbl";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.0 0.05;
+               to: "bg";
+            }
+            rel2 {
+               relative: 1.0 0.1;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_name";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.3 0.1;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.7 0.2;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_description_lbl";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.0 0.3;
+               to: "bg";
+            }
+            rel2 {
+               relative: 1.0 0.35;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+      part { name: "button_description";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.3 0.35;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.7 0.45;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+      part { name: "button_a11y_name_lbl";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.1 0.55;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.9 0.6;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+      part { name: "button_a11y_name";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.3 0.6;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.7 0.7;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+      part { name: "button_empty_lbl";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.1 0.8;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.9 0.85;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+      part { name: "button_empty";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.4 0.85;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.6 0.95;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+   }//end parts
+} //end group
diff --git a/test/RADemoTV/accessibility/screen_reader/reading_order.edc b/test/RADemoTV/accessibility/screen_reader/reading_order.edc
new file mode 100644 (file)
index 0000000..b706dea
--- /dev/null
@@ -0,0 +1,382 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "reading_order_layout";
+
+   images.image: "../res/images/arrow-right.png" COMP;
+   images.image: "../res/images/arrow-left.png" COMP;
+   images.image: "../res/images/arrow-left1.png" COMP;
+   images.image: "../res/images/arrow-up.png" COMP;
+   images.image: "../res/images/arrow-down.png" COMP;
+
+   parts {
+      part { name: "bg";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            visible: 1;
+            color: 200 200 200 255;
+            rel1 {
+               relative: 0.0 0.0;
+            }
+            rel2 {
+               relative: 1.0 1.0;
+            }
+         }
+      }
+      part { name: "bg_custom";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            visible: 1;
+            color: 89 205 255 255;
+            rel1 {
+               relative: 0.0 0.0;
+            }
+            rel2 {
+               relative: 1.0 0.5;
+            }
+         }
+      }
+      part { name: "bg_default";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            visible: 1;
+            color: 89 255 142 255;
+            rel1 {
+               relative: 0.0 0.5;
+            }
+            rel2 {
+               relative: 1.0 1.0;
+            }
+         }
+      }
+      part { name: "custom_lbl";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.05 0.05;
+               to: "bg";
+            }
+            rel2 {
+               relative: 1.0 0.15;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "default_lbl";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.05 0.55;
+               to: "bg";
+            }
+            rel2 {
+               relative: 1.0 0.65;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_a";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.1 0.15;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.3 0.25;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_b";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.4 0.15;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.6 0.25;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_c";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.7 0.15;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.9 0.25;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_d";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.1 0.3;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.3 0.4;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_e";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.4 0.3;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.6 0.4;
+               to: "bg";
+            }
+         }
+      }
+
+
+
+      part { name: "button_default_a";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.1 0.65;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.3 0.75;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_default_b";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.4 0.65;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.6 0.75;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_default_c";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.7 0.65;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.9 0.75;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_default_d";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.1 0.8;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.3 0.9;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_default_e";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.4 0.8;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.6 0.9;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "arrow_custom_label_d";
+          description {
+             state: "default" 0.0;
+             image.normal: "../res/images/arrow-down.png";
+             rel1 {
+               relative: 0.0 0.4;
+               to: "custom_lbl";
+             }
+             rel2 {
+                relative: 0.0 0.0;
+               to: "button_d";
+             }
+          }
+      }
+      part { name: "arrow_custom_b_c";
+          description {
+             state: "default" 0.0;
+             image.normal: "../res/images/arrow-right.png";
+             rel1 {
+                relative: 1.05 0.3;
+                to: "button_b";
+             }
+             rel2 {
+                relative: -0.05 0.7;
+              to: "button_c";
+             }
+          }
+      }
+      part { name: "arrow_custom_d_e";
+          description {
+             state: "default" 0.0;
+             image.normal: "../res/images/arrow-right.png";
+             rel1 {
+                relative: 1.05 0.3;
+                to: "button_d";
+             }
+             rel2 {
+                relative: -0.05 0.7;
+              to: "button_e";
+             }
+          }
+      }
+      part { name: "arrow_custom_e_b";
+          description {
+             state: "default" 0.0;
+             image.normal: "../res/images/arrow-up.png";
+             rel1 {
+                relative: 0.35 1.05;
+                to: "button_b";
+             }
+             rel2 {
+                relative: 0.65 -0.05;
+              to: "button_e";
+             }
+          }
+      }
+
+
+      part { name: "arrow_default_a_b";
+          description {
+             state: "default" 0.0;
+             image.normal: "../res/images/arrow-right.png";
+             rel1 {
+                relative: 1.05 0.3;
+                to: "button_default_a";
+             }
+             rel2 {
+                relative: -0.05 0.7;
+              to: "button_default_b";
+             }
+          }
+      }
+      part { name: "arrow_default_b_c";
+          description {
+             state: "default" 0.0;
+             image.normal: "../res/images/arrow-right.png";
+             rel1 {
+                relative: 1.05 0.3;
+                to: "button_default_b";
+             }
+             rel2 {
+                relative: -0.05 0.7;
+              to: "button_default_c";
+             }
+          }
+      }
+
+      part { name: "arrow_default_d_e";
+          description {
+             state: "default" 0.0;
+             image.normal: "../res/images/arrow-right.png";
+             rel1 {
+                relative: 1.05 0.3;
+                to: "button_default_d";
+             }
+             rel2 {
+                relative: -0.05 0.7;
+              to: "button_default_e";
+             }
+          }
+      }
+
+      part { name: "arrow_default_c_d";
+          description {
+             state: "default" 0.0;
+             image.normal: "../res/images/arrow-left1.png";
+             rel1 {
+                relative: 0.5 -0.5;
+                to: "button_default_d";
+             }
+             rel2 {
+                relative: 0.5 1.5;
+              to: "button_default_c";
+             }
+          }
+      }
+
+   }//end parts
+} //end group
diff --git a/test/RADemoTV/button.edc b/test/RADemoTV/button.edc
new file mode 100644 (file)
index 0000000..a8094c8
--- /dev/null
@@ -0,0 +1,347 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+#define BUTTON_PADDING_WIDTH 170
+#define BUTTON_PADDING_HEIGHT 22
+
+group { name: "button_layout";
+   parts {
+      part { name: "top_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 0 1;
+            rel2.relative: 1.0 0.0;
+            align: 0 0;
+         }
+      }
+      part { name: "btn_expand_opened";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "top_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "top_padding";
+            }
+         }
+      }
+      part { name: "btn_expand_opened_bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_expand_opened";
+            }
+            rel2.to_y: "btn_expand_opened";
+         }
+      }
+      part { name: "btn_expand_closed";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_expand_opened_bottom_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_expand_opened_bottom_padding";
+            }
+         }
+      }
+      part { name: "btn_expand_closed_bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0 1.0;
+               to_y: "btn_expand_closed";
+            }
+            rel2.to_y: "btn_expand_closed";
+         }
+      }
+      part { name: "btn_reorder";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_expand_closed_bottom_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_expand_closed_bottom_padding";
+            }
+         }
+      }
+      part { name: "btn_reorder_bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_reorder";
+            }
+            rel2.to_y: "btn_reorder";
+         }
+      }
+      part { name: "btn_expand_add";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_reorder_bottom_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_reorder_bottom_padding";
+            }
+         }
+      }
+      part { name: "btn_expand_add_bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_expand_add";
+            }
+            rel2.to_y: "btn_expand_add";
+         }
+      }
+      part { name: "btn_expand_delete";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_expand_add_bottom_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_expand_add_bottom_padding";
+            }
+         }
+      }
+      part { name: "btn_expand_delete_bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_expand_delete";
+            }
+            rel2.to_y: "btn_expand_delete";
+         }
+      }
+      part { name: "btn_default";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_expand_delete_bottom_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_expand_delete_bottom_padding";
+            }
+         }
+      }
+      part { name: "btn_default_bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_default";
+            }
+            rel2.to_y: "btn_default";
+         }
+      }
+      part { name: "btn_circle";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_default_bottom_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_default_bottom_padding";
+            }
+         }
+      }
+      part { name: "btn_circle_bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_circle";
+            }
+            rel2.to_y: "btn_circle";
+         }
+      }
+      part { name: "btn_bottom";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            state: "default" 0.0;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_circle_bottom_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_circle_bottom_padding";
+            }
+         }
+      }
+      part { name: "btn_bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_bottom";
+            }
+            rel2.to_y: "btn_bottom";
+         }
+      }
+      part { name: "btn_circle_text";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            state: "default" 0.0;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_bottom_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_bottom_padding";
+            }
+         }
+      }
+      part { name: "btn_circle_text_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_circle_text";
+            }
+            rel2.to_y: "btn_circle_text";
+         }
+      }
+      part { name: "btn_contacts";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            state: "default" 0.0;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_circle_text_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_circle_text_padding";
+            }
+         }
+      }
+      part { name: "bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 BUTTON_PADDING_HEIGHT;
+            align: 0.5 1.0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_contacts";
+            }
+         }
+      }
+   }
+}
+
+#undef BUTTON_PADDING_WIDTH
+#undef BUTTON_PADDING_HEIGHT
diff --git a/test/RADemoTV/datetime.edc b/test/RADemoTV/datetime.edc
new file mode 100644 (file)
index 0000000..231ab79
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+#define DATETIME_PADDING_HEIGHT 50
+#define DATETIME_TOP_PADDING_HEIGHT 30
+#define DATETIME_PICKER_PADDING_HEIGHT 100
+#define DATETIME_BUTTON_WIDTH 550
+#define DATETIME_TEXT_HEIGHT 60
+#define DATETIME_TEXT_COLOR 173 170 165 255
+#define DATETIME_TEXT_SIZE 24
+
+#define DATETIME_PICKER(_pos, _after, str)\
+   part { name: "picker"#_pos;\
+      type: SWALLOW;\
+      scale: 1;\
+      description { state: "default" 0.0;\
+         align: 0.5 0.0;\
+         fixed: 1 1;\
+         rel1 {\
+            relative: 0 1;\
+            to: "text"#_pos;\
+         }\
+         rel2 {\
+            relative: 1 1;\
+            to: "text"#_pos;\
+         }\
+      }\
+   }\
+   part { name: "text"#_pos;\
+      type: TEXT;\
+      scale: 1;\
+      description { state: "default" 0.0;\
+         align: 0.5 0.0;\
+         fixed: 0 1;\
+         min: 0 DATETIME_PADDING_HEIGHT;\
+         rel1 {\
+            relative: 0 1;\
+            to: "padding"#_after;\
+         }\
+         rel2 {\
+            relative: 1 1;\
+            to: "padding"#_after;\
+         }\
+         color: DATETIME_TEXT_COLOR;\
+         text {\
+            font: "Tizen:style=Regular";\
+            size: DATETIME_TEXT_SIZE;\
+            min:  1 0;\
+            align: 0.0 0.0;\
+            text: str;\
+            ellipsis: -1; \
+         }\
+      }\
+   }\
+   part { name: "padding"#_pos;\
+      type: SPACER;\
+      scale: 1;\
+      description { state: "default" 0.0;\
+         min: 0 DATETIME_PADDING_HEIGHT;\
+         fixed: 0 1;\
+         align: 0.5 0.0;\
+         rel1 {\
+            relative: 0.0 1.0;\
+            to_x: "padding"#_after;\
+            to_y: "picker"#_pos;\
+         }\
+         rel2 {\
+            relative: 1.0 1.0;\
+            to_x: "padding"#_after;\
+            to_y: "picker"#_pos;\
+         }\
+      }\
+   }
+
+group { name: "datetime_layout";
+   parts {
+      part { name: "padding0";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 DATETIME_TOP_PADDING_HEIGHT;
+            fixed: 0 1;
+            align: 0.5 0.0;
+            rel1.relative: 0 0;
+            rel2.relative: 1 0;
+         }
+      }
+      DATETIME_PICKER(1, 0, " Date Time (12hr) :")
+      DATETIME_PICKER(2, 1, " Date Time (24hr) :")
+      DATETIME_PICKER(3, 2, " Time Date (12hr) :")
+      DATETIME_PICKER(4, 3, " Time Date (24hr) :")
+      DATETIME_PICKER(5, 4, " User format changed as per System's Region format :")
+      DATETIME_PICKER(6, 5, " Datetime widget with field limits :")
+      part { name: "bottom.padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 DATETIME_TOP_PADDING_HEIGHT;
+            align: 0.5 1.0;
+            rel1 {
+               to: "padding6";
+               relative: 0 1;
+            }
+         }
+      }
+   }
+}
+
+#undef DATETIME_PICKER
+#undef DATETIME_PADDING_HEIGHT
+#undef DATETIME_PICKER_PADDING_HEIGHT
+#undef DATETIME_BUTTON_WIDTH
+#undef DATETIME_TOP_PADDING_HEIGHT
+#undef DATETIME_TEXT_HEIGHT
+#undef DATETIME_TEXT_COLOR
+#undef DATETIME_TEXT_SIZE
diff --git a/test/RADemoTV/default/inc/my_button_header.edc b/test/RADemoTV/default/inc/my_button_header.edc
new file mode 100644 (file)
index 0000000..7e3001e
--- /dev/null
@@ -0,0 +1,61 @@
+#define BASE_SCALE_INC 2.6
+#define SMALL "HD/"
+#define MEDIUM "HD/"
+#define DEFAULT_IMAGE "HD/"
+
+#define BG_DEFAULT_COLOR_INC 248 246 239 255
+#define BG_EDIT_MODE_COLOR_INC 248 246 239 255
+#define BG_GROUP_LIST_COLOR_INC 248 246 239 255
+#define BG_TRANSPARENT_COLOR_INC 0 0 0 0
+#define BORDER_BG_COLOR_INC 248 246 239 255
+#define BORDER_FONT_COLOR_INC 59 115 182 255
+#define BORDER_FONT_SIZE_INC 42
+#define BORDER_HEIGHT_INC 80
+#define BORDER_ICON_PADDING_WIDTH 8
+#define BORDER_ICON_SIZE 36 36
+#define BORDER_PADDING_WIDTH 20
+#define BORDER_SHADOW_HEIGHT 20
+#define BORDER_TITLE_FONT_SIZE_INC 12
+#define BORDER_TITLE_HEIGHT_INC 22
+
+#define BUTTON_ANCHOR_BG_BORDER 20 20 22 22
+#define BUTTON_ANCHOR_COLOR_TRANSPARENT 0 0 0 0
+#define BUTTON_ANCHOR_PADDING_DEFAULT_SIZE 10
+#define BUTTON_ICON_DEFAULT_HEIGHT_INC 60
+#define BUTTON_ICON_DEFAULT_WIDTH_INC 60
+#define BUTTON_MIN_HEIGHT_INC 78
+#define BUTTON_MIN_WIDTH_INC 50
+#define BUTTON_PADDING_BOTTOM_HEIGHT_INC 14
+#define BUTTON_PADDING_ICON_RIGHT_INC 14
+#define BUTTON_PADDING_LEFT_ICON_TEXT_INC 56
+#define BUTTON_PADDING_LEFT_RIGHT_INC 32
+#define BUTTON_PADDING_TOP_HEIGHT_INC 10
+#define BUTTON_TEXT_SHADOW_NORMAL_COLOR_INC 255 255 255 255
+#define BUTTON_TEXT_STYLE1_FONT_SIZE_INC 36
+#define BUTTON_TEXT_STYLE1_NORMAL_COLOR_INC 58 58 58 255
+#define BUTTON_TEXT_STYLE1_VISIBLE_BG_MIN_INC 148 74
+
+#define STYLE_TAGS \
+   tag:  "br" "\n";\
+   tag:  "ps" "ps";\
+   tag:  "tab" "\t";\
+   tag:  "b" "+ font_weight=Bold";
+
+#define STYLE_TAG_MATCH \
+   tag:  "match" "+ color=#3db8cc";
+
+styles {
+   // ************* button text ********** //
+   style { name: "button_main";
+      base: "align=center valign=center color=#fafafaff font=Tizen:style=Regular font_size=30 text_class=tizen ellipsis=1.0";
+      STYLE_TAGS
+   }
+   style { name: "button_main_dim";
+      base: "align=center valign=center color=#fafafaa3 font=Tizen:style=Regular font_size=30 text_class=tizen ellipsis=1.0";
+      STYLE_TAGS
+   }
+   style { name: "button_main_press";
+      base: "align=center valign=center color=#fafafaff font=Tizen:style=Regular font_size=30 text_class=tizen ellipsis=1.0";
+      STYLE_TAGS
+   }
+}
diff --git a/test/RADemoTV/default/my_button.edc b/test/RADemoTV/default/my_button.edc
new file mode 100644 (file)
index 0000000..b69b2b8
--- /dev/null
@@ -0,0 +1,709 @@
+group { name: "elm/button/base/custom1";
+   data {
+      item: "access_highlight" "on";
+   }
+   images {
+      image: "../res/images/btn_style_nor.png" COMP;
+      image: "../res/images/btn_style_sel.png" COMP;
+      image: "../res/images/custom_highlight.png" COMP;
+   }
+   parts {
+      part { name: "button_image";
+         mouse_events: 1;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            min: BUTTON_TEXT_STYLE1_VISIBLE_BG_MIN_INC;
+            visible: 0;
+            image {
+               normal: "../res/images/btn_style_nor.png";
+               border: BUTTON_ANCHOR_BG_BORDER;
+               middle: SOLID;
+            }
+         }
+         description { state: "visible" 0.0;
+            visible: 1;
+            min: BUTTON_TEXT_STYLE1_VISIBLE_BG_MIN_INC;
+            color_class: "W012";
+            image {
+               normal: "../res/images/btn_style_nor.png";
+               border: BUTTON_ANCHOR_BG_BORDER;
+               border_scale: 1;
+            }
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         description { state: "default" 0.0;
+            fixed: 1 0;
+            visible: 0;
+            align: 0.0 0.5;
+            rel2.relative: 0.0 1.0;
+         }
+         description { state: "visible" 0.0;
+            inherit: "default" 0.0;
+            fixed: 1 0;
+            visible: 1;
+            aspect: 1.0 1.0;
+            aspect_preference: VERTICAL;
+         }
+         description { state: "icononly" 0.0;
+            inherit: "default" 0.0;
+            fixed: 0 0;
+            visible: 1;
+            align: 0.5 0.5;
+            aspect: 1.0 1.0;
+            rel2.relative: 1.0 1.0;
+            aspect_preference: VERTICAL;
+         }
+      }
+      part { name: "elm.padding.text.left";
+         type: SPACER;
+         scale: 1;
+         mouse_events: 0;
+         description {  state: "default" 0.0;
+            align: 0 0.5;
+            fixed: 1 0;
+            min: BUTTON_ANCHOR_PADDING_DEFAULT_SIZE 0;
+            rel1 {
+               to: "elm.swallow.content";
+               relative: 1 0;
+            }
+            rel2 {
+               to: "elm.swallow.content";
+               relative: 1 1;
+            }
+         }
+      }
+      part { name: "elm.padding.text.right";
+         type: SPACER;
+         scale: 1;
+         mouse_events: 0;
+         description {  state: "default" 0.0;
+            align: 1 0.5;
+            rel1.relative: 1 0;
+            fixed: 1 0;
+            min: BUTTON_ANCHOR_PADDING_DEFAULT_SIZE 10;
+         }
+      }
+      part { name: "elm.text";
+         type: TEXT;
+         mouse_events:  0;
+         scale: 1;
+         effect: SHADOW BOTTOM;
+         description { state: "default" 0.0;
+            rel1 {
+               to_x: "elm.padding.text.left";
+               relative: 1 0;
+            }
+            rel2 {
+               to : "elm.padding.text.right";
+               relative: 0 1;
+            }
+            color: BUTTON_TEXT_STYLE1_NORMAL_COLOR_INC;
+            color2: BUTTON_TEXT_SHADOW_NORMAL_COLOR_INC;
+            text {
+               font: "SLP:style=Regular";
+               size: BUTTON_TEXT_STYLE1_FONT_SIZE_INC;
+               min: 0 0;
+               text_class: "slp";
+            }
+         }
+      }
+      part { name: "over";
+         type: RECT;
+         mouse_events: 1;
+         repeat_events: 1;
+         description { state: "default" 0.0;
+            color: BUTTON_ANCHOR_COLOR_TRANSPARENT;
+         }
+      }
+      part { name: "disabler";
+         type: RECT;
+         description { state: "default" 0.0;
+            color: BUTTON_ANCHOR_COLOR_TRANSPARENT;
+            visible: 0;
+         }
+         description { state: "disabled" 0.0;
+            inherit: "default" 0.0;
+            visible: 1;
+         }
+      }
+      part { name: "highlight_base"; type: RECT;
+         clip_to: "highlight_clip";
+         description { state: "default" 0.0;
+            visible: 0;
+         }
+      }
+      part { name: "highlight_clip"; type: RECT;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 255;
+            rel1.relative: -1 -1;
+            rel2.relative: 2 2;
+         }
+      }
+
+      part { name: "highlight";
+         clip_to: "highlight_clip";
+         description { state: "default" 0.0;
+            image.normal: "../res/images/custom_highlight.png";
+            image.border: 12 12 12 12;
+            image.middle: 0;
+            fill.smooth: 0;
+            rel1.to: "highlight_base";
+            rel1.offset: -7 -7;
+            rel2.to: "highlight_base";
+            rel2.offset: 5 5;
+            visible: 0;
+         }
+         description { state: "visible" 0.0;
+            inherit: "default" 0.0;
+            visible: 1;
+         }
+      }
+   }
+
+
+   programs {
+      program { name: "button_mouse_in";
+         signal: "mouse,in";
+         source: "over";
+         action: STATE_SET "visible" 0.0;
+         target: "button_image";
+         target: "elm.text";
+      }
+      program { name: "button_mouse_out";
+         signal: "mouse,out";
+         source: "over";
+         action: STATE_SET "default" 0.0;
+         target: "button_image";
+         target: "elm.text";
+      }
+      program { name: "button_unclick";
+         signal: "mouse,up,1";
+         source: "over";
+         action: STATE_SET "visible" 0.0;
+         target: "button_image";
+         target: "elm.text";
+      }
+      program { name: "button_click2";
+         signal: "mouse,down,1";
+         source: "over";
+         action: STATE_SET "clicked" 0.0;
+         target: "button_image";
+         target: "elm.text";
+      }
+      program { name: "button_unclick2";
+         signal: "mouse,up,1";
+         source: "over";
+         action: STATE_SET "default" 0.0;
+         transition: DECELERATE 0.5;
+         target: "button_image";
+         target: "elm.text";
+      }
+      program { name: "button_unclick3";
+         signal: "mouse,up,1";
+         source: "over";
+         action: SIGNAL_EMIT "elm,action,click" "";
+      }
+      program { name: "text_show";
+         signal: "elm,state,text,visible";
+         source: "elm";
+         script {
+            new st[31];
+            new Float:vl;
+            get_state(PART:"elm.swallow.content", st, 30, vl);
+            if (!strcmp(st, "icononly")) {
+               set_state(PART:"elm.swallow.content", "visible", 0.0);
+            }
+            get_state(PART:"elm.text", st, 30, vl);
+            if (!strcmp(st, "disabled") || (!strcmp(st, "disabled_visible")))
+              set_state(PART:"elm.text", "disabled_visible", 0.0);
+            else
+              set_state(PART:"elm.text", "visible", 0.0);
+         }
+      }
+      program { name: "icon_show";
+         signal: "elm,state,icon,visible";
+         source: "elm";
+         script {
+            new st[31];
+            new Float:vl;
+            get_state(PART:"elm.text", st, 30, vl);
+            if (!strcmp(st, "visible")) {
+               set_state(PART:"elm.swallow.content", "visible", 0.0);
+            }
+            else {
+               set_state(PART:"elm.swallow.content", "icononly", 0.0);
+            }
+         }
+      }
+      program { name: "enable";
+         signal: "elm,state,enabled";
+         source: "elm";
+         script {
+            new st[31];
+            new Float:vl;
+            set_state(PART:"button_image", "visible", 0.0);
+            set_state(PART:"over", "visible", 0.0);
+            set_state(PART:"disabler", "visible", 0.0);
+            get_state(PART:"elm.text", st, 30, vl);
+            if (!strcmp(st, "visible") || !strcmp(st, "disabled_visible"))
+              set_state(PART:"elm.text", "visible", 0.0);
+            else
+              set_state(PART:"elm.text", "default", 0.0);
+         }
+      }
+      program { name: "show_new_highlight";
+         signal: "elm,action,access_highlight,show";
+         source: "elm";
+         action: STATE_SET "visible" 0.0;
+         target: "highlight";
+      }
+      program { name: "hide_new_highlight";
+         signal: "elm,action,access_highlight,hide";
+         source: "elm";
+         action: STATE_SET "default" 0.0;
+         target: "highlight";
+      }
+   }
+
+}
+
+group { name: "elm/button/base/custom2";
+   data.item: "vector_ux" "default";
+   data.item: "access_highlight" "on";
+   images.image: "../res/images/custom_highlight2.png" COMP;
+   script {
+      public mouse_down = 0;
+      public multi_down = 0;
+      public disabled = 0;
+      public text = 0;
+      public content = 0;
+   }
+   parts {
+      part { name: "base";
+         scale: 1;
+         type: SPACER;
+         description { state: "default" 0.0;
+            min: BUTTON_MIN_WIDTH_INC BUTTON_MIN_HEIGHT_INC;
+         }
+      }
+      //Base Shape Part
+      part { name: "tizen_vg_shape";
+         type: SWALLOW;
+         clip_to: "tizen_vg_shape_clipper";
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 BUTTON_MIN_HEIGHT_INC;
+            rel1.relative: 0 0.5;
+            rel2.relative: 1 0.5;
+            fixed: 0 1;
+         }
+      }
+      part { name: "tizen_vg_shape_clipper";
+         type: RECT;
+         description { state: "default" 0.0;
+            color: 82 198 216 255;
+         }
+         description { state: "disabled" 0.0;
+            color: 138 195 204 255;
+         }
+      }
+      //Effect Shape Part
+      part { name: "tizen_vg_shape2";
+         type: SWALLOW;
+         clip_to: "tizen_vg_shape_clipper2";
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.to: "tizen_vg_shape";
+            rel2.to: "tizen_vg_shape";
+            rel1.relative: 0.15 0.15;
+            rel2.relative: 0.85 0.85;
+         }
+         description { state: "ready" 0.0;
+            inherit: "default" 0.0;
+         }
+         description { state: "pressed" 0.0;
+            inherit: "default" 0.0;
+            rel1.relative: 0.0 0.0;
+            rel2.relative: 1.0 1.0;
+         }
+      }
+      part { name: "tizen_vg_shape_clipper2";
+         type: RECT;
+         description { state: "default" 0.0;
+            visible: 0;
+            color: 48 139 153 0;
+         }
+         description { state: "ready" 0.0;
+            inherit: "default" 0.0;
+            visible: 1;
+         }
+         description { state: "pressed" 0.0;
+            color: 48 139 153 255;
+         }
+      }
+      part { name: "padding_left_top";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.to: "tizen_vg_shape";
+            rel2.to: "tizen_vg_shape";
+            align: 0.0 0.0;
+            rel2.relative: 0.0 0.0;
+            min: BUTTON_PADDING_LEFT_RIGHT_INC BUTTON_PADDING_TOP_HEIGHT_INC;
+            fixed: 1 1;
+         }
+         description { state: "icon_only" 0.0;
+            inherit: "default" 0.0;
+            min: 0 0;
+         }
+         description { state: "icon_text" 0.0;
+            inherit: "default" 0.0;
+            min: BUTTON_PADDING_LEFT_ICON_TEXT_INC BUTTON_PADDING_TOP_HEIGHT_INC;
+         }
+      }
+      part { name: "padding_right_bottom";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.to: "tizen_vg_shape";
+            rel2.to: "tizen_vg_shape";
+            align: 1.0 1.0;
+            rel1.relative: 1.0 1.0;
+            min: BUTTON_PADDING_LEFT_RIGHT_INC BUTTON_PADDING_BOTTOM_HEIGHT_INC;
+            fixed: 1 1;
+         }
+         description { state: "icon_only" 0.0;
+            inherit: "default" 0.0;
+            min: 0 0;
+         }
+      }
+      part { name: "icon_rect";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.0;
+            rel1 {
+               relative: 1.0 1.0;
+               to: "padding_left_top";
+            }
+            rel2 {
+               relative: 1.0 1.0;
+               to: "padding_left_top";
+            }
+            min: 0 BUTTON_ICON_DEFAULT_HEIGHT_INC;
+            fixed: 1 1;
+         }
+         description { state: "visible" 0.0;
+            inherit: "default" 0.0;
+            min: BUTTON_ICON_DEFAULT_WIDTH_INC BUTTON_ICON_DEFAULT_HEIGHT_INC;
+            fixed: 1 1;
+         }
+         description { state: "icon_only" 0.0;
+            rel1.to: "tizen_vg_shape";
+            rel2.to: "tizen_vg_shape";
+            min: BUTTON_ICON_DEFAULT_WIDTH_INC BUTTON_ICON_DEFAULT_HEIGHT_INC;
+            max: BUTTON_ICON_DEFAULT_WIDTH_INC BUTTON_ICON_DEFAULT_HEIGHT_INC;
+            align: 0.5 0.5;
+            fixed: 1 1;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         clip_to: "clipper";
+         description { state: "default" 0.0;
+            rel1.to: "icon_rect";
+            rel2.to: "icon_rect";
+         }
+      }
+      part { name: "icon_text_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.5;
+            min: 0 0;
+            rel1 {
+               relative: 1.0 0.0;
+               to: "icon_rect";
+            }
+            rel2 {
+               relative: 1.0 1.0;
+               to: "icon_rect";
+            }
+            fixed: 1 1;
+         }
+         description { state: "visible" 0.0;
+            inherit: "default" 0.0;
+            min: BUTTON_PADDING_ICON_RIGHT_INC 0;
+         }
+      }
+      part { name: "elm.text";
+         type: TEXTBLOCK;
+         mouse_events: 0;
+         scale: 1;
+         clip_to: "clipper";
+         description { state: "default" 0.0;
+            rel1 {
+               relative: 1.0 0.0;
+               to: "icon_text_padding";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to: "padding_right_bottom";
+            }
+            text {
+               style: "button_main";
+            }
+         }
+         description { state: "pressed" 0.0;
+            inherit: "default" 0.0;
+            text.style: "button_main_press";
+         }
+         description { state: "disabled" 0.0;
+            inherit: "default" 0.0;
+            text.style: "button_main_dim";
+         }
+      }
+      part { name: "clipper";
+         type: RECT;
+         description { state: "default" 0.0;
+         }
+         description { state: "pressed" 0.0;
+         }
+         description { state: "disabled" 0.0;
+            inherit: "default" 0.0;
+            color: 255 255 255 163;
+         }
+      }
+      part { name: "event";
+         type: RECT;
+         ignore_flags: ON_HOLD;
+         description { state: "default" 0.0;
+            rel1.to: "tizen_vg_shape";
+            rel2.to: "tizen_vg_shape";
+            color: 0 0 0 0;
+         }
+      }
+      part { name: "highlight_clip"; type: RECT;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 1.0 0.0;
+               to: "icon_text_padding";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to: "padding_right_bottom";
+            }
+         }
+      }
+      part { name: "highlight_base"; type: RECT;
+         clip_to: "highlight_clip";
+         description { state: "default" 0.0;
+            visible: 0;
+         }
+      }
+      part { name: "highlight";
+         clip_to: "highlight_clip";
+         description { state: "default" 0.0;
+            image.normal: "../res/images/custom_highlight2.png";
+            image.border: 10 10 10 10;
+            image.middle: 0;
+            fill.smooth: 0;
+            rel1.to: "elm.text";
+            rel1.offset: 30 5;
+            rel2.to: "elm.text";
+            rel2.offset: -30 0;
+            visible: 0;
+         }
+         description { state: "visible" 0.0;
+            inherit: "default" 0.0;
+            visible: 1;
+         }
+      }
+   }
+   programs {
+      program { name: "clicked_effect";
+         action: STATE_SET "ready" 0.0;
+         target: "tizen_vg_shape2";
+         target: "tizen_vg_shape_clipper2";
+         after: "clicked_effect2";
+      }
+      program { name: "clicked_effect2";
+         script {
+            run_program(PROGRAM:"clicked_effect3");
+            run_program(PROGRAM:"clicked_effect4");
+         }
+      }
+      program { name: "clicked_effect3";
+         action: STATE_SET "pressed" 0.0;
+         target: "tizen_vg_shape2";
+         target: "elm.text";
+         target: "clipper";
+         transition: DECELERATE 0.3;
+      }
+      program { name: "clicked_effect4";
+         action: STATE_SET "pressed" 0.0;
+         target: "tizen_vg_shape_clipper2";
+         transition: DECELERATE 0.225;
+         after: "clicked_effect5";
+      }
+      program { name: "clicked_effect5";
+         action: STATE_SET "ready" 0.0;
+         target: "tizen_vg_shape_clipper2";
+         transition: LINEAR 0.45;
+         after: "clicked_effect6";
+      }
+      program { name: "clicked_effect6";
+         action: STATE_SET "default" 0.0;
+         target: "tizen_vg_shape2";
+         target: "tizen_vg_shape_clipper2";
+         target: "elm.text";
+         target: "clipper";
+      }
+      program { name: "pressed";
+         signal: "mouse,down,1*";
+         source: "event";
+         script {
+            if ((get_int(multi_down) == 0) && (get_int(mouse_down) == 0)) {
+               set_int(mouse_down, 1);
+               if (get_int(disabled) == 0) {
+                  emit("elm,action,press", "");
+                  run_program(PROGRAM:"clicked_effect");
+               }
+            }
+         }
+      }
+      program { name: "unpressed";
+         signal: "mouse,up,1";
+         source: "event";
+         script {
+            if (get_int(mouse_down) == 1) {
+               set_int(mouse_down, 0);
+               if (get_int(disabled) == 0) {
+                  emit("elm,action,unpress", "");
+               }
+            }
+         }
+      }
+      program { name: "touch_snd";
+         signal: "mouse,clicked,1";
+         source: "event";
+         script {
+            if (get_int(multi_down) == 0) {
+               if (get_int(disabled) == 0) {
+                  run_program(PROGRAM:"touch_sound");
+                  emit("elm,action,click", "");
+               }
+            }
+         }
+      }
+      program { name: "touch_sound";
+         action: RUN_PLUGIN "touch_sound";
+      }
+      program { name: "icon_show";
+         signal: "elm,state,icon,visible";
+         source: "elm";
+         script {
+            set_int(content, 1);
+            set_state(PART:"icon_text_padding", "visible", 0.0);
+            if (get_int(text) == 1) {
+               set_state(PART:"icon_rect", "visible", 0.0);
+               set_state(PART:"padding_left_top", "icon_text", 0.0);
+            } else {
+               set_state(PART:"icon_rect", "icon_only", 0.0);
+               set_state(PART:"padding_left_top", "icon_only", 0.0);
+               set_state(PART:"padding_right_bottom", "icon_only", 0.0);
+            }
+         }
+      }
+      program { name: "icon_hide";
+         signal: "elm,state,icon,hidden";
+         source: "elm";
+         script {
+            set_int(content, 0);
+            set_state(PART:"icon_text_padding", "default", 0.0);
+            set_state(PART:"icon_rect", "default", 0.0);
+            set_state(PART:"padding_left_top", "default", 0.0);
+            set_state(PART:"padding_right_bottom", "default", 0.0);
+         }
+      }
+      program { name: "text_show";
+         signal: "elm,state,text,visible";
+         source: "elm";
+         script {
+            set_int(text, 1);
+            if (get_int(content) == 1) {
+               set_state(PART:"icon_rect", "visible", 0.0);
+               set_state(PART:"padding_left_top", "icon_text", 0.0);
+            }
+         }
+      }
+      program { name: "text_hide";
+         signal: "elm,state,text,hidden";
+         source: "elm";
+         script {
+            set_int(text, 0);
+            if (get_int(content) == 1) {
+               set_state(PART:"icon_rect", "icon_only", 0.0);
+               set_state(PART:"padding_left_top", "icon_only", 0.0);
+               set_state(PART:"padding_right_bottom", "icon_only", 0.0);
+            }
+         }
+      }
+      program { name: "disable";
+         signal: "elm,state,disabled";
+         source: "elm";
+         script {
+           set_int(disabled, 1);
+           set_state(PART:"clipper", "disabled", 0.0);
+           set_state(PART:"tizen_vg_shape_clipper", "disabled", 0.0);
+           set_state(PART:"elm.text", "disabled", 0.0);
+           set_state(PART:"clipper", "disabled", 0.0);
+         }
+      }
+      program { name: "enable";
+         signal: "elm,state,enabled";
+         source: "elm";
+         script {
+           set_int(disabled, 0);
+           set_state(PART:"clipper", "default", 0.0);
+           set_state(PART:"tizen_vg_shape_clipper", "default", 0.0);
+           set_state(PART:"elm.text", "default", 0.0);
+           set_state(PART:"clipper", "default", 0.0);
+         }
+      }
+      program { name: "multi_down";
+         signal: "elm,action,multi,down";
+         source: "elm";
+         script {
+            set_int(multi_down, 1);
+         }
+      }
+      program { name: "multi_up";
+         signal: "elm,action,multi,up";
+         source: "elm";
+         script {
+            set_int(multi_down, 0);
+         }
+      }
+      program { name: "show_new_highlight";
+         signal: "elm,action,access_highlight,show";
+         source: "elm";
+         action: STATE_SET "visible" 0.0;
+         target: "highlight";
+      }
+      program { name: "hide_new_highlight";
+         signal: "elm,action,access_highlight,hide";
+         source: "elm";
+         action: STATE_SET "default" 0.0;
+         target: "highlight";
+      }
+   }
+}
diff --git a/test/RADemoTV/edc_resource/accessibility/screen_reader/custom_frame.edc b/test/RADemoTV/edc_resource/accessibility/screen_reader/custom_frame.edc
new file mode 100644 (file)
index 0000000..c520bda
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "custom_frame_layout";
+   parts {
+      part { name: "bg";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            visible: 1;
+            color: BG_DEFAULT_COLOR_INC;
+         }
+      }
+      part { name: "button_name_lbl";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.0 0.05;
+               to: "bg";
+            }
+            rel2 {
+               relative: 1.0 0.1;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_name";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.3 0.1;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.7 0.2;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_custom_frame_lbl";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.0 0.3;
+               to: "bg";
+            }
+            rel2 {
+               relative: 1.0 0.35;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+      part { name: "button_custom_frame";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.2 0.35;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.8 0.45;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+      part { name: "button_custom_frame_lbl2";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.1 0.55;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.9 0.6;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+      part { name: "button_custom_frame2";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.2 0.6;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.8 0.8;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+   }//end parts
+} //end group
+
diff --git a/test/RADemoTV/edc_resource/accessibility/screen_reader/description.edc b/test/RADemoTV/edc_resource/accessibility/screen_reader/description.edc
new file mode 100644 (file)
index 0000000..4b7ed54
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "description_layout";
+   parts {
+      part { name: "bg";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            visible: 1;
+            color: 200 200 200 255;
+         }
+      }
+      part { name: "button_name_lbl";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.0 0.05;
+               to: "bg";
+            }
+            rel2 {
+               relative: 1.0 0.1;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_name";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.3 0.1;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.7 0.2;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_description_lbl";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.0 0.3;
+               to: "bg";
+            }
+            rel2 {
+               relative: 1.0 0.35;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+      part { name: "button_description";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.3 0.35;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.7 0.45;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+      part { name: "button_a11y_name_lbl";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.1 0.55;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.9 0.6;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+      part { name: "button_a11y_name";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.3 0.6;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.7 0.7;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+      part { name: "button_empty_lbl";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.1 0.8;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.9 0.85;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+      part { name: "button_empty";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 0.4 0.85;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.6 0.95;
+               to: "bg";
+            }
+            visible: 1;
+         }
+      }
+   }//end parts
+} //end group
diff --git a/test/RADemoTV/edc_resource/accessibility/screen_reader/reading_order.edc b/test/RADemoTV/edc_resource/accessibility/screen_reader/reading_order.edc
new file mode 100644 (file)
index 0000000..b706dea
--- /dev/null
@@ -0,0 +1,382 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "reading_order_layout";
+
+   images.image: "../res/images/arrow-right.png" COMP;
+   images.image: "../res/images/arrow-left.png" COMP;
+   images.image: "../res/images/arrow-left1.png" COMP;
+   images.image: "../res/images/arrow-up.png" COMP;
+   images.image: "../res/images/arrow-down.png" COMP;
+
+   parts {
+      part { name: "bg";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            visible: 1;
+            color: 200 200 200 255;
+            rel1 {
+               relative: 0.0 0.0;
+            }
+            rel2 {
+               relative: 1.0 1.0;
+            }
+         }
+      }
+      part { name: "bg_custom";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            visible: 1;
+            color: 89 205 255 255;
+            rel1 {
+               relative: 0.0 0.0;
+            }
+            rel2 {
+               relative: 1.0 0.5;
+            }
+         }
+      }
+      part { name: "bg_default";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            visible: 1;
+            color: 89 255 142 255;
+            rel1 {
+               relative: 0.0 0.5;
+            }
+            rel2 {
+               relative: 1.0 1.0;
+            }
+         }
+      }
+      part { name: "custom_lbl";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.05 0.05;
+               to: "bg";
+            }
+            rel2 {
+               relative: 1.0 0.15;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "default_lbl";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.05 0.55;
+               to: "bg";
+            }
+            rel2 {
+               relative: 1.0 0.65;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_a";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.1 0.15;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.3 0.25;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_b";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.4 0.15;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.6 0.25;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_c";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.7 0.15;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.9 0.25;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_d";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.1 0.3;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.3 0.4;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_e";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.4 0.3;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.6 0.4;
+               to: "bg";
+            }
+         }
+      }
+
+
+
+      part { name: "button_default_a";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.1 0.65;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.3 0.75;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_default_b";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.4 0.65;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.6 0.75;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_default_c";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.7 0.65;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.9 0.75;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_default_d";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.1 0.8;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.3 0.9;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "button_default_e";
+         type: SWALLOW;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.4 0.8;
+               to: "bg";
+            }
+            rel2 {
+               relative: 0.6 0.9;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "arrow_custom_label_d";
+          description {
+             state: "default" 0.0;
+             image.normal: "../res/images/arrow-down.png";
+             rel1 {
+               relative: 0.0 0.4;
+               to: "custom_lbl";
+             }
+             rel2 {
+                relative: 0.0 0.0;
+               to: "button_d";
+             }
+          }
+      }
+      part { name: "arrow_custom_b_c";
+          description {
+             state: "default" 0.0;
+             image.normal: "../res/images/arrow-right.png";
+             rel1 {
+                relative: 1.05 0.3;
+                to: "button_b";
+             }
+             rel2 {
+                relative: -0.05 0.7;
+              to: "button_c";
+             }
+          }
+      }
+      part { name: "arrow_custom_d_e";
+          description {
+             state: "default" 0.0;
+             image.normal: "../res/images/arrow-right.png";
+             rel1 {
+                relative: 1.05 0.3;
+                to: "button_d";
+             }
+             rel2 {
+                relative: -0.05 0.7;
+              to: "button_e";
+             }
+          }
+      }
+      part { name: "arrow_custom_e_b";
+          description {
+             state: "default" 0.0;
+             image.normal: "../res/images/arrow-up.png";
+             rel1 {
+                relative: 0.35 1.05;
+                to: "button_b";
+             }
+             rel2 {
+                relative: 0.65 -0.05;
+              to: "button_e";
+             }
+          }
+      }
+
+
+      part { name: "arrow_default_a_b";
+          description {
+             state: "default" 0.0;
+             image.normal: "../res/images/arrow-right.png";
+             rel1 {
+                relative: 1.05 0.3;
+                to: "button_default_a";
+             }
+             rel2 {
+                relative: -0.05 0.7;
+              to: "button_default_b";
+             }
+          }
+      }
+      part { name: "arrow_default_b_c";
+          description {
+             state: "default" 0.0;
+             image.normal: "../res/images/arrow-right.png";
+             rel1 {
+                relative: 1.05 0.3;
+                to: "button_default_b";
+             }
+             rel2 {
+                relative: -0.05 0.7;
+              to: "button_default_c";
+             }
+          }
+      }
+
+      part { name: "arrow_default_d_e";
+          description {
+             state: "default" 0.0;
+             image.normal: "../res/images/arrow-right.png";
+             rel1 {
+                relative: 1.05 0.3;
+                to: "button_default_d";
+             }
+             rel2 {
+                relative: -0.05 0.7;
+              to: "button_default_e";
+             }
+          }
+      }
+
+      part { name: "arrow_default_c_d";
+          description {
+             state: "default" 0.0;
+             image.normal: "../res/images/arrow-left1.png";
+             rel1 {
+                relative: 0.5 -0.5;
+                to: "button_default_d";
+             }
+             rel2 {
+                relative: 0.5 1.5;
+              to: "button_default_c";
+             }
+          }
+      }
+
+   }//end parts
+} //end group
diff --git a/test/RADemoTV/edc_resource/button.edc b/test/RADemoTV/edc_resource/button.edc
new file mode 100644 (file)
index 0000000..a8094c8
--- /dev/null
@@ -0,0 +1,347 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+#define BUTTON_PADDING_WIDTH 170
+#define BUTTON_PADDING_HEIGHT 22
+
+group { name: "button_layout";
+   parts {
+      part { name: "top_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 0 1;
+            rel2.relative: 1.0 0.0;
+            align: 0 0;
+         }
+      }
+      part { name: "btn_expand_opened";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "top_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "top_padding";
+            }
+         }
+      }
+      part { name: "btn_expand_opened_bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_expand_opened";
+            }
+            rel2.to_y: "btn_expand_opened";
+         }
+      }
+      part { name: "btn_expand_closed";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_expand_opened_bottom_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_expand_opened_bottom_padding";
+            }
+         }
+      }
+      part { name: "btn_expand_closed_bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0 1.0;
+               to_y: "btn_expand_closed";
+            }
+            rel2.to_y: "btn_expand_closed";
+         }
+      }
+      part { name: "btn_reorder";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_expand_closed_bottom_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_expand_closed_bottom_padding";
+            }
+         }
+      }
+      part { name: "btn_reorder_bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_reorder";
+            }
+            rel2.to_y: "btn_reorder";
+         }
+      }
+      part { name: "btn_expand_add";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_reorder_bottom_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_reorder_bottom_padding";
+            }
+         }
+      }
+      part { name: "btn_expand_add_bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_expand_add";
+            }
+            rel2.to_y: "btn_expand_add";
+         }
+      }
+      part { name: "btn_expand_delete";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_expand_add_bottom_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_expand_add_bottom_padding";
+            }
+         }
+      }
+      part { name: "btn_expand_delete_bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_expand_delete";
+            }
+            rel2.to_y: "btn_expand_delete";
+         }
+      }
+      part { name: "btn_default";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_expand_delete_bottom_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_expand_delete_bottom_padding";
+            }
+         }
+      }
+      part { name: "btn_default_bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_default";
+            }
+            rel2.to_y: "btn_default";
+         }
+      }
+      part { name: "btn_circle";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_default_bottom_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_default_bottom_padding";
+            }
+         }
+      }
+      part { name: "btn_circle_bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_circle";
+            }
+            rel2.to_y: "btn_circle";
+         }
+      }
+      part { name: "btn_bottom";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            state: "default" 0.0;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_circle_bottom_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_circle_bottom_padding";
+            }
+         }
+      }
+      part { name: "btn_bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_bottom";
+            }
+            rel2.to_y: "btn_bottom";
+         }
+      }
+      part { name: "btn_circle_text";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            state: "default" 0.0;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_bottom_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_bottom_padding";
+            }
+         }
+      }
+      part { name: "btn_circle_text_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            max: BUTTON_PADDING_WIDTH BUTTON_PADDING_HEIGHT;
+            fixed: 1 1;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_circle_text";
+            }
+            rel2.to_y: "btn_circle_text";
+         }
+      }
+      part { name: "btn_contacts";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            state: "default" 0.0;
+            align: 0.5 0;
+            rel1 {
+               relative: 0.5 1.0;
+               to_y: "btn_circle_text_padding";
+            }
+            rel2 {
+               relative: 0.5 1.0;
+               to_y: "btn_circle_text_padding";
+            }
+         }
+      }
+      part { name: "bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 BUTTON_PADDING_HEIGHT;
+            align: 0.5 1.0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "btn_contacts";
+            }
+         }
+      }
+   }
+}
+
+#undef BUTTON_PADDING_WIDTH
+#undef BUTTON_PADDING_HEIGHT
diff --git a/test/RADemoTV/edc_resource/datetime.edc b/test/RADemoTV/edc_resource/datetime.edc
new file mode 100644 (file)
index 0000000..231ab79
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+#define DATETIME_PADDING_HEIGHT 50
+#define DATETIME_TOP_PADDING_HEIGHT 30
+#define DATETIME_PICKER_PADDING_HEIGHT 100
+#define DATETIME_BUTTON_WIDTH 550
+#define DATETIME_TEXT_HEIGHT 60
+#define DATETIME_TEXT_COLOR 173 170 165 255
+#define DATETIME_TEXT_SIZE 24
+
+#define DATETIME_PICKER(_pos, _after, str)\
+   part { name: "picker"#_pos;\
+      type: SWALLOW;\
+      scale: 1;\
+      description { state: "default" 0.0;\
+         align: 0.5 0.0;\
+         fixed: 1 1;\
+         rel1 {\
+            relative: 0 1;\
+            to: "text"#_pos;\
+         }\
+         rel2 {\
+            relative: 1 1;\
+            to: "text"#_pos;\
+         }\
+      }\
+   }\
+   part { name: "text"#_pos;\
+      type: TEXT;\
+      scale: 1;\
+      description { state: "default" 0.0;\
+         align: 0.5 0.0;\
+         fixed: 0 1;\
+         min: 0 DATETIME_PADDING_HEIGHT;\
+         rel1 {\
+            relative: 0 1;\
+            to: "padding"#_after;\
+         }\
+         rel2 {\
+            relative: 1 1;\
+            to: "padding"#_after;\
+         }\
+         color: DATETIME_TEXT_COLOR;\
+         text {\
+            font: "Tizen:style=Regular";\
+            size: DATETIME_TEXT_SIZE;\
+            min:  1 0;\
+            align: 0.0 0.0;\
+            text: str;\
+            ellipsis: -1; \
+         }\
+      }\
+   }\
+   part { name: "padding"#_pos;\
+      type: SPACER;\
+      scale: 1;\
+      description { state: "default" 0.0;\
+         min: 0 DATETIME_PADDING_HEIGHT;\
+         fixed: 0 1;\
+         align: 0.5 0.0;\
+         rel1 {\
+            relative: 0.0 1.0;\
+            to_x: "padding"#_after;\
+            to_y: "picker"#_pos;\
+         }\
+         rel2 {\
+            relative: 1.0 1.0;\
+            to_x: "padding"#_after;\
+            to_y: "picker"#_pos;\
+         }\
+      }\
+   }
+
+group { name: "datetime_layout";
+   parts {
+      part { name: "padding0";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 DATETIME_TOP_PADDING_HEIGHT;
+            fixed: 0 1;
+            align: 0.5 0.0;
+            rel1.relative: 0 0;
+            rel2.relative: 1 0;
+         }
+      }
+      DATETIME_PICKER(1, 0, " Date Time (12hr) :")
+      DATETIME_PICKER(2, 1, " Date Time (24hr) :")
+      DATETIME_PICKER(3, 2, " Time Date (12hr) :")
+      DATETIME_PICKER(4, 3, " Time Date (24hr) :")
+      DATETIME_PICKER(5, 4, " User format changed as per System's Region format :")
+      DATETIME_PICKER(6, 5, " Datetime widget with field limits :")
+      part { name: "bottom.padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 DATETIME_TOP_PADDING_HEIGHT;
+            align: 0.5 1.0;
+            rel1 {
+               to: "padding6";
+               relative: 0 1;
+            }
+         }
+      }
+   }
+}
+
+#undef DATETIME_PICKER
+#undef DATETIME_PADDING_HEIGHT
+#undef DATETIME_PICKER_PADDING_HEIGHT
+#undef DATETIME_BUTTON_WIDTH
+#undef DATETIME_TOP_PADDING_HEIGHT
+#undef DATETIME_TEXT_HEIGHT
+#undef DATETIME_TEXT_COLOR
+#undef DATETIME_TEXT_SIZE
diff --git a/test/RADemoTV/edc_resource/default/inc/my_button_header.edc b/test/RADemoTV/edc_resource/default/inc/my_button_header.edc
new file mode 100644 (file)
index 0000000..7e3001e
--- /dev/null
@@ -0,0 +1,61 @@
+#define BASE_SCALE_INC 2.6
+#define SMALL "HD/"
+#define MEDIUM "HD/"
+#define DEFAULT_IMAGE "HD/"
+
+#define BG_DEFAULT_COLOR_INC 248 246 239 255
+#define BG_EDIT_MODE_COLOR_INC 248 246 239 255
+#define BG_GROUP_LIST_COLOR_INC 248 246 239 255
+#define BG_TRANSPARENT_COLOR_INC 0 0 0 0
+#define BORDER_BG_COLOR_INC 248 246 239 255
+#define BORDER_FONT_COLOR_INC 59 115 182 255
+#define BORDER_FONT_SIZE_INC 42
+#define BORDER_HEIGHT_INC 80
+#define BORDER_ICON_PADDING_WIDTH 8
+#define BORDER_ICON_SIZE 36 36
+#define BORDER_PADDING_WIDTH 20
+#define BORDER_SHADOW_HEIGHT 20
+#define BORDER_TITLE_FONT_SIZE_INC 12
+#define BORDER_TITLE_HEIGHT_INC 22
+
+#define BUTTON_ANCHOR_BG_BORDER 20 20 22 22
+#define BUTTON_ANCHOR_COLOR_TRANSPARENT 0 0 0 0
+#define BUTTON_ANCHOR_PADDING_DEFAULT_SIZE 10
+#define BUTTON_ICON_DEFAULT_HEIGHT_INC 60
+#define BUTTON_ICON_DEFAULT_WIDTH_INC 60
+#define BUTTON_MIN_HEIGHT_INC 78
+#define BUTTON_MIN_WIDTH_INC 50
+#define BUTTON_PADDING_BOTTOM_HEIGHT_INC 14
+#define BUTTON_PADDING_ICON_RIGHT_INC 14
+#define BUTTON_PADDING_LEFT_ICON_TEXT_INC 56
+#define BUTTON_PADDING_LEFT_RIGHT_INC 32
+#define BUTTON_PADDING_TOP_HEIGHT_INC 10
+#define BUTTON_TEXT_SHADOW_NORMAL_COLOR_INC 255 255 255 255
+#define BUTTON_TEXT_STYLE1_FONT_SIZE_INC 36
+#define BUTTON_TEXT_STYLE1_NORMAL_COLOR_INC 58 58 58 255
+#define BUTTON_TEXT_STYLE1_VISIBLE_BG_MIN_INC 148 74
+
+#define STYLE_TAGS \
+   tag:  "br" "\n";\
+   tag:  "ps" "ps";\
+   tag:  "tab" "\t";\
+   tag:  "b" "+ font_weight=Bold";
+
+#define STYLE_TAG_MATCH \
+   tag:  "match" "+ color=#3db8cc";
+
+styles {
+   // ************* button text ********** //
+   style { name: "button_main";
+      base: "align=center valign=center color=#fafafaff font=Tizen:style=Regular font_size=30 text_class=tizen ellipsis=1.0";
+      STYLE_TAGS
+   }
+   style { name: "button_main_dim";
+      base: "align=center valign=center color=#fafafaa3 font=Tizen:style=Regular font_size=30 text_class=tizen ellipsis=1.0";
+      STYLE_TAGS
+   }
+   style { name: "button_main_press";
+      base: "align=center valign=center color=#fafafaff font=Tizen:style=Regular font_size=30 text_class=tizen ellipsis=1.0";
+      STYLE_TAGS
+   }
+}
diff --git a/test/RADemoTV/edc_resource/default/my_button.edc b/test/RADemoTV/edc_resource/default/my_button.edc
new file mode 100644 (file)
index 0000000..b69b2b8
--- /dev/null
@@ -0,0 +1,709 @@
+group { name: "elm/button/base/custom1";
+   data {
+      item: "access_highlight" "on";
+   }
+   images {
+      image: "../res/images/btn_style_nor.png" COMP;
+      image: "../res/images/btn_style_sel.png" COMP;
+      image: "../res/images/custom_highlight.png" COMP;
+   }
+   parts {
+      part { name: "button_image";
+         mouse_events: 1;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            min: BUTTON_TEXT_STYLE1_VISIBLE_BG_MIN_INC;
+            visible: 0;
+            image {
+               normal: "../res/images/btn_style_nor.png";
+               border: BUTTON_ANCHOR_BG_BORDER;
+               middle: SOLID;
+            }
+         }
+         description { state: "visible" 0.0;
+            visible: 1;
+            min: BUTTON_TEXT_STYLE1_VISIBLE_BG_MIN_INC;
+            color_class: "W012";
+            image {
+               normal: "../res/images/btn_style_nor.png";
+               border: BUTTON_ANCHOR_BG_BORDER;
+               border_scale: 1;
+            }
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         description { state: "default" 0.0;
+            fixed: 1 0;
+            visible: 0;
+            align: 0.0 0.5;
+            rel2.relative: 0.0 1.0;
+         }
+         description { state: "visible" 0.0;
+            inherit: "default" 0.0;
+            fixed: 1 0;
+            visible: 1;
+            aspect: 1.0 1.0;
+            aspect_preference: VERTICAL;
+         }
+         description { state: "icononly" 0.0;
+            inherit: "default" 0.0;
+            fixed: 0 0;
+            visible: 1;
+            align: 0.5 0.5;
+            aspect: 1.0 1.0;
+            rel2.relative: 1.0 1.0;
+            aspect_preference: VERTICAL;
+         }
+      }
+      part { name: "elm.padding.text.left";
+         type: SPACER;
+         scale: 1;
+         mouse_events: 0;
+         description {  state: "default" 0.0;
+            align: 0 0.5;
+            fixed: 1 0;
+            min: BUTTON_ANCHOR_PADDING_DEFAULT_SIZE 0;
+            rel1 {
+               to: "elm.swallow.content";
+               relative: 1 0;
+            }
+            rel2 {
+               to: "elm.swallow.content";
+               relative: 1 1;
+            }
+         }
+      }
+      part { name: "elm.padding.text.right";
+         type: SPACER;
+         scale: 1;
+         mouse_events: 0;
+         description {  state: "default" 0.0;
+            align: 1 0.5;
+            rel1.relative: 1 0;
+            fixed: 1 0;
+            min: BUTTON_ANCHOR_PADDING_DEFAULT_SIZE 10;
+         }
+      }
+      part { name: "elm.text";
+         type: TEXT;
+         mouse_events:  0;
+         scale: 1;
+         effect: SHADOW BOTTOM;
+         description { state: "default" 0.0;
+            rel1 {
+               to_x: "elm.padding.text.left";
+               relative: 1 0;
+            }
+            rel2 {
+               to : "elm.padding.text.right";
+               relative: 0 1;
+            }
+            color: BUTTON_TEXT_STYLE1_NORMAL_COLOR_INC;
+            color2: BUTTON_TEXT_SHADOW_NORMAL_COLOR_INC;
+            text {
+               font: "SLP:style=Regular";
+               size: BUTTON_TEXT_STYLE1_FONT_SIZE_INC;
+               min: 0 0;
+               text_class: "slp";
+            }
+         }
+      }
+      part { name: "over";
+         type: RECT;
+         mouse_events: 1;
+         repeat_events: 1;
+         description { state: "default" 0.0;
+            color: BUTTON_ANCHOR_COLOR_TRANSPARENT;
+         }
+      }
+      part { name: "disabler";
+         type: RECT;
+         description { state: "default" 0.0;
+            color: BUTTON_ANCHOR_COLOR_TRANSPARENT;
+            visible: 0;
+         }
+         description { state: "disabled" 0.0;
+            inherit: "default" 0.0;
+            visible: 1;
+         }
+      }
+      part { name: "highlight_base"; type: RECT;
+         clip_to: "highlight_clip";
+         description { state: "default" 0.0;
+            visible: 0;
+         }
+      }
+      part { name: "highlight_clip"; type: RECT;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 255;
+            rel1.relative: -1 -1;
+            rel2.relative: 2 2;
+         }
+      }
+
+      part { name: "highlight";
+         clip_to: "highlight_clip";
+         description { state: "default" 0.0;
+            image.normal: "../res/images/custom_highlight.png";
+            image.border: 12 12 12 12;
+            image.middle: 0;
+            fill.smooth: 0;
+            rel1.to: "highlight_base";
+            rel1.offset: -7 -7;
+            rel2.to: "highlight_base";
+            rel2.offset: 5 5;
+            visible: 0;
+         }
+         description { state: "visible" 0.0;
+            inherit: "default" 0.0;
+            visible: 1;
+         }
+      }
+   }
+
+
+   programs {
+      program { name: "button_mouse_in";
+         signal: "mouse,in";
+         source: "over";
+         action: STATE_SET "visible" 0.0;
+         target: "button_image";
+         target: "elm.text";
+      }
+      program { name: "button_mouse_out";
+         signal: "mouse,out";
+         source: "over";
+         action: STATE_SET "default" 0.0;
+         target: "button_image";
+         target: "elm.text";
+      }
+      program { name: "button_unclick";
+         signal: "mouse,up,1";
+         source: "over";
+         action: STATE_SET "visible" 0.0;
+         target: "button_image";
+         target: "elm.text";
+      }
+      program { name: "button_click2";
+         signal: "mouse,down,1";
+         source: "over";
+         action: STATE_SET "clicked" 0.0;
+         target: "button_image";
+         target: "elm.text";
+      }
+      program { name: "button_unclick2";
+         signal: "mouse,up,1";
+         source: "over";
+         action: STATE_SET "default" 0.0;
+         transition: DECELERATE 0.5;
+         target: "button_image";
+         target: "elm.text";
+      }
+      program { name: "button_unclick3";
+         signal: "mouse,up,1";
+         source: "over";
+         action: SIGNAL_EMIT "elm,action,click" "";
+      }
+      program { name: "text_show";
+         signal: "elm,state,text,visible";
+         source: "elm";
+         script {
+            new st[31];
+            new Float:vl;
+            get_state(PART:"elm.swallow.content", st, 30, vl);
+            if (!strcmp(st, "icononly")) {
+               set_state(PART:"elm.swallow.content", "visible", 0.0);
+            }
+            get_state(PART:"elm.text", st, 30, vl);
+            if (!strcmp(st, "disabled") || (!strcmp(st, "disabled_visible")))
+              set_state(PART:"elm.text", "disabled_visible", 0.0);
+            else
+              set_state(PART:"elm.text", "visible", 0.0);
+         }
+      }
+      program { name: "icon_show";
+         signal: "elm,state,icon,visible";
+         source: "elm";
+         script {
+            new st[31];
+            new Float:vl;
+            get_state(PART:"elm.text", st, 30, vl);
+            if (!strcmp(st, "visible")) {
+               set_state(PART:"elm.swallow.content", "visible", 0.0);
+            }
+            else {
+               set_state(PART:"elm.swallow.content", "icononly", 0.0);
+            }
+         }
+      }
+      program { name: "enable";
+         signal: "elm,state,enabled";
+         source: "elm";
+         script {
+            new st[31];
+            new Float:vl;
+            set_state(PART:"button_image", "visible", 0.0);
+            set_state(PART:"over", "visible", 0.0);
+            set_state(PART:"disabler", "visible", 0.0);
+            get_state(PART:"elm.text", st, 30, vl);
+            if (!strcmp(st, "visible") || !strcmp(st, "disabled_visible"))
+              set_state(PART:"elm.text", "visible", 0.0);
+            else
+              set_state(PART:"elm.text", "default", 0.0);
+         }
+      }
+      program { name: "show_new_highlight";
+         signal: "elm,action,access_highlight,show";
+         source: "elm";
+         action: STATE_SET "visible" 0.0;
+         target: "highlight";
+      }
+      program { name: "hide_new_highlight";
+         signal: "elm,action,access_highlight,hide";
+         source: "elm";
+         action: STATE_SET "default" 0.0;
+         target: "highlight";
+      }
+   }
+
+}
+
+group { name: "elm/button/base/custom2";
+   data.item: "vector_ux" "default";
+   data.item: "access_highlight" "on";
+   images.image: "../res/images/custom_highlight2.png" COMP;
+   script {
+      public mouse_down = 0;
+      public multi_down = 0;
+      public disabled = 0;
+      public text = 0;
+      public content = 0;
+   }
+   parts {
+      part { name: "base";
+         scale: 1;
+         type: SPACER;
+         description { state: "default" 0.0;
+            min: BUTTON_MIN_WIDTH_INC BUTTON_MIN_HEIGHT_INC;
+         }
+      }
+      //Base Shape Part
+      part { name: "tizen_vg_shape";
+         type: SWALLOW;
+         clip_to: "tizen_vg_shape_clipper";
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 BUTTON_MIN_HEIGHT_INC;
+            rel1.relative: 0 0.5;
+            rel2.relative: 1 0.5;
+            fixed: 0 1;
+         }
+      }
+      part { name: "tizen_vg_shape_clipper";
+         type: RECT;
+         description { state: "default" 0.0;
+            color: 82 198 216 255;
+         }
+         description { state: "disabled" 0.0;
+            color: 138 195 204 255;
+         }
+      }
+      //Effect Shape Part
+      part { name: "tizen_vg_shape2";
+         type: SWALLOW;
+         clip_to: "tizen_vg_shape_clipper2";
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.to: "tizen_vg_shape";
+            rel2.to: "tizen_vg_shape";
+            rel1.relative: 0.15 0.15;
+            rel2.relative: 0.85 0.85;
+         }
+         description { state: "ready" 0.0;
+            inherit: "default" 0.0;
+         }
+         description { state: "pressed" 0.0;
+            inherit: "default" 0.0;
+            rel1.relative: 0.0 0.0;
+            rel2.relative: 1.0 1.0;
+         }
+      }
+      part { name: "tizen_vg_shape_clipper2";
+         type: RECT;
+         description { state: "default" 0.0;
+            visible: 0;
+            color: 48 139 153 0;
+         }
+         description { state: "ready" 0.0;
+            inherit: "default" 0.0;
+            visible: 1;
+         }
+         description { state: "pressed" 0.0;
+            color: 48 139 153 255;
+         }
+      }
+      part { name: "padding_left_top";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.to: "tizen_vg_shape";
+            rel2.to: "tizen_vg_shape";
+            align: 0.0 0.0;
+            rel2.relative: 0.0 0.0;
+            min: BUTTON_PADDING_LEFT_RIGHT_INC BUTTON_PADDING_TOP_HEIGHT_INC;
+            fixed: 1 1;
+         }
+         description { state: "icon_only" 0.0;
+            inherit: "default" 0.0;
+            min: 0 0;
+         }
+         description { state: "icon_text" 0.0;
+            inherit: "default" 0.0;
+            min: BUTTON_PADDING_LEFT_ICON_TEXT_INC BUTTON_PADDING_TOP_HEIGHT_INC;
+         }
+      }
+      part { name: "padding_right_bottom";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.to: "tizen_vg_shape";
+            rel2.to: "tizen_vg_shape";
+            align: 1.0 1.0;
+            rel1.relative: 1.0 1.0;
+            min: BUTTON_PADDING_LEFT_RIGHT_INC BUTTON_PADDING_BOTTOM_HEIGHT_INC;
+            fixed: 1 1;
+         }
+         description { state: "icon_only" 0.0;
+            inherit: "default" 0.0;
+            min: 0 0;
+         }
+      }
+      part { name: "icon_rect";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.0;
+            rel1 {
+               relative: 1.0 1.0;
+               to: "padding_left_top";
+            }
+            rel2 {
+               relative: 1.0 1.0;
+               to: "padding_left_top";
+            }
+            min: 0 BUTTON_ICON_DEFAULT_HEIGHT_INC;
+            fixed: 1 1;
+         }
+         description { state: "visible" 0.0;
+            inherit: "default" 0.0;
+            min: BUTTON_ICON_DEFAULT_WIDTH_INC BUTTON_ICON_DEFAULT_HEIGHT_INC;
+            fixed: 1 1;
+         }
+         description { state: "icon_only" 0.0;
+            rel1.to: "tizen_vg_shape";
+            rel2.to: "tizen_vg_shape";
+            min: BUTTON_ICON_DEFAULT_WIDTH_INC BUTTON_ICON_DEFAULT_HEIGHT_INC;
+            max: BUTTON_ICON_DEFAULT_WIDTH_INC BUTTON_ICON_DEFAULT_HEIGHT_INC;
+            align: 0.5 0.5;
+            fixed: 1 1;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         clip_to: "clipper";
+         description { state: "default" 0.0;
+            rel1.to: "icon_rect";
+            rel2.to: "icon_rect";
+         }
+      }
+      part { name: "icon_text_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.5;
+            min: 0 0;
+            rel1 {
+               relative: 1.0 0.0;
+               to: "icon_rect";
+            }
+            rel2 {
+               relative: 1.0 1.0;
+               to: "icon_rect";
+            }
+            fixed: 1 1;
+         }
+         description { state: "visible" 0.0;
+            inherit: "default" 0.0;
+            min: BUTTON_PADDING_ICON_RIGHT_INC 0;
+         }
+      }
+      part { name: "elm.text";
+         type: TEXTBLOCK;
+         mouse_events: 0;
+         scale: 1;
+         clip_to: "clipper";
+         description { state: "default" 0.0;
+            rel1 {
+               relative: 1.0 0.0;
+               to: "icon_text_padding";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to: "padding_right_bottom";
+            }
+            text {
+               style: "button_main";
+            }
+         }
+         description { state: "pressed" 0.0;
+            inherit: "default" 0.0;
+            text.style: "button_main_press";
+         }
+         description { state: "disabled" 0.0;
+            inherit: "default" 0.0;
+            text.style: "button_main_dim";
+         }
+      }
+      part { name: "clipper";
+         type: RECT;
+         description { state: "default" 0.0;
+         }
+         description { state: "pressed" 0.0;
+         }
+         description { state: "disabled" 0.0;
+            inherit: "default" 0.0;
+            color: 255 255 255 163;
+         }
+      }
+      part { name: "event";
+         type: RECT;
+         ignore_flags: ON_HOLD;
+         description { state: "default" 0.0;
+            rel1.to: "tizen_vg_shape";
+            rel2.to: "tizen_vg_shape";
+            color: 0 0 0 0;
+         }
+      }
+      part { name: "highlight_clip"; type: RECT;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               relative: 1.0 0.0;
+               to: "icon_text_padding";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to: "padding_right_bottom";
+            }
+         }
+      }
+      part { name: "highlight_base"; type: RECT;
+         clip_to: "highlight_clip";
+         description { state: "default" 0.0;
+            visible: 0;
+         }
+      }
+      part { name: "highlight";
+         clip_to: "highlight_clip";
+         description { state: "default" 0.0;
+            image.normal: "../res/images/custom_highlight2.png";
+            image.border: 10 10 10 10;
+            image.middle: 0;
+            fill.smooth: 0;
+            rel1.to: "elm.text";
+            rel1.offset: 30 5;
+            rel2.to: "elm.text";
+            rel2.offset: -30 0;
+            visible: 0;
+         }
+         description { state: "visible" 0.0;
+            inherit: "default" 0.0;
+            visible: 1;
+         }
+      }
+   }
+   programs {
+      program { name: "clicked_effect";
+         action: STATE_SET "ready" 0.0;
+         target: "tizen_vg_shape2";
+         target: "tizen_vg_shape_clipper2";
+         after: "clicked_effect2";
+      }
+      program { name: "clicked_effect2";
+         script {
+            run_program(PROGRAM:"clicked_effect3");
+            run_program(PROGRAM:"clicked_effect4");
+         }
+      }
+      program { name: "clicked_effect3";
+         action: STATE_SET "pressed" 0.0;
+         target: "tizen_vg_shape2";
+         target: "elm.text";
+         target: "clipper";
+         transition: DECELERATE 0.3;
+      }
+      program { name: "clicked_effect4";
+         action: STATE_SET "pressed" 0.0;
+         target: "tizen_vg_shape_clipper2";
+         transition: DECELERATE 0.225;
+         after: "clicked_effect5";
+      }
+      program { name: "clicked_effect5";
+         action: STATE_SET "ready" 0.0;
+         target: "tizen_vg_shape_clipper2";
+         transition: LINEAR 0.45;
+         after: "clicked_effect6";
+      }
+      program { name: "clicked_effect6";
+         action: STATE_SET "default" 0.0;
+         target: "tizen_vg_shape2";
+         target: "tizen_vg_shape_clipper2";
+         target: "elm.text";
+         target: "clipper";
+      }
+      program { name: "pressed";
+         signal: "mouse,down,1*";
+         source: "event";
+         script {
+            if ((get_int(multi_down) == 0) && (get_int(mouse_down) == 0)) {
+               set_int(mouse_down, 1);
+               if (get_int(disabled) == 0) {
+                  emit("elm,action,press", "");
+                  run_program(PROGRAM:"clicked_effect");
+               }
+            }
+         }
+      }
+      program { name: "unpressed";
+         signal: "mouse,up,1";
+         source: "event";
+         script {
+            if (get_int(mouse_down) == 1) {
+               set_int(mouse_down, 0);
+               if (get_int(disabled) == 0) {
+                  emit("elm,action,unpress", "");
+               }
+            }
+         }
+      }
+      program { name: "touch_snd";
+         signal: "mouse,clicked,1";
+         source: "event";
+         script {
+            if (get_int(multi_down) == 0) {
+               if (get_int(disabled) == 0) {
+                  run_program(PROGRAM:"touch_sound");
+                  emit("elm,action,click", "");
+               }
+            }
+         }
+      }
+      program { name: "touch_sound";
+         action: RUN_PLUGIN "touch_sound";
+      }
+      program { name: "icon_show";
+         signal: "elm,state,icon,visible";
+         source: "elm";
+         script {
+            set_int(content, 1);
+            set_state(PART:"icon_text_padding", "visible", 0.0);
+            if (get_int(text) == 1) {
+               set_state(PART:"icon_rect", "visible", 0.0);
+               set_state(PART:"padding_left_top", "icon_text", 0.0);
+            } else {
+               set_state(PART:"icon_rect", "icon_only", 0.0);
+               set_state(PART:"padding_left_top", "icon_only", 0.0);
+               set_state(PART:"padding_right_bottom", "icon_only", 0.0);
+            }
+         }
+      }
+      program { name: "icon_hide";
+         signal: "elm,state,icon,hidden";
+         source: "elm";
+         script {
+            set_int(content, 0);
+            set_state(PART:"icon_text_padding", "default", 0.0);
+            set_state(PART:"icon_rect", "default", 0.0);
+            set_state(PART:"padding_left_top", "default", 0.0);
+            set_state(PART:"padding_right_bottom", "default", 0.0);
+         }
+      }
+      program { name: "text_show";
+         signal: "elm,state,text,visible";
+         source: "elm";
+         script {
+            set_int(text, 1);
+            if (get_int(content) == 1) {
+               set_state(PART:"icon_rect", "visible", 0.0);
+               set_state(PART:"padding_left_top", "icon_text", 0.0);
+            }
+         }
+      }
+      program { name: "text_hide";
+         signal: "elm,state,text,hidden";
+         source: "elm";
+         script {
+            set_int(text, 0);
+            if (get_int(content) == 1) {
+               set_state(PART:"icon_rect", "icon_only", 0.0);
+               set_state(PART:"padding_left_top", "icon_only", 0.0);
+               set_state(PART:"padding_right_bottom", "icon_only", 0.0);
+            }
+         }
+      }
+      program { name: "disable";
+         signal: "elm,state,disabled";
+         source: "elm";
+         script {
+           set_int(disabled, 1);
+           set_state(PART:"clipper", "disabled", 0.0);
+           set_state(PART:"tizen_vg_shape_clipper", "disabled", 0.0);
+           set_state(PART:"elm.text", "disabled", 0.0);
+           set_state(PART:"clipper", "disabled", 0.0);
+         }
+      }
+      program { name: "enable";
+         signal: "elm,state,enabled";
+         source: "elm";
+         script {
+           set_int(disabled, 0);
+           set_state(PART:"clipper", "default", 0.0);
+           set_state(PART:"tizen_vg_shape_clipper", "default", 0.0);
+           set_state(PART:"elm.text", "default", 0.0);
+           set_state(PART:"clipper", "default", 0.0);
+         }
+      }
+      program { name: "multi_down";
+         signal: "elm,action,multi,down";
+         source: "elm";
+         script {
+            set_int(multi_down, 1);
+         }
+      }
+      program { name: "multi_up";
+         signal: "elm,action,multi,up";
+         source: "elm";
+         script {
+            set_int(multi_down, 0);
+         }
+      }
+      program { name: "show_new_highlight";
+         signal: "elm,action,access_highlight,show";
+         source: "elm";
+         action: STATE_SET "visible" 0.0;
+         target: "highlight";
+      }
+      program { name: "hide_new_highlight";
+         signal: "elm,action,access_highlight,hide";
+         source: "elm";
+         action: STATE_SET "default" 0.0;
+         target: "highlight";
+      }
+   }
+}
diff --git a/test/RADemoTV/edc_resource/entry.edc b/test/RADemoTV/edc_resource/entry.edc
new file mode 100644 (file)
index 0000000..9e0fdc4
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "entry_layout";
+   parts {
+      part { name: "bg";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            color: 220 220 220 255;
+         }
+      }
+      part { name: "entry_part";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.to: "bg";
+            rel2.to: "bg";
+         }
+      }
+   }
+}
diff --git a/test/RADemoTV/edc_resource/genlist.edc b/test/RADemoTV/edc_resource/genlist.edc
new file mode 100644 (file)
index 0000000..1de7c7e
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "gl_custom_item";
+   styles{
+      style { name: "text_style";
+         base: "color=#000000FF font=Tizen:style=Regular font_size=30 ellipsis=1.0";
+         tag:  "br" "\n";
+         tag:  "ps" "ps";
+         tag:  "tab" "\t";
+         tag:  "b" "+ font_weight=Bold";
+      }
+   }
+   parts {
+      part { name: "base";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+         }
+      }
+      part { name: "left_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 32 0;
+            align: 0.0 0.0;
+            rel1 { to: "base"; relative: 0.0 0.0; }
+            rel2 { to: "base"; relative: 0.0 1.0; }
+         }
+      }
+      part { name: "right_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 32 0;
+            align: 1.0 0.0;
+            rel1 { to: "base"; relative: 1.0 0.0; }
+            rel2 { to: "base"; relative: 1.0 1.0; }
+         }
+      }
+      part { name: "top_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 24;
+            align: 0.0 0.0;
+            rel1 { to_x: "left_padding"; to_y: "base"; relative: 1.0 0.0; }
+            rel2 { to_x: "right_padding"; to_y: "base"; relative: 0.0 0.0; }
+         }
+      }
+      part { name: "elm.text";
+         type: TEXTBLOCK;
+         scale: 1;
+         mouse_events: 0;
+         description { state: "default" 0.0;
+            min: 0 41;
+            align: 0.0 0.0;
+            rel1 { to: "top_padding"; relative: 0.0 1.0; }
+            rel2 { to: "top_padding"; relative: 1.0 1.0; }
+            text.style: "text_style";
+            text.min: 0 1;
+         }
+      }
+      part { name: "text_content_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 10;
+            align: 0.0 0.0;
+            rel1 { to: "elm.text"; relative: 0.0 1.0; }
+            rel2 { to: "elm.text"; relative: 1.0 1.0; }
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.5 0.0;
+            rel1 { to: "text_content_padding"; relative: 0.0 1.0; }
+            rel2 { to: "bottom_padding"; relative: 1.0 0.0; }
+         }
+      }
+      part { name: "bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 24;
+            align: 0.5 1.0;
+            rel1 { to: "base"; relative: 0.0 1.0; }
+            rel2 { to: "base"; relative: 1.0 1.0; }
+         }
+      }
+   }
+}
diff --git a/test/RADemoTV/edc_resource/label.edc b/test/RADemoTV/edc_resource/label.edc
new file mode 100644 (file)
index 0000000..5d3c9b9
--- /dev/null
@@ -0,0 +1,585 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+#define LABEL_WIDTH 350.0
+#define LABEL_HEIGHT 40.0
+#define LABEL_GAP 100.0
+
+group {
+               name: "label_layout";
+               parts{
+                       part {
+                               name: "top_padding";
+                               type: RECT;
+                               scale: 1; //allow scaling
+                               description {
+                                       state: "default" 0.0;
+                                       min : LABEL_WIDTH 50; //minimum size for gap filler
+                                       fixed: 0 1;
+                                       rel1 { relative: 0 0; }
+                                       rel2 { relative: 1 0; }
+                                       align: 0 0;
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "label1_bg";
+                               type: RECT;
+                               description {
+                                       color: 200 200 200 127;
+                                       rel1.to:"label1";
+                                       rel2.to:"label1";
+                               }
+                       }
+                       part {
+                               name: "label1";
+                               type: SWALLOW;
+                               scale: 1;
+                               description {
+                                       fixed: 1 1;
+                                       min: LABEL_WIDTH LABEL_HEIGHT;
+                                       max: LABEL_WIDTH LABEL_HEIGHT;
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0 1.0; to_y: "top_padding"; }
+                                       align: 0.5 0;
+                                       }
+                       }
+                       part {
+                               name: "label1_bottom_padding";
+                               type: RECT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       min : LABEL_WIDTH LABEL_GAP;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0 1.0; to_y: "label1"; }
+                                       rel2 { relative: 1 1.0; to_y: "label1"; }
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "label2_bg";
+                               type: RECT;
+                               description {
+                                       color: 200 200 200 127;
+                                       rel1.to:"label2";
+                                       rel2.to:"label2";
+                               }
+                       }
+                       part {
+                               name: "label2";
+                               type: SWALLOW;
+                               scale: 1;
+                               description {
+                                       fixed: 1 0;
+                                       min: LABEL_WIDTH LABEL_HEIGHT;
+                                       max: LABEL_WIDTH LABEL_HEIGHT;
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0 1.0; to_y: "label1_bottom_padding"; }
+                                       align: 0.5 0;
+                               }
+                       }
+                       part {
+                               name: "label2_bottom_padding";
+                               type: RECT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       min : 0 LABEL_GAP;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0 1.0; to_y: "label2"; }
+                                       rel2 { relative: 1 1.0; to_y: "label2"; }
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "label3_bg";
+                               type: RECT;
+                               description {
+                                       color: 200 200 200 127;
+                                       rel1.to:"label3";
+                                       rel2.to:"label3";
+                               }
+                       }
+                       part {
+                               name: "label3";
+                               type: SWALLOW;
+                               scale: 1;
+                               description {
+                                       fixed: 1 1;
+                                       min: LABEL_WIDTH LABEL_HEIGHT;
+                                       max: LABEL_WIDTH LABEL_HEIGHT;
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0 1.0; to_y: "label2_bottom_padding"; }
+                                       align: 0.5 0;
+                               }
+                       }
+                       part {
+                               name: "label3_bottom_padding";
+                               type: RECT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       min : 0 LABEL_GAP;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0 1.0; to_y: "label3"; }
+                                       rel2 { relative: 1 1.0; to_y: "label3"; }
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "label4_bg";
+                               type: RECT;
+                               description {
+                                       color: 200 200 200 127;
+                                       rel1.to:"label4";
+                                       rel2.to:"label4";
+                               }
+                       }
+                       part {
+                               name: "label4";
+                               type: SWALLOW;
+                               scale: 1;
+                               description {
+                                       fixed: 1 1;
+                                       min: LABEL_WIDTH LABEL_HEIGHT;
+                                       max: LABEL_WIDTH LABEL_HEIGHT;
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0 1.0; to_y: "label3_bottom_padding"; }
+                                       align: 0.5 0;
+                               }
+                       }
+                       part {
+                               name: "label4_bottom_padding";
+                               type: RECT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       min : 0 LABEL_GAP;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0 1.0; to_y: "label4"; }
+                                       rel2 { relative: 1 1.0; to_y: "label4"; }
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "label5_bg";
+                               type: RECT;
+                               description {
+                                       color: 200 200 200 127;
+                                       rel1.to:"label5";
+                                       rel2.to:"label5";
+                               }
+                       }
+                       part {
+                               name: "label5";
+                               type: SWALLOW;
+                               scale: 1;
+                               description {
+                                       fixed: 1 1;
+                                       min: LABEL_WIDTH LABEL_HEIGHT;
+                                       max: LABEL_WIDTH LABEL_HEIGHT;
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0 1.0; to_y: "label4_bottom_padding"; }
+                                       align: 0.5 0;
+                               }
+                       }
+                       part {
+                               name: "label5_bottom_padding";
+                               type: RECT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       min : 0 30;
+                                       rel1 { relative: 0 1.0; to_y: "label5"; }
+                                       rel2 { relative: 1 1.0; }
+                                       visible: 0;
+                                       align: 0.5 1.0;
+                               }
+                       }
+               }//end parts
+#undef LABEL_WIDTH
+#undef LABEL_HEIGHT
+#undef LABEL_GAP
+} //end group
+
+       group {
+               name, "label_slide_layout";
+               parts {
+                       part { name, "background";
+                               type: RECT;
+                               description {
+                                       state: "default" 0.0;
+                                       min : 0 100;
+                                       fixed: 0 1;
+                                       align: 0 0;
+                                       rel1 { relative: 0 0; }
+                                       rel2 { relative: 1 0; }
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "top_padding";
+                               type: RECT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 0 80;
+                                       fixed: 0 1;
+                                       align: 0 0;
+                                       rel1 { relative: 0.15 0.0; to_y: "background"; }
+                                       rel2 { relative: 0.85 0.0; to_y: "background"; }
+                                       visible: 0;
+                               }
+                       }
+                       part { name: "slide_long_text";
+                               type: TEXT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 0.35; to: "top_padding";}
+                                       rel2 { relative: 1.0 1.0; to: "top_padding";}
+                                       text {
+                                               font: "Tizen:style=Regular";
+                                               size: 24;
+                                               text:"Slide Long (10 sec)";
+                                               min: 1 1 ;
+                                               align: 0.0 0.0;
+                                               ellipsis: -1;
+                                       }
+                                       align: 0.5 0;
+                                       color: 173 170 165 255;
+                               }
+                       }
+                       part { name: "swallow_label_1_bg";
+                               type: RECT;
+                               description { state: "default" 0.0;
+                                       color: 200 200 200 127;
+                                       rel1.to: "swallow_label_1";
+                                       rel2.to: "swallow_label_1";
+                               }
+                       }
+                       part { name: "swallow_label_1";
+                               type: SWALLOW;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 330 40;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.15 1.0; to_y: "top_padding"; }
+                                       rel2 { relative: 0.85 1.0; to_y: "top_padding"; }
+                                       align: 0.0 0.0;
+                                       visible: 1;
+                               }
+                       }
+                       part {
+                               name: "padding1";
+                               type: RECT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 0 80;
+                                       fixed: 0 1;
+                                       align: 0 0;
+                                       rel1 { relative: 0 1.0; to: "swallow_label_1"; }
+                                       rel2 { relative: 1 1.0; to: "swallow_label_1"; }
+                                       visible: 0;
+                               }
+                       }
+                       part { name: "slide_long1_text";
+                               type: TEXT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 0.35; to: "padding1";}
+                                       rel2 { relative: 1.0 1.0; to: "padding1";}
+                                       text {
+                                               font: "Tizen:style=Regular";
+                                               size: 24;
+                                               text: "Slide Long (5 sec)";
+                                               min: 1 1 ;
+                                               align: 0.0 0.0;
+                                               ellipsis: -1;
+                                       }
+                                       color: 173 170 165 255;
+                                       align: 0.5 0;
+                               }
+                       }
+                       part { name: "swallow_label_2_bg";
+                               type: RECT;
+                               description { state: "default" 0.0;
+                                       color: 200 200 200 127;
+                                       rel1.to: "swallow_label_2";
+                                       rel2.to: "swallow_label_2";
+                               }
+                       }
+                       part { name: "swallow_label_2";
+                               type: SWALLOW;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 330 40;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.15 1.0; to_y: "padding1"; }
+                                       rel2 { relative: 0.85 1.0; to_y: "padding1"; }
+                                       align: 0.0 0.0;
+                                       visible: 1;
+                               }
+                       }
+                       part {
+                               name: "padding2";
+                               type: RECT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 0 80;
+                                       fixed: 0 1;
+                                       align: 0 0;
+                                       rel1 { relative: 0 1.0; to: "swallow_label_2"; }
+                                       rel2 { relative: 1 1.0; to: "swallow_label_2"; }
+                                       visible: 0;
+                               }
+                       }
+                       part { name: "slide_short_text";
+                               type: TEXT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 0.35; to: "padding2";}
+                                       rel2 { relative: 1.0 1.0; to: "padding2";}
+                                       text {
+                                               font: "Tizen:style=Regular";
+                                               size: 24;
+                                               text: "Slide Short";
+                                               min: 1 1 ;
+                                               align: 0.0 0.0;
+                                               ellipsis: -1;
+                                       }
+                                       color: 173 170 165 255;
+                                       align: 0.5 0;
+                               }
+                       }
+                       part { name: "swallow_label_3_bg";
+                               type: RECT;
+                               description { state: "default" 0.0;
+                                       color: 200 200 200 127;
+                                       rel1.to: "swallow_label_3";
+                                       rel2.to: "swallow_label_3";
+                               }
+                       }
+                       part { name: "swallow_label_3";
+                               type: SWALLOW;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 330 40;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.15 1.0; to_y: "padding2"; }
+                                       rel2 { relative: 0.85 1.0; to_y: "padding2"; }
+                                       align: 0.0 0.0;
+                                       visible: 1;
+                               }
+                       }
+                       part {
+                               name: "padding3";
+                               type: RECT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 0 80;
+                                       fixed: 0 1;
+                                       align: 0 0;
+                                       rel1 { relative: 0 1.0; to: "swallow_label_3"; }
+                                       rel2 { relative: 1 1.0; to: "swallow_label_3"; }
+                                       visible: 0;
+                               }
+                       }
+                       part { name: "slide_bounce_text";
+                               type: TEXT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 0.35; to: "padding3";}
+                                       rel2 { relative: 1.0 1.0; to: "padding3";}
+                                       text {
+                                               font: "Tizen:style=Regular";
+                                               size: 24;
+                                               text: "Slide Bounce";
+                                               min: 1 1 ;
+                                               align: 0.0 0.0;
+                                               ellipsis: -1;
+                                       }
+                                       color: 173 170 165 255;
+                                       align: 0.5 0;
+                               }
+                       }
+                       part { name: "swallow_label_4_bg";
+                               type: RECT;
+                               description { state: "default" 0.0;
+                                       color: 200 200 200 127;
+                                       rel1.to: "swallow_label_4";
+                                       rel2.to: "swallow_label_4";
+                               }
+                       }
+                       part { name: "swallow_label_4";
+                               type: SWALLOW;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 330 40;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.15 1.0; to_y: "padding3"; }
+                                       rel2 { relative: 0.85 1.0; to_y: "padding3"; }
+                                       align: 0.0 0.0;
+                                       visible: 1;
+                               }
+                       }
+                       part {
+                               name: "padding4";
+                               type: RECT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 0 80;
+                                       fixed: 0 1;
+                                       align: 0 0;
+                                       rel1 { relative: 0 1.0; to: "swallow_label_4"; }
+                                       rel2 { relative: 1 1.0; to: "swallow_label_4"; }
+                                       visible: 0;
+                               }
+                       }
+                       part { name: "slide_roll_text";
+                               type: TEXT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 0.35; to: "padding4";}
+                                       rel2 { relative: 1.0 1.0; to: "padding4";}
+                                       text {
+                                               font: "Tizen:style=Regular";
+                                               size: 24;
+                                               text: "Slide Roll Short";
+                                               min: 1 1 ;
+                                               align: 0.0 0.0;
+                                               ellipsis: -1;
+                                       }
+                                       color: 173 170 165 255;
+                                       align: 0.5 0;
+                               }
+                       }
+                       part { name: "swallow_label_5_bg";
+                               type: RECT;
+                               description { state: "default" 0.0;
+                                       color: 200 200 200 127;
+                                       rel1.to: "swallow_label_5";
+                                       rel2.to: "swallow_label_5";
+                               }
+                       }
+                       part { name: "swallow_label_5";
+                               type: SWALLOW;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 330 40;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.15 1.0; to_y: "padding4"; }
+                                       rel2 { relative: 0.85 1.0; to_y: "padding4"; }
+                                       align: 0.0 0.0;
+                                       visible: 1;
+                               }
+                       }
+                       part {
+                               name: "padding5";
+                               type: RECT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 0 80;
+                                       fixed: 0 1;
+                                       align: 0 0;
+                                       rel1 { relative: 0 1.0; to: "swallow_label_5"; }
+                                       rel2 { relative: 1 1.0; to: "swallow_label_5"; }
+                                       visible: 0;
+                               }
+                       }
+                       part { name: "slide_roll1_text";
+                               type: TEXT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 0.35; to: "padding5";}
+                                       rel2 { relative: 1.0 1.0; to: "padding5";}
+                                       text {
+                                               font: "Tizen:style=Regular";
+                                               size: 24;
+                                               text: "Slide Roll Long";
+                                               min: 1 1 ;
+                                               align: 0.0 0.0;
+                                               ellipsis: -1;
+                                       }
+                                       color: 173 170 165 255;
+                                       align: 0.5 0;
+                               }
+                       }
+                       part { name: "swallow_label_6_bg";
+                               type: RECT;
+                               description { state: "default" 0.0;
+                                       color: 200 200 200 127;
+                                       rel1.to: "swallow_label_6";
+                                       rel2.to: "swallow_label_6";
+                               }
+                       }
+                       part { name: "swallow_label_6";
+                               type: SWALLOW;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 330 40;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.15 1.0; to_y: "padding5"; }
+                                       rel2 { relative: 0.85 1.0; to_y: "padding5"; }
+                                       align: 0.0 0.0;
+                                       visible: 1;
+                               }
+                       }
+                       part {
+                               name: "padding6";
+                               type: RECT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 0 80;
+                                       fixed: 0 1;
+                                       align: 0 0;
+                                       rel1 { relative: 0 1.0; to: "swallow_label_6"; }
+                                       rel2 { relative: 1 1.0; to: "swallow_label_6"; }
+                                       visible: 0;
+                               }
+                       }
+                       part { name: "swallow_btn";
+                               type: SWALLOW;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 330 40;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0 1.0; to: "padding6"; }
+                                       rel2 { relative: 1 1.0; to: "padding6"; }
+                                       align: 0.0 0.0;
+                                       visible: 1;
+                               }
+                       }
+                       part {
+                               name: "padding7";
+                               type: RECT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 0 30;
+                                       align: 0 1;
+                                       rel1 { relative: 0 1.0; to: "swallow_btn"; }
+                                       rel2 { relative: 1 1.0; }
+                                       visible: 0;
+                               }
+                       }
+               }
+       }
diff --git a/test/RADemoTV/edc_resource/layout.edc b/test/RADemoTV/edc_resource/layout.edc
new file mode 100644 (file)
index 0000000..9e724bd
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "white_bg_layout";
+   parts {
+      part { name: "base";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            color: 250 250 250 255;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+         }
+      }
+   }
+}
+
+group { name: "button_layout_1";
+   parts {
+      part { name: "base";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 300 78;
+            color: 0 0 0 0;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.to: "base";
+            rel2.to: "base";
+         }
+      }
+   }
+}
+
+group { name: "button_layout_2";
+   parts {
+      part { name: "base";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 500 78;
+            color: 0 0 0 0;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.to: "base";
+            rel2.to: "base";
+         }
+      }
+   }
+}
+
+group { name: "check_layout";
+   parts {
+      part { name: "base";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 300 78;
+            color: 0 0 0 0;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.to: "base";
+            rel2.to: "base";
+         }
+      }
+   }
+}
+
diff --git a/test/RADemoTV/edc_resource/pagecontrol.edc b/test/RADemoTV/edc_resource/pagecontrol.edc
new file mode 100644 (file)
index 0000000..6b5f648
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "pagecontrol_layout";
+   parts {
+      part { name: "bg";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            color: 0 0 0 255;
+         }
+      }
+      part { name: "scroller";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1 {
+               relative: 0.0 0.0;
+               to: "bg";
+            }
+            rel2 {
+               relative: 1.0 1.0;
+               to: "bg";
+            }
+            align: 0.5 0.5;
+         }
+      }
+      part { name: "controller";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 52;
+            fixed: 0 1;
+            align: 0.5 1.0;
+            rel1.relative: 0.0 1.0;
+            rel2.relative: 1.0 1.0;
+         }
+      }
+   }
+}
+
+group { name: "pagecontrol_page_layout";
+   parts {
+      part { name: "page";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+         }
+      }
+      part { name: "text";
+         type: TEXT;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            rel1.relative: 0.5 0.5;
+            rel2.relative: 0.5 0.5;
+            text {
+               min: 1 1;
+               size: 50;
+               ellipsis: -1;
+            }
+         }
+      }
+   }
+}
diff --git a/test/RADemoTV/edc_resource/popup_custom.edc b/test/RADemoTV/edc_resource/popup_custom.edc
new file mode 100644 (file)
index 0000000..0b5d5b9
--- /dev/null
@@ -0,0 +1,1047 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+#define POPUP_CONTENT_DEFAULT_PADDING_TOP_MIN_INC 27
+#define POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 15
+#define POPUP_CONTENT_DEFAULT_PADDING_RIGHT_MIN_INC 15
+#define POPUP_CONTENT_DEFAULT_PADDING_BOTTOM_MIN_INC 27
+#define POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC 96
+
+#define POPUP_IMAGE_VIEW_LAYOUT_BG_MIN_INC 0 112
+#define POPUP_IMAGE_SWALLOW_CONTENT_PADDING_BOTTOM_MIN_INC 0 20
+#define POPUP_DESCRIPTION_DEFAULT_TEXT_FONT_SIZE_INC 38
+#define POPUP_CHECK_VIEW_LAYOUT_CONTENT_MIN_INC 0 162
+#define POPUP_CHECK_VIEW_LAYOUT_BOTTOM_MIN_INC 0 90
+#define POPUP_CHECK_VIEW_SWALLOW_END_MIN_INC 50 50
+#define POPUP_CHECK_VIEW_LAYOUT_MIN_INC 0 252
+
+#define POPUP_TEXT_INPUTTEXT_VIEW_LAYOUT_BG_MIN_INC 480 159
+
+#define POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC 15 27
+#define POPUP_PROGRESSBAR_VIEW_LAYOUT_TEXT_FONT_SIZE_INC 0 38
+#define POPUP_PROGRESSBAR_VIEW_LAYOUT_BG_INC 0 69
+#define POPUP_PROGRESSBAR_VIEW_LAYOUT_BG_MIN_INC 0 161
+
+#define POPUP_PROGRESSBAR_2TEXT_VIEW_LAYOUT_BG_MIN_INC 0 193
+#define POPUP_PROGRESSBAR_VIEW_LAYOUT_SUBTEXT_FONT_SIZE_INC 0 32
+
+#define POPUP_GROUP_INDEX_BG_MIN_INC 0 52
+#define POPUP_GROUP_INDEX_PROCESSING_MIN_INC 28 28
+#define POPUP_GROUP_INDEX_PROCESSING_MAX_INC 28 28
+#define POPUP_GROUP_INDEX_PADDING_BEFORE_SWALLOW_MIN_INC 15 52
+#define POPUP_GROUP_INDEX_TEXT_MIN_INC 0 52
+
+#define POPUP_TEXT_SLIDER_VIEW_LAYOUT_MIN_INC 0 144
+#define POPUP_TEXT_SLIDER_PADDING_SIZE_INC 15 27
+#define POPUP_TEXT_SLIDER_TEXT_DISCRIPTION_MIN_INC 0 38
+#define POPUP_TEXT_SLIDER_BG_MIN_INC 0 42
+#define POPUP_SLIDER_PADDING_LEFT_MIN_INC 10 0
+
+#define POPUP_2TEXT_SLIDER_VIEW_LAYOUT_MIN_INC 0 176
+#define POPUP_TEXT_SLIDER_SUBTEXT_DISCRIPTION_MIN_INC 0 32
+
+#define POPUP_SCROLLABLE_TEXT_VIEW_BG_HEIGHT_INC 252
+
+#define POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MIN_INC 36 36
+#define POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MAX_INC 36 36
+#define POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_PADDING_AFTER_INC 15 90
+#define POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_TEXT_MIN_INC 0 90
+#define POPUP_PROCESSING_VIEW_LAYOUT_BG_MIN_INC 0 90
+
+#define POPUP_TEXT_FONT_SIZE1 30
+#define POPUP_TEXT_FONT_SIZE2 24
+#define POPUP_TEXT_FONT_SIZE3 27
+
+group { name: "popup_image_list_layout";
+   styles {
+      style { name: "popup_content_style";
+         base: "font=Tizen:style=Regular align=left font_size="POPUP_TEXT_FONT_SIZE1" color=#000000 wrap=mixed ellipsis=1.0 text_class=tizen";
+         tag: "br" "\n";
+         tag: "tab" "\t";
+      }
+   }
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_IMAGE_VIEW_LAYOUT_BG_MIN_INC;
+            fixed: 1 0;
+         }
+      }
+      part { name: "pad_l";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 0.0 0.0;
+            rel2.relative: 0.0 1.0;
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 1.0 0.0;
+            rel2.relative: 1.0 1.0;
+            align: 1.0 0.0;
+         }
+      }
+      part { name: "pad_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.0;
+            min: 0 POPUP_CONTENT_DEFAULT_PADDING_TOP_MIN_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 1.0 0.0;to_x: "pad_l";
+            }
+            rel2 {
+               relative: 0.0 0.0;to_x: "pad_r";
+            }
+         }
+      }
+      part { name: "content_bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 0;
+            rel1 {
+               relative: 1.0 1.0;
+               to_x: "pad_l";
+               to_y: "pad_t";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to_x: "pad_r";
+               to_y: "pad_b";
+            }
+            align: 0.5 0.5;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 0;
+            rel1.to: "content_bg";
+            rel2.to: "content_bg";
+         }
+      }
+      part { name: "pad_b";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_IMAGE_SWALLOW_CONTENT_PADDING_BOTTOM_MIN_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 1.0 0.0;
+               to_x: "pad_l";
+               to_y: "elm.text";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to_x: "pad_r";
+               to_y: "elm.text";
+            }
+            align: 0.0 1.0;
+         }
+      }
+      part { name: "elm.text";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 POPUP_DESCRIPTION_DEFAULT_TEXT_FONT_SIZE_INC;
+            fixed: 0 1;
+            align: 0.0 1.0;
+            rel1 {
+               relative: 1.0 0.0;
+               to_x: "pad_l";
+               to_y: "pad_bottom";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to_x: "pad_r";
+               to_y: "pad_bottom";
+            }
+            text {
+               style: "popup_content_style";
+               min: 0 1;
+            }
+            color: 0 0 0 255;
+         }
+      }
+      part { name: "pad_bottom";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 1.0;
+            min: 0 POPUP_CONTENT_DEFAULT_PADDING_BOTTOM_MIN_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 1.0 1.0;
+               to_x: "pad_l";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r";
+            }
+         }
+      }
+   }
+}
+
+group { name: "popup_checkview_layout";
+   parts {
+      part { name: "bg";
+         scale: 1;
+         type: SPACER;
+         description { state: "default" 0.0;
+            min: POPUP_CHECK_VIEW_LAYOUT_MIN_INC;
+            fixed: 1 0;
+         }
+      }
+      part { name: "pad_l";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 0.0 0.0;
+            rel2.relative: 0.0 1.0;
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_RIGHT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 1.0 0.0;
+            rel2.relative: 1.0 1.0;
+            align: 1.0 0.0;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            min: POPUP_CHECK_VIEW_LAYOUT_CONTENT_MIN_INC;
+            align: 0.5 0.0;
+            rel2 {
+               relative: 1.0 0.0;
+               to: "pad_b";
+            }
+         }
+      }
+      part { name: "pad_b";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 1.0;
+            min: POPUP_CHECK_VIEW_LAYOUT_BOTTOM_MIN_INC;
+            fixed: 0 1;
+            rel1.relative: 0.0 1.0;
+         }
+      }
+      part { name: "elm.swallow.end";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.5;
+            min: POPUP_CHECK_VIEW_SWALLOW_END_MIN_INC;
+            fixed: 1 1;
+            rel1 {
+               relative: 1.0 1.0;
+               to_x: "pad_l";
+               to_y: "pad_b";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to_x: "pad_r";
+               to_y: "pad_b";
+            }
+         }
+      }
+   }
+}
+
+group { name: "processing_view_layout";
+   styles {
+      style { name: "popup_processing_style";
+         base: "font=Tizen:style=Regular align=left font_size="POPUP_TEXT_FONT_SIZE1" color=#000000 wrap=mixed ellipsis=1.0 text_class=tizen";
+         tag:  "br" "\n";
+         tag:  "tab" "\t";
+      }
+   }
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROCESSING_VIEW_LAYOUT_BG_MIN_INC;
+            fixed: 1 0;
+         }
+      }
+      part { name: "pad_l";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 0.0 0.0;
+            rel2.relative: 0.0 1.0;
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 1.0 0.0;
+            rel2.relative: 1.0 1.0;
+            align: 1.0 0.0;
+         }
+      }
+      part { name: "processing";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            min: POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MIN_INC;
+            max: POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MAX_INC;
+            rel1 {
+               relative: 1.0 0.0;
+               to_x: "pad_l";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r";
+            }
+            align: 0.0 0.5;
+         }
+      }
+      part { name: "pad_after_processing";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            min: POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_PADDING_AFTER_INC;
+            rel1 {
+               relative: 1.0 0.0;
+               to: "processing";
+            }
+            rel2.to: "processing";
+            align: 0.0 0.5;
+         }
+      }
+      part { name: "elm.text";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_TEXT_MIN_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 1.0 0.0;
+               to: "pad_after_processing";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r";
+            }
+            align: 0.0 0.5;
+            text {
+               style: "popup_processing_style";
+               min: 0 1;
+            }
+         }
+      }
+   }
+}
+
+group { name: "popup_text_progressbar_view_layout";
+   styles {
+      style { name: "popup_progress_style";
+         base: "font=Tizen:style=Regular align=right font_size="14" color=#000000 wrap=mixed ellipsis=1.0 text_class=tizen";
+         tag:  "br" "\n";
+         tag:  "tab" "\t";
+      }
+   }
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_BG_MIN_INC;
+            fixed: 1 0;
+         }
+      }
+      part { name: "pad_l_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC;
+            max: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC;
+            fixed: 1 1;
+            rel2.relative: 0.0 0.0;
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC;
+            max: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC;
+            fixed: 1 1;
+            rel1.relative: 1.0 1.0;
+            align: 1.0 1.0;
+         }
+      }
+      part { name: "elm.text.description";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_TEXT_FONT_SIZE_INC;
+            rel1 {
+               relative: 1.0 1.0;
+               to: "pad_l_t";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_t";
+               to_y: "pad_l_t";
+            }
+            text {
+               style: "popup_processing_style";
+               min: 0 1;
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "progressbar_bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_BG_INC;
+            rel1 {
+               relative: 1.0 1.0;
+               to_x: "pad_l_t";
+               to_y: "elm.text.description";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_t";
+               to_y: "elm.text.description";
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "progressbar";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            rel1.to: "progressbar_bg";
+            rel2.to: "progressbar_bg";
+         }
+      }
+   }
+}
+
+group { name: "popup_2text_progressbar_view_layout";
+   styles {
+      style { name: "popup_subtext_style";
+         base: "font=Tizen:style=Regular align=left font_size="POPUP_TEXT_FONT_SIZE2" color=#000000 wrap=mixed ellipsis=1.0 text_class=tizen";
+         tag:  "br" "\n";
+         tag:  "tab" "\t";
+      }
+   }
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROGRESSBAR_2TEXT_VIEW_LAYOUT_BG_MIN_INC;
+            fixed: 1 0;
+         }
+      }
+      part { name: "pad_l_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC;
+            max: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC;
+            fixed: 1 1;
+            rel2.relative: 0.0 0.0;
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC;
+            max: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC;
+            fixed: 1 1;
+            rel1.relative: 1.0 1.0;
+            align: 1.0 1.0;
+         }
+      }
+      part { name: "elm.text.description";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_TEXT_FONT_SIZE_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 1.0 1.0;
+               to: "pad_l_t";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_t";
+               to_y: "pad_l_t";
+            }
+            text {
+               style: "popup_processing_style";
+               min: 0 1;
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "elm.subtext.description";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_SUBTEXT_FONT_SIZE_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 1.0 1.0;
+               to_x: "pad_l_t";
+               to_y: "elm.text.description";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_t";
+               to_y: "elm.text.description";
+            }
+            text {
+               style: "popup_subtext_style";
+               min: 0 1;
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "progressbar_bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_BG_INC;
+            rel1 {
+               relative: 1.0 1.0;
+               to_x: "pad_l_t";
+               to_y: "elm.subtext.description";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_t";
+               to_y: "elm.subtext.description";
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "progressbar";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            rel1.to: "progressbar_bg";
+            rel2.to: "progressbar_bg";
+         }
+      }
+   }
+}
+
+group { name: "popup_groupindex_view_layout";
+   styles {
+      style { name: "popup_groupindex_style";
+         base: "font=Tizen:style=Regular align=right font_size="POPUP_TEXT_FONT_SIZE3" color=#000000 wrap=mixed ellipsis=1.0 text_class=tizen";
+         tag:  "br" "\n";
+         tag:  "tab" "\t";
+      }
+   }
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+         }
+      }
+      part { name: "pad_l";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 0.0 0.0;
+            rel2.relative: 0.0 1.0;
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_RIGHT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 1.0 0.0;
+            rel2.relative: 1.0 1.0;
+            align: 1.0 0.0;
+         }
+      }
+      part { name: "index_bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_GROUP_INDEX_BG_MIN_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 1.0 0.0;
+               to: "pad_l";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to: "pad_r";
+            }
+            align: 0.5 0.0;
+         }
+      }
+      part { name: "processing";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_GROUP_INDEX_PROCESSING_MIN_INC;
+            max: POPUP_GROUP_INDEX_PROCESSING_MAX_INC;
+            rel1 {
+               relative: 1.0 0.0;
+               to: "index_bg";
+            }
+            rel2.to: "index_bg";
+            align: 1.0 0.5;
+         }
+      }
+      part { name: "pad_before_swallow";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_GROUP_INDEX_PADDING_BEFORE_SWALLOW_MIN_INC;
+            rel1 {
+               relative: 0.0 0.0;
+               to: "processing";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to: "processing";
+            }
+            align: 1.0 0.5;
+         }
+      }
+      part { name: "elm.text";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_GROUP_INDEX_TEXT_MIN_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 0.0 0.0;
+               to: "index_bg";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_before_swallow";
+               to_y: "index_bg";
+            }
+            align: 0.5 0.0;
+            text {
+               style: "popup_groupindex_style";
+               min: 0 1;
+            }
+         }
+      }
+      part { name: "genlist";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "index_bg";
+            }
+            align: 0.5 0.0;
+         }
+      }
+   }
+}
+
+group { name: "popup_text_slider_view_layout";
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_TEXT_SLIDER_VIEW_LAYOUT_MIN_INC;
+            fixed: 1 0;
+         }
+      }
+      part { name: "pad_l_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_TEXT_SLIDER_PADDING_SIZE_INC;
+            max: POPUP_TEXT_SLIDER_PADDING_SIZE_INC;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.0 0.0;
+            }
+            rel2 {
+               relative: 0.0 0.0;
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_TEXT_SLIDER_PADDING_SIZE_INC;
+            max: POPUP_TEXT_SLIDER_PADDING_SIZE_INC;
+            fixed: 1 1;
+            rel1.relative: 1.0 1.0;
+            rel2.relative: 1.0 1.0;
+            align: 1.0 1.0;
+         }
+      }
+      part { name: "elm.text.description";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            min: POPUP_TEXT_SLIDER_TEXT_DISCRIPTION_MIN_INC;
+            rel1 {
+               relative: 1.0 1.0;
+               to: "pad_l_t";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_t";
+               to_y: "pad_l_t";
+            }
+            text {
+               style: "popup_processing_style";
+               min: 0 1;
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "slider";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            min: POPUP_TEXT_SLIDER_BG_MIN_INC;
+            rel1 {
+               relative: 1.0 0.0;
+               to_y: "pad_r_t";
+               to_x: "pad_l_t";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to: "pad_r_t";
+            }
+            align: 0.0 1.0;
+         }
+      }
+   }
+}
+
+group { name: "popup_2text_slider_view_layout";
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_2TEXT_SLIDER_VIEW_LAYOUT_MIN_INC;
+            fixed: 1 0;
+         }
+      }
+      part { name: "pad_l_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_TEXT_SLIDER_PADDING_SIZE_INC;
+            max: POPUP_TEXT_SLIDER_PADDING_SIZE_INC;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.0 0.0;
+            }
+            rel2 {
+               relative: 0.0 0.0;
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_TEXT_SLIDER_PADDING_SIZE_INC;
+            max: POPUP_TEXT_SLIDER_PADDING_SIZE_INC;
+            fixed: 1 1;
+            rel1.relative: 1.0 1.0;
+            rel2.relative: 1.0 1.0;
+            align: 1.0 1.0;
+         }
+      }
+      part { name: "elm.text.description";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            min: POPUP_TEXT_SLIDER_TEXT_DISCRIPTION_MIN_INC;
+            rel1 {
+               relative: 1.0 1.0;
+               to: "pad_l_t";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_t";
+               to_y: "pad_l_t";
+            }
+            text {
+               style: "popup_processing_style";
+               min: 0 1;
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "elm.subtext.description";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_TEXT_SLIDER_SUBTEXT_DISCRIPTION_MIN_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 1.0 1.0;
+               to_x: "pad_l_t";
+               to_y: "elm.text.description";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_t";
+               to_y: "elm.text.description";
+            }
+            text {
+               style: "popup_subtext_style";
+               min: 0 1;
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "slider";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            min: POPUP_TEXT_SLIDER_BG_MIN_INC;
+            rel1 {
+               relative: 1.0 0.0;
+               to_y: "pad_r_t";
+               to_x: "pad_l_t";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to: "pad_r_t";
+            }
+            align: 0.0 1.0;
+         }
+      }
+   }
+}
+
+group { name: "popup_scrollable_text";
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 POPUP_SCROLLABLE_TEXT_VIEW_BG_HEIGHT_INC;
+            max: -1 POPUP_SCROLLABLE_TEXT_VIEW_BG_HEIGHT_INC;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+         }
+      }
+   }
+}
+
+group { name: "popup_input_text";
+   parts {
+      part { name: "pad_l";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 0.0 0.0;
+            rel2.relative: 0.0 1.0;
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 1.0 0.0;
+            rel2.relative: 1.0 1.0;
+            align: 1.0 0.0;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC;
+            max: -1 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC;
+            align: 0.5 0.5;
+            rel1{
+               relative: 1.0 0.0 ;
+               to_x: "pad_l";
+            }
+            rel2{
+               relative: 0.0 1.0;
+               to_x: "pad_r";
+            }
+         }
+      }
+   }
+}
+
+group { name: "popup_text_input_text";
+   styles {
+      style { name: "popup_input_style";
+         base: "font=Tizen:style=Regular align=left font_size="POPUP_TEXT_FONT_SIZE1" color=#000000 wrap=mixed text_class=tizen";
+         tag:  "br" "\n";
+         tag:  "tab" "\t";
+      }
+   }
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_TEXT_INPUTTEXT_VIEW_LAYOUT_BG_MIN_INC;
+         }
+      }
+      part { name: "pad_l_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC POPUP_CONTENT_DEFAULT_PADDING_TOP_MIN_INC;
+            max: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC POPUP_CONTENT_DEFAULT_PADDING_TOP_MIN_INC;
+            fixed: 1 1;
+            rel1.to: "bg";
+            rel2 {
+               relative: 0.0 0.0;
+               to: "bg";
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r_b";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_RIGHT_MIN_INC POPUP_CONTENT_DEFAULT_PADDING_TOP_MIN_INC;
+            max: POPUP_CONTENT_DEFAULT_PADDING_RIGHT_MIN_INC POPUP_CONTENT_DEFAULT_PADDING_TOP_MIN_INC;
+            fixed: 1 1;
+            rel1 {
+               relative: 1.0 1.0;
+               to: "bg";
+            }
+            rel2.to: "bg";
+            align: 1.0 1.0;
+         }
+      }
+      part { name: "elm.text.description";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 POPUP_DESCRIPTION_DEFAULT_TEXT_FONT_SIZE_INC;
+            rel1 {
+               relative: 1.0 1.0;
+               to: "pad_l_t";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to_x: "pad_r_b";
+               to_y: "elm.swallow.content";
+            }
+            text {
+               style: "popup_input_style";
+               min: 0 1;
+            }
+            align: 0.5 0.0;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC;
+            max: -1 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC;
+            fixed: 0 1;
+            align: 0.0 1.0;
+            rel1{
+               relative: 1.0 0.0 ;
+               to_x: "pad_l_t";
+               to_y: "pad_r_b";
+            }
+            rel2{
+               relative: 0.0 0.0;
+               to: "pad_r_b";
+            }
+         }
+      }
+   }
+}
diff --git a/test/RADemoTV/edc_resource/progressbar.edc b/test/RADemoTV/edc_resource/progressbar.edc
new file mode 100644 (file)
index 0000000..d3b5428
--- /dev/null
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "progessbar_layout";
+   parts {
+      part { name: "bg";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            color: 0 0 0 0;
+         }
+      }
+      part { name: "top_padding";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            visible: 0;
+            min: 0 30;
+            max: -1 30;
+            fixed: 0 1;
+            rel1 {
+               relative: 0.5 0.0;
+               to_y: "bg";
+            }
+            rel2 {
+               relative: 0.5 0.0;
+               to_y: "bg";
+            }
+            align: 0.5 0.0;
+         }
+      }
+      part { name: "left_padding";
+          type: RECT;
+          scale: 1;
+          description { state: "default" 0.0;
+             min: 10 0;
+             fixed: 1 0;
+             rel1.relative: 0.0 0.0;
+             rel1.to_x: "bg";
+             rel2.relative: 0.0 1.0;
+             align: 0.0 0.5;
+             color: 0 0 0 0;
+          }
+        }
+        part { name: "right_padding";
+           type: RECT;
+           scale: 1;
+           description { state: "default" 0.0;
+              min: 10 0;
+              fixed: 1 0;
+              rel1.relative: 1.0 0.0;
+              rel2.to_x: "bg";
+              rel2.relative: 1.0 1.0;
+              align: 1.0 0.5;
+              color: 0 0 0 0;
+           }
+        }
+        part { name: "list_progress";
+           type: SWALLOW;
+           scale: 1;
+           description { state: "default" 0.0;
+              fixed: 0 1;
+              rel1 { relative: 1.0 1.0; to_x: "left_padding"; to_y: "top_padding"; }
+              rel2 { relative: 0.0 1.0; to_x: "right_padding"; to_y: "top_padding"; }
+              align: 0.5 0;
+           }
+        }
+        part { name: "top_padding1";
+           type: RECT;
+           scale: 1;
+           description { state: "default" 0.0;
+              visible: 0;
+              min: 10 30;
+              max: 10 30;
+              fixed: 1 1;
+              rel1.relative: 0.5 1.0;
+              rel2.relative: 0.5 1.0;
+              rel1.to_y:"list_progress";
+              rel2.to_y:"list_progress";
+              align: 0.5 0.0;
+           }
+        }
+        part { name: "pending_list";
+           type: SWALLOW;
+           scale: 1;
+           description { state: "default" 0.0;
+              fixed: 0 1;
+              rel1 { relative: 1.0 1.0; to_x: "left_padding"; to_y: "top_padding1"; }
+              rel2 { relative: 0.0 1.0; to_x: "right_padding"; to_y: "top_padding1"; }
+              align: 0.5 0;
+           }
+        }
+        part { name: "top_padding2";
+           type: RECT;
+           scale: 1;
+           description { state: "default" 0.0;
+              visible: 0;
+              min: 10 30;
+              max: 10 30;
+              fixed: 1 1;
+              rel1.relative: 0.5 1.0;
+              rel2.relative: 0.5 1.0;
+              rel1.to_y:"pending_list";
+              rel2.to_y:"pending_list";
+              align: 0.5 0.0;
+           }
+        }
+        part { name: "process_large";
+           type: SWALLOW;
+           scale: 1;
+           description { state: "default" 0.0;
+              fixed: 0 1;
+              rel1 { relative: 1.0 1.0; to_x: "left_padding"; to_y: "top_padding2"; }
+              rel2 { relative: 0.0 1.0; to_x: "right_padding"; to_y: "top_padding2"; }
+              align: 0.5 0;
+           }
+        }
+        part { name: "top_padding3";
+           type: RECT;
+           scale: 1;
+           description { state: "default" 0.0;
+              visible: 0;
+              min: 10 30;
+              max: 10 30;
+              fixed: 1 1;
+              rel1.relative: 0.5 1.0;
+              rel2.relative: 0.5 1.0;
+              rel1.to_y:"process_large";
+              rel2.to_y:"process_large";
+              align: 0.5 0.0;
+           }
+        }
+        part { name: "process_medium";
+           type: SWALLOW;
+           scale: 1;
+           description { state: "default" 0.0;
+              fixed: 0 1;
+              rel1 { relative: 1.0 1.0; to_x: "left_padding"; to_y: "top_padding3"; }
+              rel2 { relative: 0.0 1.0; to_x: "right_padding"; to_y: "top_padding3"; }
+              align: 0.5 0;
+           }
+        }
+        part { name: "top_padding4";
+           type: RECT;
+           scale: 1;
+           description { state: "default" 0.0;
+              visible: 0;
+              min: 10 30;
+              max: 10 30;
+              fixed: 1 1;
+              rel1.relative: 0.5 1.0;
+              rel2.relative: 0.5 1.0;
+              rel1.to_y:"process_medium";
+              rel2.to_y:"process_medium";
+              align: 0.5 0.0;
+           }
+        }
+        part { name: "process_small";
+           type: SWALLOW;
+           scale: 1;
+           description { state: "default" 0.0;
+              fixed: 0 1;
+              rel1 { relative: 1.0 1.0; to_x: "left_padding"; to_y: "top_padding4"; }
+              rel2 { relative: 0.0 1.0; to_x: "right_padding"; to_y: "top_padding4"; }
+              align: 0.5 0;
+           }
+        }
+     }
+  }
+
diff --git a/test/RADemoTV/edc_resource/slider.edc b/test/RADemoTV/edc_resource/slider.edc
new file mode 100644 (file)
index 0000000..4e766b5
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "slider_layout";
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 320 0;
+            max: 320 -1;
+         }
+      }
+      part { name: "top_pad";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.0;
+            min: 0 50;
+            fixed: 0 1;
+            rel1.to: "bg";
+            rel2 {
+               relative: 1.0 0.0;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "elm.swallow.content1";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.0;
+            rel1 {
+               relative: 0.0 1.0;
+               to: "top_pad";
+            }
+            rel2 {
+               relative: 1.0 0.0;
+               to: "top_pad";
+            }
+            fixed: 1 1;
+         }
+      }
+      part { name: "bottom_pad";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 10;
+            max: -1 10;
+            align: 0.0 0.0;
+            rel1 {
+               relative: 0.0 1.0;
+               to: "elm.swallow.content1";
+            }
+            rel2.to: "elm.swallow.content1";
+            fixed: 0 1;
+         }
+      }
+      part { name: "elm.swallow.content2";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.0;
+            rel1 {
+               to: "bottom_pad";
+               relative: 0.0 1.0;
+            }
+            rel2 {
+               to: "bottom_pad";
+               relative: 1.0 1.0;
+            }
+            fixed: 1 1;
+         }
+      }
+      part { name: "bottom_pad1";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 10;
+            max: -1 10;
+            align: 0.0 0.0;
+            rel1 {
+               relative: 0.0 1.0;
+               to: "elm.swallow.content2";
+            }
+            rel2.to: "elm.swallow.content2";
+            fixed: 0 1;
+         }
+      }
+      part { name: "elm.swallow.content3";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.0;
+            rel1 {
+               to: "bottom_pad1";
+               relative: 0.0 1.0;
+            }
+            rel2 {
+               to: "bottom_pad1";
+               relative: 1.0 1.0;
+            }
+            fixed: 1 1;
+         }
+      }
+      part { name: "bottom_pad2";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 10;
+            max: -1 10;
+            align: 0.0 0.0;
+            rel1 {
+               relative: 0.0 1.0;
+               to: "elm.swallow.content3";
+            }
+            rel2.to: "elm.swallow.content3";
+            fixed: 0 1;
+         }
+      }
+      part { name: "elm.swallow.content4";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.0;
+            rel1 {
+               to: "bottom_pad2";
+               relative: 0.0 1.0;
+            }
+            rel2 {
+               to: "bottom_pad2";
+               relative: 1.0 1.0;
+            }
+            fixed: 1 1;
+         }
+      }
+   }
+}
diff --git a/test/RADemoTV/entry.edc b/test/RADemoTV/entry.edc
new file mode 100644 (file)
index 0000000..9e0fdc4
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "entry_layout";
+   parts {
+      part { name: "bg";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            color: 220 220 220 255;
+         }
+      }
+      part { name: "entry_part";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.to: "bg";
+            rel2.to: "bg";
+         }
+      }
+   }
+}
diff --git a/test/RADemoTV/genlist.edc b/test/RADemoTV/genlist.edc
new file mode 100644 (file)
index 0000000..1de7c7e
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "gl_custom_item";
+   styles{
+      style { name: "text_style";
+         base: "color=#000000FF font=Tizen:style=Regular font_size=30 ellipsis=1.0";
+         tag:  "br" "\n";
+         tag:  "ps" "ps";
+         tag:  "tab" "\t";
+         tag:  "b" "+ font_weight=Bold";
+      }
+   }
+   parts {
+      part { name: "base";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+         }
+      }
+      part { name: "left_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 32 0;
+            align: 0.0 0.0;
+            rel1 { to: "base"; relative: 0.0 0.0; }
+            rel2 { to: "base"; relative: 0.0 1.0; }
+         }
+      }
+      part { name: "right_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 32 0;
+            align: 1.0 0.0;
+            rel1 { to: "base"; relative: 1.0 0.0; }
+            rel2 { to: "base"; relative: 1.0 1.0; }
+         }
+      }
+      part { name: "top_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 24;
+            align: 0.0 0.0;
+            rel1 { to_x: "left_padding"; to_y: "base"; relative: 1.0 0.0; }
+            rel2 { to_x: "right_padding"; to_y: "base"; relative: 0.0 0.0; }
+         }
+      }
+      part { name: "elm.text";
+         type: TEXTBLOCK;
+         scale: 1;
+         mouse_events: 0;
+         description { state: "default" 0.0;
+            min: 0 41;
+            align: 0.0 0.0;
+            rel1 { to: "top_padding"; relative: 0.0 1.0; }
+            rel2 { to: "top_padding"; relative: 1.0 1.0; }
+            text.style: "text_style";
+            text.min: 0 1;
+         }
+      }
+      part { name: "text_content_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 10;
+            align: 0.0 0.0;
+            rel1 { to: "elm.text"; relative: 0.0 1.0; }
+            rel2 { to: "elm.text"; relative: 1.0 1.0; }
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.5 0.0;
+            rel1 { to: "text_content_padding"; relative: 0.0 1.0; }
+            rel2 { to: "bottom_padding"; relative: 1.0 0.0; }
+         }
+      }
+      part { name: "bottom_padding";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 24;
+            align: 0.5 1.0;
+            rel1 { to: "base"; relative: 0.0 1.0; }
+            rel2 { to: "base"; relative: 1.0 1.0; }
+         }
+      }
+   }
+}
diff --git a/test/RADemoTV/inc/fido_handler.h b/test/RADemoTV/inc/fido_handler.h
new file mode 100644 (file)
index 0000000..748eecd
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * fido_handler.h
+ *
+ *  Created on: Sep 7, 2016
+ *      Author: manasij.r
+ */
+
+#ifndef FIDO_HANDLER_H_
+#define FIDO_HANDLER_H_
+
+#include <string.h>
+
+typedef struct _fido_reg_assertion {
+       char *aaid;
+       unsigned char *kid;
+       int kid_len;
+} fido_reg_assertion_t;
+
+//fido_reg_assertion_t* fido_handler_decode_reg_assertion(const char *uaf_reg_resp);
+
+typedef void (*on_reg_resp)(fido_reg_assertion_t *reg_resp, int err, void *user_data);
+int fido_handler_req_reg(const char *uname, on_reg_resp cb, void *user_data);
+
+typedef void (*on_auth_resp)(fido_reg_assertion_t *reg_resp, int err, void *user_data);
+int fido_handler_req_auth(const char *kid, on_auth_resp cb, void *user_data);
+
+typedef void (*on_dereg_resp)(int err, void *user_data);
+int fido_handler_req_dereg(const char *kid, on_dereg_resp cb, void *user_data);
+
+#endif /* FIDO_HANDLER_H_ */
diff --git a/test/RADemoTV/inc/rademotv.h b/test/RADemoTV/inc/rademotv.h
new file mode 100644 (file)
index 0000000..46bbe30
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef __rademotv_H__
+#define __rademotv_H__
+
+#include <app.h>
+#include <Elementary.h>
+#include <system_settings.h>
+#include <efl_extension.h>
+#include <dlog.h>
+#include "storage_handler.h"
+
+#ifdef  LOG_TAG
+#undef  LOG_TAG
+#endif
+#define LOG_TAG "rademotv"
+
+#if !defined(PACKAGE)
+#define PACKAGE "org.example.rademotv"
+#endif
+
+typedef struct appdata {
+       Evas_Object *win;
+       Evas_Object *conform;
+       Evas_Object *layout;
+       Evas_Object *nf;
+       Evas_Object *list;
+       Evas_Object *datetime;
+       Evas_Object *popup;
+       Evas_Object *button;
+       struct tm saved_time;
+       fido_data_t *stored_data;
+
+       Evas_Object *u_popup;
+       Evas_Object *u_btn;
+       Evas_Object *u_entry;
+       Evas_Object *u_layout;
+       char *uname;
+       Evas_Object *w_popup;
+} appdata_s;
+
+void create_list_view(appdata_s *ad);
+
+#endif /* __rademotv_H__ */
diff --git a/test/RADemoTV/inc/storage_handler.h b/test/RADemoTV/inc/storage_handler.h
new file mode 100644 (file)
index 0000000..ba96a7e
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * storage_handler.h
+ *
+ *  Created on: Sep 7, 2016
+ *      Author: manasij.r
+ */
+
+#ifndef STORAGE_HANDLER_H_
+#define STORAGE_HANDLER_H_
+
+#include <string.h>
+
+typedef struct _fido_data {
+       char *uname;
+       char *kid;
+       int sc;
+       int v;
+       char *aaid;
+} fido_data_t;
+
+int storage_handler_store(const fido_data_t *data);
+
+fido_data_t* storage_handler_search(const fido_data_t *filter);
+
+int storage_handler_delete_all(void);
+
+#endif /* STORAGE_HANDLER_H_ */
diff --git a/test/RADemoTV/inc/util.h b/test/RADemoTV/inc/util.h
new file mode 100644 (file)
index 0000000..de6e1fc
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * util.h
+ *
+ *  Created on: Sep 8, 2016
+ *      Author: manasij.r
+ */
+
+#ifndef UTIL_H_
+#define UTIL_H_
+
+#define RET_IF_FAIL_VOID(cond) do {\
+               if (!(cond)){\
+                       return;\
+               }\
+} while(0)
+
+#define RET_IF_FAIL(cond, err) do {\
+               if (!(cond)){\
+                       return err;\
+               }\
+} while(0)
+
+#define CATCH_IF_FAIL(cond) do {\
+               if (!(cond)){\
+                       goto CATCH;\
+               }\
+} while(0)
+
+#define CATCH_IF_FAIL_X(cond, expr) do {\
+               if (!(cond)){\
+                       expr;\
+                       goto CATCH;\
+               }\
+} while(0)
+
+#define GOTO_IF_FAIL(cond, catch_block) do {\
+               if (!(cond)){\
+                       goto catch_block;\
+               }\
+} while(0)
+
+#define SAFE_DELETE(x) do {\
+       if (x != NULL) {\
+               free(x);    \
+               x = NULL;\
+       }\
+} while(0)
+
+#define _SAFE_DUP(x) ((x) ? strdup(x) : NULL)
+
+#endif /* UTIL_H_ */
diff --git a/test/RADemoTV/label.edc b/test/RADemoTV/label.edc
new file mode 100644 (file)
index 0000000..5d3c9b9
--- /dev/null
@@ -0,0 +1,585 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+#define LABEL_WIDTH 350.0
+#define LABEL_HEIGHT 40.0
+#define LABEL_GAP 100.0
+
+group {
+               name: "label_layout";
+               parts{
+                       part {
+                               name: "top_padding";
+                               type: RECT;
+                               scale: 1; //allow scaling
+                               description {
+                                       state: "default" 0.0;
+                                       min : LABEL_WIDTH 50; //minimum size for gap filler
+                                       fixed: 0 1;
+                                       rel1 { relative: 0 0; }
+                                       rel2 { relative: 1 0; }
+                                       align: 0 0;
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "label1_bg";
+                               type: RECT;
+                               description {
+                                       color: 200 200 200 127;
+                                       rel1.to:"label1";
+                                       rel2.to:"label1";
+                               }
+                       }
+                       part {
+                               name: "label1";
+                               type: SWALLOW;
+                               scale: 1;
+                               description {
+                                       fixed: 1 1;
+                                       min: LABEL_WIDTH LABEL_HEIGHT;
+                                       max: LABEL_WIDTH LABEL_HEIGHT;
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0 1.0; to_y: "top_padding"; }
+                                       align: 0.5 0;
+                                       }
+                       }
+                       part {
+                               name: "label1_bottom_padding";
+                               type: RECT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       min : LABEL_WIDTH LABEL_GAP;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0 1.0; to_y: "label1"; }
+                                       rel2 { relative: 1 1.0; to_y: "label1"; }
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "label2_bg";
+                               type: RECT;
+                               description {
+                                       color: 200 200 200 127;
+                                       rel1.to:"label2";
+                                       rel2.to:"label2";
+                               }
+                       }
+                       part {
+                               name: "label2";
+                               type: SWALLOW;
+                               scale: 1;
+                               description {
+                                       fixed: 1 0;
+                                       min: LABEL_WIDTH LABEL_HEIGHT;
+                                       max: LABEL_WIDTH LABEL_HEIGHT;
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0 1.0; to_y: "label1_bottom_padding"; }
+                                       align: 0.5 0;
+                               }
+                       }
+                       part {
+                               name: "label2_bottom_padding";
+                               type: RECT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       min : 0 LABEL_GAP;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0 1.0; to_y: "label2"; }
+                                       rel2 { relative: 1 1.0; to_y: "label2"; }
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "label3_bg";
+                               type: RECT;
+                               description {
+                                       color: 200 200 200 127;
+                                       rel1.to:"label3";
+                                       rel2.to:"label3";
+                               }
+                       }
+                       part {
+                               name: "label3";
+                               type: SWALLOW;
+                               scale: 1;
+                               description {
+                                       fixed: 1 1;
+                                       min: LABEL_WIDTH LABEL_HEIGHT;
+                                       max: LABEL_WIDTH LABEL_HEIGHT;
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0 1.0; to_y: "label2_bottom_padding"; }
+                                       align: 0.5 0;
+                               }
+                       }
+                       part {
+                               name: "label3_bottom_padding";
+                               type: RECT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       min : 0 LABEL_GAP;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0 1.0; to_y: "label3"; }
+                                       rel2 { relative: 1 1.0; to_y: "label3"; }
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "label4_bg";
+                               type: RECT;
+                               description {
+                                       color: 200 200 200 127;
+                                       rel1.to:"label4";
+                                       rel2.to:"label4";
+                               }
+                       }
+                       part {
+                               name: "label4";
+                               type: SWALLOW;
+                               scale: 1;
+                               description {
+                                       fixed: 1 1;
+                                       min: LABEL_WIDTH LABEL_HEIGHT;
+                                       max: LABEL_WIDTH LABEL_HEIGHT;
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0 1.0; to_y: "label3_bottom_padding"; }
+                                       align: 0.5 0;
+                               }
+                       }
+                       part {
+                               name: "label4_bottom_padding";
+                               type: RECT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       min : 0 LABEL_GAP;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0 1.0; to_y: "label4"; }
+                                       rel2 { relative: 1 1.0; to_y: "label4"; }
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "label5_bg";
+                               type: RECT;
+                               description {
+                                       color: 200 200 200 127;
+                                       rel1.to:"label5";
+                                       rel2.to:"label5";
+                               }
+                       }
+                       part {
+                               name: "label5";
+                               type: SWALLOW;
+                               scale: 1;
+                               description {
+                                       fixed: 1 1;
+                                       min: LABEL_WIDTH LABEL_HEIGHT;
+                                       max: LABEL_WIDTH LABEL_HEIGHT;
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0 1.0; to_y: "label4_bottom_padding"; }
+                                       align: 0.5 0;
+                               }
+                       }
+                       part {
+                               name: "label5_bottom_padding";
+                               type: RECT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       min : 0 30;
+                                       rel1 { relative: 0 1.0; to_y: "label5"; }
+                                       rel2 { relative: 1 1.0; }
+                                       visible: 0;
+                                       align: 0.5 1.0;
+                               }
+                       }
+               }//end parts
+#undef LABEL_WIDTH
+#undef LABEL_HEIGHT
+#undef LABEL_GAP
+} //end group
+
+       group {
+               name, "label_slide_layout";
+               parts {
+                       part { name, "background";
+                               type: RECT;
+                               description {
+                                       state: "default" 0.0;
+                                       min : 0 100;
+                                       fixed: 0 1;
+                                       align: 0 0;
+                                       rel1 { relative: 0 0; }
+                                       rel2 { relative: 1 0; }
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "top_padding";
+                               type: RECT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 0 80;
+                                       fixed: 0 1;
+                                       align: 0 0;
+                                       rel1 { relative: 0.15 0.0; to_y: "background"; }
+                                       rel2 { relative: 0.85 0.0; to_y: "background"; }
+                                       visible: 0;
+                               }
+                       }
+                       part { name: "slide_long_text";
+                               type: TEXT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 0.35; to: "top_padding";}
+                                       rel2 { relative: 1.0 1.0; to: "top_padding";}
+                                       text {
+                                               font: "Tizen:style=Regular";
+                                               size: 24;
+                                               text:"Slide Long (10 sec)";
+                                               min: 1 1 ;
+                                               align: 0.0 0.0;
+                                               ellipsis: -1;
+                                       }
+                                       align: 0.5 0;
+                                       color: 173 170 165 255;
+                               }
+                       }
+                       part { name: "swallow_label_1_bg";
+                               type: RECT;
+                               description { state: "default" 0.0;
+                                       color: 200 200 200 127;
+                                       rel1.to: "swallow_label_1";
+                                       rel2.to: "swallow_label_1";
+                               }
+                       }
+                       part { name: "swallow_label_1";
+                               type: SWALLOW;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 330 40;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.15 1.0; to_y: "top_padding"; }
+                                       rel2 { relative: 0.85 1.0; to_y: "top_padding"; }
+                                       align: 0.0 0.0;
+                                       visible: 1;
+                               }
+                       }
+                       part {
+                               name: "padding1";
+                               type: RECT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 0 80;
+                                       fixed: 0 1;
+                                       align: 0 0;
+                                       rel1 { relative: 0 1.0; to: "swallow_label_1"; }
+                                       rel2 { relative: 1 1.0; to: "swallow_label_1"; }
+                                       visible: 0;
+                               }
+                       }
+                       part { name: "slide_long1_text";
+                               type: TEXT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 0.35; to: "padding1";}
+                                       rel2 { relative: 1.0 1.0; to: "padding1";}
+                                       text {
+                                               font: "Tizen:style=Regular";
+                                               size: 24;
+                                               text: "Slide Long (5 sec)";
+                                               min: 1 1 ;
+                                               align: 0.0 0.0;
+                                               ellipsis: -1;
+                                       }
+                                       color: 173 170 165 255;
+                                       align: 0.5 0;
+                               }
+                       }
+                       part { name: "swallow_label_2_bg";
+                               type: RECT;
+                               description { state: "default" 0.0;
+                                       color: 200 200 200 127;
+                                       rel1.to: "swallow_label_2";
+                                       rel2.to: "swallow_label_2";
+                               }
+                       }
+                       part { name: "swallow_label_2";
+                               type: SWALLOW;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 330 40;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.15 1.0; to_y: "padding1"; }
+                                       rel2 { relative: 0.85 1.0; to_y: "padding1"; }
+                                       align: 0.0 0.0;
+                                       visible: 1;
+                               }
+                       }
+                       part {
+                               name: "padding2";
+                               type: RECT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 0 80;
+                                       fixed: 0 1;
+                                       align: 0 0;
+                                       rel1 { relative: 0 1.0; to: "swallow_label_2"; }
+                                       rel2 { relative: 1 1.0; to: "swallow_label_2"; }
+                                       visible: 0;
+                               }
+                       }
+                       part { name: "slide_short_text";
+                               type: TEXT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 0.35; to: "padding2";}
+                                       rel2 { relative: 1.0 1.0; to: "padding2";}
+                                       text {
+                                               font: "Tizen:style=Regular";
+                                               size: 24;
+                                               text: "Slide Short";
+                                               min: 1 1 ;
+                                               align: 0.0 0.0;
+                                               ellipsis: -1;
+                                       }
+                                       color: 173 170 165 255;
+                                       align: 0.5 0;
+                               }
+                       }
+                       part { name: "swallow_label_3_bg";
+                               type: RECT;
+                               description { state: "default" 0.0;
+                                       color: 200 200 200 127;
+                                       rel1.to: "swallow_label_3";
+                                       rel2.to: "swallow_label_3";
+                               }
+                       }
+                       part { name: "swallow_label_3";
+                               type: SWALLOW;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 330 40;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.15 1.0; to_y: "padding2"; }
+                                       rel2 { relative: 0.85 1.0; to_y: "padding2"; }
+                                       align: 0.0 0.0;
+                                       visible: 1;
+                               }
+                       }
+                       part {
+                               name: "padding3";
+                               type: RECT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 0 80;
+                                       fixed: 0 1;
+                                       align: 0 0;
+                                       rel1 { relative: 0 1.0; to: "swallow_label_3"; }
+                                       rel2 { relative: 1 1.0; to: "swallow_label_3"; }
+                                       visible: 0;
+                               }
+                       }
+                       part { name: "slide_bounce_text";
+                               type: TEXT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 0.35; to: "padding3";}
+                                       rel2 { relative: 1.0 1.0; to: "padding3";}
+                                       text {
+                                               font: "Tizen:style=Regular";
+                                               size: 24;
+                                               text: "Slide Bounce";
+                                               min: 1 1 ;
+                                               align: 0.0 0.0;
+                                               ellipsis: -1;
+                                       }
+                                       color: 173 170 165 255;
+                                       align: 0.5 0;
+                               }
+                       }
+                       part { name: "swallow_label_4_bg";
+                               type: RECT;
+                               description { state: "default" 0.0;
+                                       color: 200 200 200 127;
+                                       rel1.to: "swallow_label_4";
+                                       rel2.to: "swallow_label_4";
+                               }
+                       }
+                       part { name: "swallow_label_4";
+                               type: SWALLOW;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 330 40;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.15 1.0; to_y: "padding3"; }
+                                       rel2 { relative: 0.85 1.0; to_y: "padding3"; }
+                                       align: 0.0 0.0;
+                                       visible: 1;
+                               }
+                       }
+                       part {
+                               name: "padding4";
+                               type: RECT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 0 80;
+                                       fixed: 0 1;
+                                       align: 0 0;
+                                       rel1 { relative: 0 1.0; to: "swallow_label_4"; }
+                                       rel2 { relative: 1 1.0; to: "swallow_label_4"; }
+                                       visible: 0;
+                               }
+                       }
+                       part { name: "slide_roll_text";
+                               type: TEXT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 0.35; to: "padding4";}
+                                       rel2 { relative: 1.0 1.0; to: "padding4";}
+                                       text {
+                                               font: "Tizen:style=Regular";
+                                               size: 24;
+                                               text: "Slide Roll Short";
+                                               min: 1 1 ;
+                                               align: 0.0 0.0;
+                                               ellipsis: -1;
+                                       }
+                                       color: 173 170 165 255;
+                                       align: 0.5 0;
+                               }
+                       }
+                       part { name: "swallow_label_5_bg";
+                               type: RECT;
+                               description { state: "default" 0.0;
+                                       color: 200 200 200 127;
+                                       rel1.to: "swallow_label_5";
+                                       rel2.to: "swallow_label_5";
+                               }
+                       }
+                       part { name: "swallow_label_5";
+                               type: SWALLOW;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 330 40;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.15 1.0; to_y: "padding4"; }
+                                       rel2 { relative: 0.85 1.0; to_y: "padding4"; }
+                                       align: 0.0 0.0;
+                                       visible: 1;
+                               }
+                       }
+                       part {
+                               name: "padding5";
+                               type: RECT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 0 80;
+                                       fixed: 0 1;
+                                       align: 0 0;
+                                       rel1 { relative: 0 1.0; to: "swallow_label_5"; }
+                                       rel2 { relative: 1 1.0; to: "swallow_label_5"; }
+                                       visible: 0;
+                               }
+                       }
+                       part { name: "slide_roll1_text";
+                               type: TEXT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 0.35; to: "padding5";}
+                                       rel2 { relative: 1.0 1.0; to: "padding5";}
+                                       text {
+                                               font: "Tizen:style=Regular";
+                                               size: 24;
+                                               text: "Slide Roll Long";
+                                               min: 1 1 ;
+                                               align: 0.0 0.0;
+                                               ellipsis: -1;
+                                       }
+                                       color: 173 170 165 255;
+                                       align: 0.5 0;
+                               }
+                       }
+                       part { name: "swallow_label_6_bg";
+                               type: RECT;
+                               description { state: "default" 0.0;
+                                       color: 200 200 200 127;
+                                       rel1.to: "swallow_label_6";
+                                       rel2.to: "swallow_label_6";
+                               }
+                       }
+                       part { name: "swallow_label_6";
+                               type: SWALLOW;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 330 40;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.15 1.0; to_y: "padding5"; }
+                                       rel2 { relative: 0.85 1.0; to_y: "padding5"; }
+                                       align: 0.0 0.0;
+                                       visible: 1;
+                               }
+                       }
+                       part {
+                               name: "padding6";
+                               type: RECT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 0 80;
+                                       fixed: 0 1;
+                                       align: 0 0;
+                                       rel1 { relative: 0 1.0; to: "swallow_label_6"; }
+                                       rel2 { relative: 1 1.0; to: "swallow_label_6"; }
+                                       visible: 0;
+                               }
+                       }
+                       part { name: "swallow_btn";
+                               type: SWALLOW;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 330 40;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0 1.0; to: "padding6"; }
+                                       rel2 { relative: 1 1.0; to: "padding6"; }
+                                       align: 0.0 0.0;
+                                       visible: 1;
+                               }
+                       }
+                       part {
+                               name: "padding7";
+                               type: RECT;
+                               scale: 1;
+                               description { state: "default" 0.0;
+                                       min : 0 30;
+                                       align: 0 1;
+                                       rel1 { relative: 0 1.0; to: "swallow_btn"; }
+                                       rel2 { relative: 1 1.0; }
+                                       visible: 0;
+                               }
+                       }
+               }
+       }
diff --git a/test/RADemoTV/layout.edc b/test/RADemoTV/layout.edc
new file mode 100644 (file)
index 0000000..9e724bd
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "white_bg_layout";
+   parts {
+      part { name: "base";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            color: 250 250 250 255;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+         }
+      }
+   }
+}
+
+group { name: "button_layout_1";
+   parts {
+      part { name: "base";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 300 78;
+            color: 0 0 0 0;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.to: "base";
+            rel2.to: "base";
+         }
+      }
+   }
+}
+
+group { name: "button_layout_2";
+   parts {
+      part { name: "base";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 500 78;
+            color: 0 0 0 0;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.to: "base";
+            rel2.to: "base";
+         }
+      }
+   }
+}
+
+group { name: "check_layout";
+   parts {
+      part { name: "base";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 300 78;
+            color: 0 0 0 0;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.to: "base";
+            rel2.to: "base";
+         }
+      }
+   }
+}
+
diff --git a/test/RADemoTV/manasij.p12 b/test/RADemoTV/manasij.p12
new file mode 100644 (file)
index 0000000..83a03ce
Binary files /dev/null and b/test/RADemoTV/manasij.p12 differ
diff --git a/test/RADemoTV/pagecontrol.edc b/test/RADemoTV/pagecontrol.edc
new file mode 100644 (file)
index 0000000..6b5f648
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "pagecontrol_layout";
+   parts {
+      part { name: "bg";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            color: 0 0 0 255;
+         }
+      }
+      part { name: "scroller";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1 {
+               relative: 0.0 0.0;
+               to: "bg";
+            }
+            rel2 {
+               relative: 1.0 1.0;
+               to: "bg";
+            }
+            align: 0.5 0.5;
+         }
+      }
+      part { name: "controller";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 52;
+            fixed: 0 1;
+            align: 0.5 1.0;
+            rel1.relative: 0.0 1.0;
+            rel2.relative: 1.0 1.0;
+         }
+      }
+   }
+}
+
+group { name: "pagecontrol_page_layout";
+   parts {
+      part { name: "page";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+         }
+      }
+      part { name: "text";
+         type: TEXT;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            rel1.relative: 0.5 0.5;
+            rel2.relative: 0.5 0.5;
+            text {
+               min: 1 1;
+               size: 50;
+               ellipsis: -1;
+            }
+         }
+      }
+   }
+}
diff --git a/test/RADemoTV/popup_custom.edc b/test/RADemoTV/popup_custom.edc
new file mode 100644 (file)
index 0000000..0b5d5b9
--- /dev/null
@@ -0,0 +1,1047 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+#define POPUP_CONTENT_DEFAULT_PADDING_TOP_MIN_INC 27
+#define POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 15
+#define POPUP_CONTENT_DEFAULT_PADDING_RIGHT_MIN_INC 15
+#define POPUP_CONTENT_DEFAULT_PADDING_BOTTOM_MIN_INC 27
+#define POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC 96
+
+#define POPUP_IMAGE_VIEW_LAYOUT_BG_MIN_INC 0 112
+#define POPUP_IMAGE_SWALLOW_CONTENT_PADDING_BOTTOM_MIN_INC 0 20
+#define POPUP_DESCRIPTION_DEFAULT_TEXT_FONT_SIZE_INC 38
+#define POPUP_CHECK_VIEW_LAYOUT_CONTENT_MIN_INC 0 162
+#define POPUP_CHECK_VIEW_LAYOUT_BOTTOM_MIN_INC 0 90
+#define POPUP_CHECK_VIEW_SWALLOW_END_MIN_INC 50 50
+#define POPUP_CHECK_VIEW_LAYOUT_MIN_INC 0 252
+
+#define POPUP_TEXT_INPUTTEXT_VIEW_LAYOUT_BG_MIN_INC 480 159
+
+#define POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC 15 27
+#define POPUP_PROGRESSBAR_VIEW_LAYOUT_TEXT_FONT_SIZE_INC 0 38
+#define POPUP_PROGRESSBAR_VIEW_LAYOUT_BG_INC 0 69
+#define POPUP_PROGRESSBAR_VIEW_LAYOUT_BG_MIN_INC 0 161
+
+#define POPUP_PROGRESSBAR_2TEXT_VIEW_LAYOUT_BG_MIN_INC 0 193
+#define POPUP_PROGRESSBAR_VIEW_LAYOUT_SUBTEXT_FONT_SIZE_INC 0 32
+
+#define POPUP_GROUP_INDEX_BG_MIN_INC 0 52
+#define POPUP_GROUP_INDEX_PROCESSING_MIN_INC 28 28
+#define POPUP_GROUP_INDEX_PROCESSING_MAX_INC 28 28
+#define POPUP_GROUP_INDEX_PADDING_BEFORE_SWALLOW_MIN_INC 15 52
+#define POPUP_GROUP_INDEX_TEXT_MIN_INC 0 52
+
+#define POPUP_TEXT_SLIDER_VIEW_LAYOUT_MIN_INC 0 144
+#define POPUP_TEXT_SLIDER_PADDING_SIZE_INC 15 27
+#define POPUP_TEXT_SLIDER_TEXT_DISCRIPTION_MIN_INC 0 38
+#define POPUP_TEXT_SLIDER_BG_MIN_INC 0 42
+#define POPUP_SLIDER_PADDING_LEFT_MIN_INC 10 0
+
+#define POPUP_2TEXT_SLIDER_VIEW_LAYOUT_MIN_INC 0 176
+#define POPUP_TEXT_SLIDER_SUBTEXT_DISCRIPTION_MIN_INC 0 32
+
+#define POPUP_SCROLLABLE_TEXT_VIEW_BG_HEIGHT_INC 252
+
+#define POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MIN_INC 36 36
+#define POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MAX_INC 36 36
+#define POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_PADDING_AFTER_INC 15 90
+#define POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_TEXT_MIN_INC 0 90
+#define POPUP_PROCESSING_VIEW_LAYOUT_BG_MIN_INC 0 90
+
+#define POPUP_TEXT_FONT_SIZE1 30
+#define POPUP_TEXT_FONT_SIZE2 24
+#define POPUP_TEXT_FONT_SIZE3 27
+
+group { name: "popup_image_list_layout";
+   styles {
+      style { name: "popup_content_style";
+         base: "font=Tizen:style=Regular align=left font_size="POPUP_TEXT_FONT_SIZE1" color=#000000 wrap=mixed ellipsis=1.0 text_class=tizen";
+         tag: "br" "\n";
+         tag: "tab" "\t";
+      }
+   }
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_IMAGE_VIEW_LAYOUT_BG_MIN_INC;
+            fixed: 1 0;
+         }
+      }
+      part { name: "pad_l";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 0.0 0.0;
+            rel2.relative: 0.0 1.0;
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 1.0 0.0;
+            rel2.relative: 1.0 1.0;
+            align: 1.0 0.0;
+         }
+      }
+      part { name: "pad_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.0;
+            min: 0 POPUP_CONTENT_DEFAULT_PADDING_TOP_MIN_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 1.0 0.0;to_x: "pad_l";
+            }
+            rel2 {
+               relative: 0.0 0.0;to_x: "pad_r";
+            }
+         }
+      }
+      part { name: "content_bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 0;
+            rel1 {
+               relative: 1.0 1.0;
+               to_x: "pad_l";
+               to_y: "pad_t";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to_x: "pad_r";
+               to_y: "pad_b";
+            }
+            align: 0.5 0.5;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 0;
+            rel1.to: "content_bg";
+            rel2.to: "content_bg";
+         }
+      }
+      part { name: "pad_b";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_IMAGE_SWALLOW_CONTENT_PADDING_BOTTOM_MIN_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 1.0 0.0;
+               to_x: "pad_l";
+               to_y: "elm.text";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to_x: "pad_r";
+               to_y: "elm.text";
+            }
+            align: 0.0 1.0;
+         }
+      }
+      part { name: "elm.text";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 POPUP_DESCRIPTION_DEFAULT_TEXT_FONT_SIZE_INC;
+            fixed: 0 1;
+            align: 0.0 1.0;
+            rel1 {
+               relative: 1.0 0.0;
+               to_x: "pad_l";
+               to_y: "pad_bottom";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to_x: "pad_r";
+               to_y: "pad_bottom";
+            }
+            text {
+               style: "popup_content_style";
+               min: 0 1;
+            }
+            color: 0 0 0 255;
+         }
+      }
+      part { name: "pad_bottom";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 1.0;
+            min: 0 POPUP_CONTENT_DEFAULT_PADDING_BOTTOM_MIN_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 1.0 1.0;
+               to_x: "pad_l";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r";
+            }
+         }
+      }
+   }
+}
+
+group { name: "popup_checkview_layout";
+   parts {
+      part { name: "bg";
+         scale: 1;
+         type: SPACER;
+         description { state: "default" 0.0;
+            min: POPUP_CHECK_VIEW_LAYOUT_MIN_INC;
+            fixed: 1 0;
+         }
+      }
+      part { name: "pad_l";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 0.0 0.0;
+            rel2.relative: 0.0 1.0;
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_RIGHT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 1.0 0.0;
+            rel2.relative: 1.0 1.0;
+            align: 1.0 0.0;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            min: POPUP_CHECK_VIEW_LAYOUT_CONTENT_MIN_INC;
+            align: 0.5 0.0;
+            rel2 {
+               relative: 1.0 0.0;
+               to: "pad_b";
+            }
+         }
+      }
+      part { name: "pad_b";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 1.0;
+            min: POPUP_CHECK_VIEW_LAYOUT_BOTTOM_MIN_INC;
+            fixed: 0 1;
+            rel1.relative: 0.0 1.0;
+         }
+      }
+      part { name: "elm.swallow.end";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.5;
+            min: POPUP_CHECK_VIEW_SWALLOW_END_MIN_INC;
+            fixed: 1 1;
+            rel1 {
+               relative: 1.0 1.0;
+               to_x: "pad_l";
+               to_y: "pad_b";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to_x: "pad_r";
+               to_y: "pad_b";
+            }
+         }
+      }
+   }
+}
+
+group { name: "processing_view_layout";
+   styles {
+      style { name: "popup_processing_style";
+         base: "font=Tizen:style=Regular align=left font_size="POPUP_TEXT_FONT_SIZE1" color=#000000 wrap=mixed ellipsis=1.0 text_class=tizen";
+         tag:  "br" "\n";
+         tag:  "tab" "\t";
+      }
+   }
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROCESSING_VIEW_LAYOUT_BG_MIN_INC;
+            fixed: 1 0;
+         }
+      }
+      part { name: "pad_l";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 0.0 0.0;
+            rel2.relative: 0.0 1.0;
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 1.0 0.0;
+            rel2.relative: 1.0 1.0;
+            align: 1.0 0.0;
+         }
+      }
+      part { name: "processing";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            min: POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MIN_INC;
+            max: POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MAX_INC;
+            rel1 {
+               relative: 1.0 0.0;
+               to_x: "pad_l";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r";
+            }
+            align: 0.0 0.5;
+         }
+      }
+      part { name: "pad_after_processing";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            min: POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_PADDING_AFTER_INC;
+            rel1 {
+               relative: 1.0 0.0;
+               to: "processing";
+            }
+            rel2.to: "processing";
+            align: 0.0 0.5;
+         }
+      }
+      part { name: "elm.text";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_TEXT_MIN_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 1.0 0.0;
+               to: "pad_after_processing";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r";
+            }
+            align: 0.0 0.5;
+            text {
+               style: "popup_processing_style";
+               min: 0 1;
+            }
+         }
+      }
+   }
+}
+
+group { name: "popup_text_progressbar_view_layout";
+   styles {
+      style { name: "popup_progress_style";
+         base: "font=Tizen:style=Regular align=right font_size="14" color=#000000 wrap=mixed ellipsis=1.0 text_class=tizen";
+         tag:  "br" "\n";
+         tag:  "tab" "\t";
+      }
+   }
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_BG_MIN_INC;
+            fixed: 1 0;
+         }
+      }
+      part { name: "pad_l_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC;
+            max: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC;
+            fixed: 1 1;
+            rel2.relative: 0.0 0.0;
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC;
+            max: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC;
+            fixed: 1 1;
+            rel1.relative: 1.0 1.0;
+            align: 1.0 1.0;
+         }
+      }
+      part { name: "elm.text.description";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_TEXT_FONT_SIZE_INC;
+            rel1 {
+               relative: 1.0 1.0;
+               to: "pad_l_t";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_t";
+               to_y: "pad_l_t";
+            }
+            text {
+               style: "popup_processing_style";
+               min: 0 1;
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "progressbar_bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_BG_INC;
+            rel1 {
+               relative: 1.0 1.0;
+               to_x: "pad_l_t";
+               to_y: "elm.text.description";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_t";
+               to_y: "elm.text.description";
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "progressbar";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            rel1.to: "progressbar_bg";
+            rel2.to: "progressbar_bg";
+         }
+      }
+   }
+}
+
+group { name: "popup_2text_progressbar_view_layout";
+   styles {
+      style { name: "popup_subtext_style";
+         base: "font=Tizen:style=Regular align=left font_size="POPUP_TEXT_FONT_SIZE2" color=#000000 wrap=mixed ellipsis=1.0 text_class=tizen";
+         tag:  "br" "\n";
+         tag:  "tab" "\t";
+      }
+   }
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROGRESSBAR_2TEXT_VIEW_LAYOUT_BG_MIN_INC;
+            fixed: 1 0;
+         }
+      }
+      part { name: "pad_l_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC;
+            max: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC;
+            fixed: 1 1;
+            rel2.relative: 0.0 0.0;
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC;
+            max: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC;
+            fixed: 1 1;
+            rel1.relative: 1.0 1.0;
+            align: 1.0 1.0;
+         }
+      }
+      part { name: "elm.text.description";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_TEXT_FONT_SIZE_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 1.0 1.0;
+               to: "pad_l_t";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_t";
+               to_y: "pad_l_t";
+            }
+            text {
+               style: "popup_processing_style";
+               min: 0 1;
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "elm.subtext.description";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_SUBTEXT_FONT_SIZE_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 1.0 1.0;
+               to_x: "pad_l_t";
+               to_y: "elm.text.description";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_t";
+               to_y: "elm.text.description";
+            }
+            text {
+               style: "popup_subtext_style";
+               min: 0 1;
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "progressbar_bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            min: POPUP_PROGRESSBAR_VIEW_LAYOUT_BG_INC;
+            rel1 {
+               relative: 1.0 1.0;
+               to_x: "pad_l_t";
+               to_y: "elm.subtext.description";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_t";
+               to_y: "elm.subtext.description";
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "progressbar";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            rel1.to: "progressbar_bg";
+            rel2.to: "progressbar_bg";
+         }
+      }
+   }
+}
+
+group { name: "popup_groupindex_view_layout";
+   styles {
+      style { name: "popup_groupindex_style";
+         base: "font=Tizen:style=Regular align=right font_size="POPUP_TEXT_FONT_SIZE3" color=#000000 wrap=mixed ellipsis=1.0 text_class=tizen";
+         tag:  "br" "\n";
+         tag:  "tab" "\t";
+      }
+   }
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+         }
+      }
+      part { name: "pad_l";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 0.0 0.0;
+            rel2.relative: 0.0 1.0;
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_RIGHT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 1.0 0.0;
+            rel2.relative: 1.0 1.0;
+            align: 1.0 0.0;
+         }
+      }
+      part { name: "index_bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_GROUP_INDEX_BG_MIN_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 1.0 0.0;
+               to: "pad_l";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to: "pad_r";
+            }
+            align: 0.5 0.0;
+         }
+      }
+      part { name: "processing";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_GROUP_INDEX_PROCESSING_MIN_INC;
+            max: POPUP_GROUP_INDEX_PROCESSING_MAX_INC;
+            rel1 {
+               relative: 1.0 0.0;
+               to: "index_bg";
+            }
+            rel2.to: "index_bg";
+            align: 1.0 0.5;
+         }
+      }
+      part { name: "pad_before_swallow";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_GROUP_INDEX_PADDING_BEFORE_SWALLOW_MIN_INC;
+            rel1 {
+               relative: 0.0 0.0;
+               to: "processing";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to: "processing";
+            }
+            align: 1.0 0.5;
+         }
+      }
+      part { name: "elm.text";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_GROUP_INDEX_TEXT_MIN_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 0.0 0.0;
+               to: "index_bg";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_before_swallow";
+               to_y: "index_bg";
+            }
+            align: 0.5 0.0;
+            text {
+               style: "popup_groupindex_style";
+               min: 0 1;
+            }
+         }
+      }
+      part { name: "genlist";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1 {
+               relative: 0.0 1.0;
+               to_y: "index_bg";
+            }
+            align: 0.5 0.0;
+         }
+      }
+   }
+}
+
+group { name: "popup_text_slider_view_layout";
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_TEXT_SLIDER_VIEW_LAYOUT_MIN_INC;
+            fixed: 1 0;
+         }
+      }
+      part { name: "pad_l_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_TEXT_SLIDER_PADDING_SIZE_INC;
+            max: POPUP_TEXT_SLIDER_PADDING_SIZE_INC;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.0 0.0;
+            }
+            rel2 {
+               relative: 0.0 0.0;
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_TEXT_SLIDER_PADDING_SIZE_INC;
+            max: POPUP_TEXT_SLIDER_PADDING_SIZE_INC;
+            fixed: 1 1;
+            rel1.relative: 1.0 1.0;
+            rel2.relative: 1.0 1.0;
+            align: 1.0 1.0;
+         }
+      }
+      part { name: "elm.text.description";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            min: POPUP_TEXT_SLIDER_TEXT_DISCRIPTION_MIN_INC;
+            rel1 {
+               relative: 1.0 1.0;
+               to: "pad_l_t";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_t";
+               to_y: "pad_l_t";
+            }
+            text {
+               style: "popup_processing_style";
+               min: 0 1;
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "slider";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            min: POPUP_TEXT_SLIDER_BG_MIN_INC;
+            rel1 {
+               relative: 1.0 0.0;
+               to_y: "pad_r_t";
+               to_x: "pad_l_t";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to: "pad_r_t";
+            }
+            align: 0.0 1.0;
+         }
+      }
+   }
+}
+
+group { name: "popup_2text_slider_view_layout";
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_2TEXT_SLIDER_VIEW_LAYOUT_MIN_INC;
+            fixed: 1 0;
+         }
+      }
+      part { name: "pad_l_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_TEXT_SLIDER_PADDING_SIZE_INC;
+            max: POPUP_TEXT_SLIDER_PADDING_SIZE_INC;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.0 0.0;
+            }
+            rel2 {
+               relative: 0.0 0.0;
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_TEXT_SLIDER_PADDING_SIZE_INC;
+            max: POPUP_TEXT_SLIDER_PADDING_SIZE_INC;
+            fixed: 1 1;
+            rel1.relative: 1.0 1.0;
+            rel2.relative: 1.0 1.0;
+            align: 1.0 1.0;
+         }
+      }
+      part { name: "elm.text.description";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            min: POPUP_TEXT_SLIDER_TEXT_DISCRIPTION_MIN_INC;
+            rel1 {
+               relative: 1.0 1.0;
+               to: "pad_l_t";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_t";
+               to_y: "pad_l_t";
+            }
+            text {
+               style: "popup_processing_style";
+               min: 0 1;
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "elm.subtext.description";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_TEXT_SLIDER_SUBTEXT_DISCRIPTION_MIN_INC;
+            fixed: 0 1;
+            rel1 {
+               relative: 1.0 1.0;
+               to_x: "pad_l_t";
+               to_y: "elm.text.description";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_t";
+               to_y: "elm.text.description";
+            }
+            text {
+               style: "popup_subtext_style";
+               min: 0 1;
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "slider";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 0 1;
+            min: POPUP_TEXT_SLIDER_BG_MIN_INC;
+            rel1 {
+               relative: 1.0 0.0;
+               to_y: "pad_r_t";
+               to_x: "pad_l_t";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to: "pad_r_t";
+            }
+            align: 0.0 1.0;
+         }
+      }
+   }
+}
+
+group { name: "popup_scrollable_text";
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 POPUP_SCROLLABLE_TEXT_VIEW_BG_HEIGHT_INC;
+            max: -1 POPUP_SCROLLABLE_TEXT_VIEW_BG_HEIGHT_INC;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+         }
+      }
+   }
+}
+
+group { name: "popup_input_text";
+   parts {
+      part { name: "pad_l";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 0.0 0.0;
+            rel2.relative: 0.0 1.0;
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+            fixed: 1 0;
+            rel1.relative: 1.0 0.0;
+            rel2.relative: 1.0 1.0;
+            align: 1.0 0.0;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC;
+            max: -1 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC;
+            align: 0.5 0.5;
+            rel1{
+               relative: 1.0 0.0 ;
+               to_x: "pad_l";
+            }
+            rel2{
+               relative: 0.0 1.0;
+               to_x: "pad_r";
+            }
+         }
+      }
+   }
+}
+
+group { name: "popup_text_input_text";
+   styles {
+      style { name: "popup_input_style";
+         base: "font=Tizen:style=Regular align=left font_size="POPUP_TEXT_FONT_SIZE1" color=#000000 wrap=mixed text_class=tizen";
+         tag:  "br" "\n";
+         tag:  "tab" "\t";
+      }
+   }
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_TEXT_INPUTTEXT_VIEW_LAYOUT_BG_MIN_INC;
+         }
+      }
+      part { name: "pad_l_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC POPUP_CONTENT_DEFAULT_PADDING_TOP_MIN_INC;
+            max: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC POPUP_CONTENT_DEFAULT_PADDING_TOP_MIN_INC;
+            fixed: 1 1;
+            rel1.to: "bg";
+            rel2 {
+               relative: 0.0 0.0;
+               to: "bg";
+            }
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r_b";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_RIGHT_MIN_INC POPUP_CONTENT_DEFAULT_PADDING_TOP_MIN_INC;
+            max: POPUP_CONTENT_DEFAULT_PADDING_RIGHT_MIN_INC POPUP_CONTENT_DEFAULT_PADDING_TOP_MIN_INC;
+            fixed: 1 1;
+            rel1 {
+               relative: 1.0 1.0;
+               to: "bg";
+            }
+            rel2.to: "bg";
+            align: 1.0 1.0;
+         }
+      }
+      part { name: "elm.text.description";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 POPUP_DESCRIPTION_DEFAULT_TEXT_FONT_SIZE_INC;
+            rel1 {
+               relative: 1.0 1.0;
+               to: "pad_l_t";
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               to_x: "pad_r_b";
+               to_y: "elm.swallow.content";
+            }
+            text {
+               style: "popup_input_style";
+               min: 0 1;
+            }
+            align: 0.5 0.0;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC;
+            max: -1 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC;
+            fixed: 0 1;
+            align: 0.0 1.0;
+            rel1{
+               relative: 1.0 0.0 ;
+               to_x: "pad_l_t";
+               to_y: "pad_r_b";
+            }
+            rel2{
+               relative: 0.0 0.0;
+               to: "pad_r_b";
+            }
+         }
+      }
+   }
+}
diff --git a/test/RADemoTV/progressbar.edc b/test/RADemoTV/progressbar.edc
new file mode 100644 (file)
index 0000000..d3b5428
--- /dev/null
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "progessbar_layout";
+   parts {
+      part { name: "bg";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            color: 0 0 0 0;
+         }
+      }
+      part { name: "top_padding";
+         type: RECT;
+         scale: 1;
+         description { state: "default" 0.0;
+            visible: 0;
+            min: 0 30;
+            max: -1 30;
+            fixed: 0 1;
+            rel1 {
+               relative: 0.5 0.0;
+               to_y: "bg";
+            }
+            rel2 {
+               relative: 0.5 0.0;
+               to_y: "bg";
+            }
+            align: 0.5 0.0;
+         }
+      }
+      part { name: "left_padding";
+          type: RECT;
+          scale: 1;
+          description { state: "default" 0.0;
+             min: 10 0;
+             fixed: 1 0;
+             rel1.relative: 0.0 0.0;
+             rel1.to_x: "bg";
+             rel2.relative: 0.0 1.0;
+             align: 0.0 0.5;
+             color: 0 0 0 0;
+          }
+        }
+        part { name: "right_padding";
+           type: RECT;
+           scale: 1;
+           description { state: "default" 0.0;
+              min: 10 0;
+              fixed: 1 0;
+              rel1.relative: 1.0 0.0;
+              rel2.to_x: "bg";
+              rel2.relative: 1.0 1.0;
+              align: 1.0 0.5;
+              color: 0 0 0 0;
+           }
+        }
+        part { name: "list_progress";
+           type: SWALLOW;
+           scale: 1;
+           description { state: "default" 0.0;
+              fixed: 0 1;
+              rel1 { relative: 1.0 1.0; to_x: "left_padding"; to_y: "top_padding"; }
+              rel2 { relative: 0.0 1.0; to_x: "right_padding"; to_y: "top_padding"; }
+              align: 0.5 0;
+           }
+        }
+        part { name: "top_padding1";
+           type: RECT;
+           scale: 1;
+           description { state: "default" 0.0;
+              visible: 0;
+              min: 10 30;
+              max: 10 30;
+              fixed: 1 1;
+              rel1.relative: 0.5 1.0;
+              rel2.relative: 0.5 1.0;
+              rel1.to_y:"list_progress";
+              rel2.to_y:"list_progress";
+              align: 0.5 0.0;
+           }
+        }
+        part { name: "pending_list";
+           type: SWALLOW;
+           scale: 1;
+           description { state: "default" 0.0;
+              fixed: 0 1;
+              rel1 { relative: 1.0 1.0; to_x: "left_padding"; to_y: "top_padding1"; }
+              rel2 { relative: 0.0 1.0; to_x: "right_padding"; to_y: "top_padding1"; }
+              align: 0.5 0;
+           }
+        }
+        part { name: "top_padding2";
+           type: RECT;
+           scale: 1;
+           description { state: "default" 0.0;
+              visible: 0;
+              min: 10 30;
+              max: 10 30;
+              fixed: 1 1;
+              rel1.relative: 0.5 1.0;
+              rel2.relative: 0.5 1.0;
+              rel1.to_y:"pending_list";
+              rel2.to_y:"pending_list";
+              align: 0.5 0.0;
+           }
+        }
+        part { name: "process_large";
+           type: SWALLOW;
+           scale: 1;
+           description { state: "default" 0.0;
+              fixed: 0 1;
+              rel1 { relative: 1.0 1.0; to_x: "left_padding"; to_y: "top_padding2"; }
+              rel2 { relative: 0.0 1.0; to_x: "right_padding"; to_y: "top_padding2"; }
+              align: 0.5 0;
+           }
+        }
+        part { name: "top_padding3";
+           type: RECT;
+           scale: 1;
+           description { state: "default" 0.0;
+              visible: 0;
+              min: 10 30;
+              max: 10 30;
+              fixed: 1 1;
+              rel1.relative: 0.5 1.0;
+              rel2.relative: 0.5 1.0;
+              rel1.to_y:"process_large";
+              rel2.to_y:"process_large";
+              align: 0.5 0.0;
+           }
+        }
+        part { name: "process_medium";
+           type: SWALLOW;
+           scale: 1;
+           description { state: "default" 0.0;
+              fixed: 0 1;
+              rel1 { relative: 1.0 1.0; to_x: "left_padding"; to_y: "top_padding3"; }
+              rel2 { relative: 0.0 1.0; to_x: "right_padding"; to_y: "top_padding3"; }
+              align: 0.5 0;
+           }
+        }
+        part { name: "top_padding4";
+           type: RECT;
+           scale: 1;
+           description { state: "default" 0.0;
+              visible: 0;
+              min: 10 30;
+              max: 10 30;
+              fixed: 1 1;
+              rel1.relative: 0.5 1.0;
+              rel2.relative: 0.5 1.0;
+              rel1.to_y:"process_medium";
+              rel2.to_y:"process_medium";
+              align: 0.5 0.0;
+           }
+        }
+        part { name: "process_small";
+           type: SWALLOW;
+           scale: 1;
+           description { state: "default" 0.0;
+              fixed: 0 1;
+              rel1 { relative: 1.0 1.0; to_x: "left_padding"; to_y: "top_padding4"; }
+              rel2 { relative: 0.0 1.0; to_x: "right_padding"; to_y: "top_padding4"; }
+              align: 0.5 0;
+           }
+        }
+     }
+  }
+
diff --git a/test/RADemoTV/project_def.prop b/test/RADemoTV/project_def.prop
new file mode 100644 (file)
index 0000000..662384c
--- /dev/null
@@ -0,0 +1,11 @@
+APPNAME = rademotv
+
+type = app
+profile = mobile-3.0
+
+USER_SRCS = src/rademotv.c
+USER_DEFS =
+USER_INC_DIRS = inc
+USER_OBJS =
+USER_LIBS =
+USER_EDCS =
diff --git a/test/RADemoTV/res/images/Clock_tabs_icon_alarm.png b/test/RADemoTV/res/images/Clock_tabs_icon_alarm.png
new file mode 100644 (file)
index 0000000..3c532d1
Binary files /dev/null and b/test/RADemoTV/res/images/Clock_tabs_icon_alarm.png differ
diff --git a/test/RADemoTV/res/images/Clock_tabs_icon_timer.png b/test/RADemoTV/res/images/Clock_tabs_icon_timer.png
new file mode 100644 (file)
index 0000000..ab81798
Binary files /dev/null and b/test/RADemoTV/res/images/Clock_tabs_icon_timer.png differ
diff --git a/test/RADemoTV/res/images/Clock_tabs_icon_world_clock.png b/test/RADemoTV/res/images/Clock_tabs_icon_world_clock.png
new file mode 100644 (file)
index 0000000..e785c5d
Binary files /dev/null and b/test/RADemoTV/res/images/Clock_tabs_icon_world_clock.png differ
diff --git a/test/RADemoTV/res/images/Clock_tabs_icon_world_stopwatch.png b/test/RADemoTV/res/images/Clock_tabs_icon_world_stopwatch.png
new file mode 100644 (file)
index 0000000..4fa92c5
Binary files /dev/null and b/test/RADemoTV/res/images/Clock_tabs_icon_world_stopwatch.png differ
diff --git a/test/RADemoTV/res/images/arrow-down.png b/test/RADemoTV/res/images/arrow-down.png
new file mode 100644 (file)
index 0000000..ed15745
Binary files /dev/null and b/test/RADemoTV/res/images/arrow-down.png differ
diff --git a/test/RADemoTV/res/images/arrow-left.png b/test/RADemoTV/res/images/arrow-left.png
new file mode 100644 (file)
index 0000000..59cb2d5
Binary files /dev/null and b/test/RADemoTV/res/images/arrow-left.png differ
diff --git a/test/RADemoTV/res/images/arrow-left1.png b/test/RADemoTV/res/images/arrow-left1.png
new file mode 100644 (file)
index 0000000..a7fc65f
Binary files /dev/null and b/test/RADemoTV/res/images/arrow-left1.png differ
diff --git a/test/RADemoTV/res/images/arrow-right.png b/test/RADemoTV/res/images/arrow-right.png
new file mode 100644 (file)
index 0000000..6e45e43
Binary files /dev/null and b/test/RADemoTV/res/images/arrow-right.png differ
diff --git a/test/RADemoTV/res/images/arrow-up.png b/test/RADemoTV/res/images/arrow-up.png
new file mode 100644 (file)
index 0000000..02050ca
Binary files /dev/null and b/test/RADemoTV/res/images/arrow-up.png differ
diff --git a/test/RADemoTV/res/images/btn_style_nor.png b/test/RADemoTV/res/images/btn_style_nor.png
new file mode 100644 (file)
index 0000000..fc4e2df
Binary files /dev/null and b/test/RADemoTV/res/images/btn_style_nor.png differ
diff --git a/test/RADemoTV/res/images/contacts_ic_circle_btn_call.png b/test/RADemoTV/res/images/contacts_ic_circle_btn_call.png
new file mode 100644 (file)
index 0000000..9700f45
Binary files /dev/null and b/test/RADemoTV/res/images/contacts_ic_circle_btn_call.png differ
diff --git a/test/RADemoTV/res/images/contacts_ic_circle_btn_email.png b/test/RADemoTV/res/images/contacts_ic_circle_btn_email.png
new file mode 100644 (file)
index 0000000..8de9dd4
Binary files /dev/null and b/test/RADemoTV/res/images/contacts_ic_circle_btn_email.png differ
diff --git a/test/RADemoTV/res/images/contacts_ic_circle_btn_note.png b/test/RADemoTV/res/images/contacts_ic_circle_btn_note.png
new file mode 100644 (file)
index 0000000..3c3a585
Binary files /dev/null and b/test/RADemoTV/res/images/contacts_ic_circle_btn_note.png differ
diff --git a/test/RADemoTV/res/images/core_floating_icon_01.png b/test/RADemoTV/res/images/core_floating_icon_01.png
new file mode 100644 (file)
index 0000000..7f487f9
Binary files /dev/null and b/test/RADemoTV/res/images/core_floating_icon_01.png differ
diff --git a/test/RADemoTV/res/images/core_floating_icon_02.png b/test/RADemoTV/res/images/core_floating_icon_02.png
new file mode 100644 (file)
index 0000000..bede808
Binary files /dev/null and b/test/RADemoTV/res/images/core_floating_icon_02.png differ
diff --git a/test/RADemoTV/res/images/core_icon_expand_close.png b/test/RADemoTV/res/images/core_icon_expand_close.png
new file mode 100644 (file)
index 0000000..b46d2a7
Binary files /dev/null and b/test/RADemoTV/res/images/core_icon_expand_close.png differ
diff --git a/test/RADemoTV/res/images/core_icon_expand_open.png b/test/RADemoTV/res/images/core_icon_expand_open.png
new file mode 100644 (file)
index 0000000..7927ef2
Binary files /dev/null and b/test/RADemoTV/res/images/core_icon_expand_open.png differ
diff --git a/test/RADemoTV/res/images/custom_highlight.png b/test/RADemoTV/res/images/custom_highlight.png
new file mode 100644 (file)
index 0000000..595a398
Binary files /dev/null and b/test/RADemoTV/res/images/custom_highlight.png differ
diff --git a/test/RADemoTV/res/images/custom_highlight2.png b/test/RADemoTV/res/images/custom_highlight2.png
new file mode 100644 (file)
index 0000000..5dc70a9
Binary files /dev/null and b/test/RADemoTV/res/images/custom_highlight2.png differ
diff --git a/test/RADemoTV/res/images/grid_image/1_raw.png b/test/RADemoTV/res/images/grid_image/1_raw.png
new file mode 100644 (file)
index 0000000..036ff53
Binary files /dev/null and b/test/RADemoTV/res/images/grid_image/1_raw.png differ
diff --git a/test/RADemoTV/res/images/grid_image/2_raw.png b/test/RADemoTV/res/images/grid_image/2_raw.png
new file mode 100644 (file)
index 0000000..42d701c
Binary files /dev/null and b/test/RADemoTV/res/images/grid_image/2_raw.png differ
diff --git a/test/RADemoTV/res/images/horz_scrollbar.png b/test/RADemoTV/res/images/horz_scrollbar.png
new file mode 100644 (file)
index 0000000..a402da7
Binary files /dev/null and b/test/RADemoTV/res/images/horz_scrollbar.png differ
diff --git a/test/RADemoTV/res/images/tizen.png b/test/RADemoTV/res/images/tizen.png
new file mode 100644 (file)
index 0000000..408188a
Binary files /dev/null and b/test/RADemoTV/res/images/tizen.png differ
diff --git a/test/RADemoTV/res/offline_auth_req.json b/test/RADemoTV/res/offline_auth_req.json
new file mode 100644 (file)
index 0000000..776759d
--- /dev/null
@@ -0,0 +1,30 @@
+[
+    {
+        "header": {
+            "upv": {
+                "major": 1,
+                "minor": 0
+            },
+            "op": "Auth",
+            "serverData": "emKubKMS8RxYOth7J8enT_x7dQWBaO1CiC0fGmSEhX56kq2RYo1LRpwvfHlzYRI3p9Ay-l4zJcV3lX6rQ0CYNWi5nNDabClFm3k0pPj0kX5V-db9ejN_05y2J6wqztSD"
+        },
+        "challenge": "1AM2yZY4-9SG4Ns7-hMdB8IV_FTDKFFiUqNJNVbsVoo",
+        "policy": {
+                       "accepted": [
+                               [{
+                                       "aaid": ["DDDD#0000"],
+                                       "keyIDs": ["sdfsdfsferere"]
+                               }],
+                               [{
+                                       "aaid": ["TEST#1111"],
+                                       "keyIDs": ["TEXT1"]
+                               }],
+                               [{
+                                       "aaid": ["TEST#1111"],
+                                       "keyIDs": ["aW52YWxpZGtleWlkZm9ydGVzdDEyMzQ1"]
+                               }]
+                       ]
+        }
+    }
+]
+
diff --git a/test/RADemoTV/res/offline_dereg_req.json b/test/RADemoTV/res/offline_dereg_req.json
new file mode 100644 (file)
index 0000000..837b501
--- /dev/null
@@ -0,0 +1,17 @@
+[
+    {
+        "header": {
+            "upv": {
+                "major": "1",
+                "minor": "0"
+            },
+            "op": "Dereg"
+        },
+        "authenticators": [
+            {
+                               "aaid": "TEST#1111",
+                "keyID": "TEXT1"
+            }
+        ]
+    }
+]
diff --git a/test/RADemoTV/res/offline_reg_req.json b/test/RADemoTV/res/offline_reg_req.json
new file mode 100644 (file)
index 0000000..f664ea4
--- /dev/null
@@ -0,0 +1,32 @@
+[
+    {
+        "header": {
+            "upv": {
+                "major": 1,
+                "minor": 0
+            },
+"op":"Reg",
+            "serverData": "nwV8EPqS5raZdAgH3GD9Z-ytCA9MkiiWaCsr1GHHNJ2yUh3HaV1HHxd4Z67FefJOD5sQYZvipfg5BavhdWPMecD2SH39aJixoXN9ZaNwRlcftJe9WbtPNDC9q5V9WX7Z5jCwkAwehcI"
+        },
+        "challenge": "9pIcUwwrY5eD9o3OwfhkeHLnoIl0vaeJUbxSHMe_XgE",
+"username":"TEXT1",
+        "policy": {
+            "accepted": [
+                [
+                    {
+                        "aaid": [
+                            "TEST#1111"
+                        ]
+                    }
+                ],
+                [
+                    {
+                        "aaid": [
+                            "DDDD#XXXX"
+                        ]
+                    }
+                ]
+            ]
+        }
+    }
+]
diff --git a/test/RADemoTV/res/ui-controls.edc b/test/RADemoTV/res/ui-controls.edc
new file mode 100644 (file)
index 0000000..565603f
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+collections {
+   base_scale: 2.6;
+   #include "../edc_resource/layout.edc"
+   #include "../edc_resource/datetime.edc"
+   #include "../edc_resource/entry.edc"
+   #include "../edc_resource/slider.edc"
+   #include "../edc_resource/progressbar.edc"
+   #include "../edc_resource/button.edc"
+   #include "../edc_resource/pagecontrol.edc"
+   #include "../edc_resource/popup_custom.edc"
+   #include "../edc_resource/label.edc"
+   #include "../edc_resource/genlist.edc"
+   #include "../edc_resource/default/inc/my_button_header.edc"
+   #include "../edc_resource/default/my_button.edc"
+   #include "../edc_resource/accessibility/screen_reader/description.edc"
+   #include "../edc_resource/accessibility/screen_reader/reading_order.edc"
+   #include "../edc_resource/accessibility/screen_reader/custom_frame.edc"
+}
+
diff --git a/test/RADemoTV/shared/res/fido.png b/test/RADemoTV/shared/res/fido.png
new file mode 100644 (file)
index 0000000..e8e4340
Binary files /dev/null and b/test/RADemoTV/shared/res/fido.png differ
diff --git a/test/RADemoTV/shared/res/rademotv.png b/test/RADemoTV/shared/res/rademotv.png
new file mode 100644 (file)
index 0000000..9765b1b
Binary files /dev/null and b/test/RADemoTV/shared/res/rademotv.png differ
diff --git a/test/RADemoTV/slider.edc b/test/RADemoTV/slider.edc
new file mode 100644 (file)
index 0000000..4e766b5
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+group { name: "slider_layout";
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 320 0;
+            max: 320 -1;
+         }
+      }
+      part { name: "top_pad";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.0;
+            min: 0 50;
+            fixed: 0 1;
+            rel1.to: "bg";
+            rel2 {
+               relative: 1.0 0.0;
+               to: "bg";
+            }
+         }
+      }
+      part { name: "elm.swallow.content1";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.0;
+            rel1 {
+               relative: 0.0 1.0;
+               to: "top_pad";
+            }
+            rel2 {
+               relative: 1.0 0.0;
+               to: "top_pad";
+            }
+            fixed: 1 1;
+         }
+      }
+      part { name: "bottom_pad";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 10;
+            max: -1 10;
+            align: 0.0 0.0;
+            rel1 {
+               relative: 0.0 1.0;
+               to: "elm.swallow.content1";
+            }
+            rel2.to: "elm.swallow.content1";
+            fixed: 0 1;
+         }
+      }
+      part { name: "elm.swallow.content2";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.0;
+            rel1 {
+               to: "bottom_pad";
+               relative: 0.0 1.0;
+            }
+            rel2 {
+               to: "bottom_pad";
+               relative: 1.0 1.0;
+            }
+            fixed: 1 1;
+         }
+      }
+      part { name: "bottom_pad1";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 10;
+            max: -1 10;
+            align: 0.0 0.0;
+            rel1 {
+               relative: 0.0 1.0;
+               to: "elm.swallow.content2";
+            }
+            rel2.to: "elm.swallow.content2";
+            fixed: 0 1;
+         }
+      }
+      part { name: "elm.swallow.content3";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.0;
+            rel1 {
+               to: "bottom_pad1";
+               relative: 0.0 1.0;
+            }
+            rel2 {
+               to: "bottom_pad1";
+               relative: 1.0 1.0;
+            }
+            fixed: 1 1;
+         }
+      }
+      part { name: "bottom_pad2";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 10;
+            max: -1 10;
+            align: 0.0 0.0;
+            rel1 {
+               relative: 0.0 1.0;
+               to: "elm.swallow.content3";
+            }
+            rel2.to: "elm.swallow.content3";
+            fixed: 0 1;
+         }
+      }
+      part { name: "elm.swallow.content4";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            align: 0.0 0.0;
+            rel1 {
+               to: "bottom_pad2";
+               relative: 0.0 1.0;
+            }
+            rel2 {
+               to: "bottom_pad2";
+               relative: 1.0 1.0;
+            }
+            fixed: 1 1;
+         }
+      }
+   }
+}
diff --git a/test/RADemoTV/src/fido_handler.c b/test/RADemoTV/src/fido_handler.c
new file mode 100644 (file)
index 0000000..27effca
--- /dev/null
@@ -0,0 +1,542 @@
+/*
+ * fido_handler.c
+ *
+ *  Created on: Sep 7, 2016
+ *      Author: manasij.r
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <glib.h>
+#include <json-glib/json-glib.h>
+#include <openssl/bio.h>
+#include <openssl/evp.h>
+#include <openssl/buffer.h>
+
+#include <fido.h>
+#include "rademotv.h"
+
+#include "util.h"
+#include "fido_handler.h"
+
+#define APP_SHARED_PATH "/home/owner/apps_rw/org.example.rademotv/shared/data/"
+#define REG_REQ_FILE_NAME_OFFLINE "/home/owner/apps_rw/org.example.rademotv/res/offline_reg_req.json"
+#define AUTH_REQ_FILE_NAME_OFFLINE "/home/owner/apps_rw/org.example.rademotv/res/offline_auth_req.json"
+#define DEREG_REQ_FILE_NAME_OFFLINE "/home/owner/apps_rw/org.example.rademotv/res/offline_dereg_req.json"
+
+#define _UAF_OPERATION_NAME_KEY_REG "Reg"
+
+#define _UAF_OPERATION_NAME_KEY_AUTH "Auth"
+
+#define _UAF_OPERATION_NAME_KEY_DE_REG "Dereg"
+
+#define TAG_UAFV1_REG_ASSERTION 0x3E01
+
+#define TAG_UAFV1_AUTH_ASSERTION 0x3E02
+
+#define TAG_UAFV1_KRD 0x3E03
+
+#define TAG_UAFV1_SIGNED_DATA 0x3E04
+
+#define TAG_ATTESTATION_CERT 0x2E05
+
+#define TAG_SIGNATURE 0x2E06
+
+#define TAG_ATTESTATION_BASIC_FULL 0x3E07
+
+#define TAG_ATTESTATION_BASIC_SURROGATE 0x3E08
+
+#define TAG_KEYID 0x2E09
+
+#define TAG_FINAL_CHALLENGE 0x2E0A
+
+#define TAG_AAID 0x2E0B
+
+#define TAG_PUB_KEY 0x2E0C
+
+#define TAG_COUNTERS 0x2E0D
+
+#define TAG_ASSERTION_INFO 0x2E0E
+
+#define TAG_AUTHENTICATOR_NONCE 0x2E0F
+
+#define TAG_TRANSACTION_CONTENT_HASH 0x2E10
+
+#define TAG_EXTENSION 0x3E11, 0x3E12
+
+#define TAG_EXTENSION_ID 0x2E13
+
+#define TAG_EXTENSION_DATA 0x2E14
+
+typedef struct _fh {
+       on_reg_resp reg_cb;
+       on_auth_resp auth_cb;
+       on_dereg_resp dreg_cb;
+       void *user_data;
+} fh_t;
+
+typedef struct __attribute__((packed)) _tlv {
+       uint16_t type;
+       uint16_t len;
+       uint8_t *val;
+} _tlv_t;
+
+void
+_free_tlv(_tlv_t *data)
+{
+       RET_IF_FAIL_VOID(data != NULL);
+
+       SAFE_DELETE(data->val);
+       SAFE_DELETE(data);
+}
+
+static char*
+__replace(const char *orig_str, const char *tok, const char *rplace_tok)
+{
+       if ((orig_str == NULL) || (tok == NULL) || (rplace_tok == NULL))
+               return NULL;
+
+       gchar **tok_arr = g_strsplit(orig_str, tok, 2);
+       if (tok_arr == NULL)
+               return NULL;
+
+
+       int target_len = strlen(orig_str) - strlen(tok) + strlen(rplace_tok) + 1;
+       char *new_str = calloc(target_len, sizeof(char));
+
+       snprintf(new_str, target_len - 1, "%s%s%s", strdup(tok_arr[0]), strdup(rplace_tok), strdup(tok_arr[1]));
+
+       return new_str;
+
+}
+
+static char*
+__read(const char *file_name)
+{
+       FILE *file = fopen(file_name, "rb");
+       if (file == NULL)
+               return NULL;
+
+       fseek(file, 0, SEEK_END);
+       long size = ftell(file);
+       if (size <= 0) {
+               fclose(file);
+               return NULL;
+       }
+
+       fseek(file, 0, SEEK_SET);
+
+       char *json = calloc(1, size + 1);
+       int num_bytes = fread(json, size, 1, file);
+       if (num_bytes <= 0) {
+               free(json);
+               fclose(file);
+               return NULL;
+       }
+
+       json[size] = '\0';
+
+       fclose(file);
+
+       return json;
+
+}
+
+static _tlv_t*
+__get_tlv_pack_by_type(const guchar *tlv_buffer_in, uint16_t type_in, int max_len_in)
+{
+       int i = 0;
+
+       while (1) {
+               uint16_t lb = tlv_buffer_in[i + 0];
+               uint16_t  hb = tlv_buffer_in[i + 1];
+
+               uint16_t val = hb << 8;
+               val = val | lb;
+
+               uint16_t type = val;
+
+               lb = 0;
+               hb = 0;
+               val = 0;
+
+               lb = tlv_buffer_in[i + 2];
+               hb = tlv_buffer_in[i + 3];
+
+               val = hb << 8;
+               val = val | lb;
+
+               uint16_t length = val;
+
+               if (type == type_in) {
+                       _tlv_t *tlv = (_tlv_t*)calloc(1, sizeof(_tlv_t));
+                       tlv->type = type;
+                       tlv->len = length;
+                       if (tlv->len > 0) {
+                               tlv->val = (uint8_t *)calloc(1, tlv->len);
+                               memcpy(tlv->val, tlv_buffer_in + i + 2 + 2, tlv->len);
+                       }
+                       return tlv;
+               }
+
+               i += 2 + 2 + length;
+               if (i >= max_len_in)
+                       break;
+       }
+
+       return NULL;
+}
+
+static int
+genB64Encode(const unsigned char *input, int inlen, unsigned char * output, int *outlen)
+{
+       BIO * bmem = NULL;
+       BIO * b64 = NULL;
+       BUF_MEM * bptr = NULL;
+       b64 = BIO_new(BIO_f_base64());
+       if (b64 == NULL)        {
+               return -1;
+       }
+       BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
+
+       bmem = BIO_new(BIO_s_mem());
+       b64 = BIO_push(b64, bmem);
+       BIO_write(b64, input, inlen);
+       BIO_flush(b64);
+       BIO_get_mem_ptr(b64, &bptr);
+
+       memcpy(output, bptr->data, bptr->length);
+       output[bptr->length] = 0;
+       *outlen = bptr->length;
+       if(b64) {
+               BIO_free_all(b64);
+       }
+
+       for(int i =0; i < *outlen ; i++) {
+               if(output[i] == '+') {
+                       output[i] = '-';
+               }
+               else if(output[i] == '/') {
+                       output[i] = '_';
+               }
+               else if(output[i] == '=') {
+                       *outlen = i ;
+                       output[i] = '\0';
+                       break;
+               }
+       }
+
+       return 0;
+}
+
+static unsigned char*
+__b64url_encode(const unsigned char *input, int inputLen)
+{
+       if (input == NULL)
+               return NULL;
+
+       int inputSz = inputLen;
+
+       unsigned char* output = NULL;
+
+       output = (unsigned char*)calloc(1, inputSz*1.5);
+
+       int outputSz = 0;
+
+       if (0 != genB64Encode(input, inputSz, output, &outputSz)) {
+               free(output);
+               return (unsigned char*)"";
+       }
+
+       return output;
+}
+
+static int
+__b64url_decode(const unsigned char* in, int inlen,
+                                       unsigned char* out, int* outlen)
+{
+
+       int npadChars = (inlen % 4) == 0 ? 0 : (4 - (inlen % 4));
+       unsigned char* base64 = (unsigned char*) malloc(inlen + npadChars);
+       if (base64 == NULL) {
+               return -1;
+       }
+
+       memcpy(base64, in, inlen);
+
+       int i;
+       for (i = 0; i < inlen; i++)     {
+               if (base64[i] == '-')
+                       base64[i] = '+';
+
+               else if (base64[i] == '_')
+                       base64[i] = '/';
+
+       }
+
+       if (npadChars != 0)
+               memset(base64 + inlen, '=', npadChars);
+
+       BIO* b64 = NULL;
+       BIO* bmem = NULL;
+       b64 = BIO_new(BIO_f_base64());
+       if (b64 == NULL) {
+               if (base64) {
+                       free(base64);
+                       base64 = NULL;
+               }
+               return -1;
+       }
+       BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
+       bmem = BIO_new_mem_buf(base64, inlen);
+       if (bmem == NULL) {
+               if (base64) {
+                       free(base64);
+                       base64 = NULL;
+               }
+               return -1;
+       }
+
+       bmem = BIO_push(b64, bmem);
+       *outlen = BIO_read(bmem, out, inlen);
+       if (*outlen <= 0)
+       {
+               if (base64) {
+                       free(base64);
+                       base64 = NULL;
+               }
+               return -1;
+       }
+
+       if (bmem)
+               BIO_free_all(bmem);
+
+       return 0;
+}
+
+static fido_reg_assertion_t*
+__tlv_decode_reg_assertion(const char *tlv_enc)
+{
+       RET_IF_FAIL(tlv_enc != NULL, NULL);
+
+       int in_len = strlen(tlv_enc);
+       int tlv_dec_len = in_len * 1.5;
+       unsigned char *tlv_dec = calloc(1, tlv_dec_len);
+
+       int r = __b64url_decode((unsigned char *)tlv_enc, in_len, tlv_dec, &tlv_dec_len);
+       RET_IF_FAIL(r == 0, NULL);
+
+       _tlv_t *reg_tlv = __get_tlv_pack_by_type(tlv_dec, TAG_UAFV1_REG_ASSERTION, tlv_dec_len);
+       if (reg_tlv != NULL) {
+
+               _free_tlv(reg_tlv);
+
+               int krd_start_idx = 2 + 2;
+
+               _tlv_t *krd_tlv = __get_tlv_pack_by_type(tlv_dec + krd_start_idx, TAG_UAFV1_KRD, (tlv_dec_len - krd_start_idx));
+               if (krd_tlv != NULL) {
+                       _free_tlv(krd_tlv);
+
+                       int krd_inner_start_idx = krd_start_idx + 2 + 2;
+
+                       _tlv_t *aaid_tlv = __get_tlv_pack_by_type(tlv_dec + krd_inner_start_idx, TAG_AAID, (tlv_dec_len - krd_inner_start_idx));
+
+                       _tlv_t *key_id_tlv = __get_tlv_pack_by_type(tlv_dec + krd_inner_start_idx, TAG_KEYID, (tlv_dec_len - krd_inner_start_idx));
+
+
+                       fido_reg_assertion_t *assrt_tlv = (fido_reg_assertion_t*)calloc(1, sizeof(fido_reg_assertion_t));
+
+                       if (aaid_tlv != NULL) {
+
+                               assrt_tlv->aaid = (char*)calloc(1, aaid_tlv->len + 1);
+                               memcpy(assrt_tlv->aaid, aaid_tlv->val, aaid_tlv->len);
+
+                               _free_tlv(aaid_tlv);
+                       }
+
+                       if (key_id_tlv != NULL) {
+
+                               assrt_tlv->kid = (unsigned char*)calloc(1, key_id_tlv->len);
+                               memcpy(assrt_tlv->kid, key_id_tlv->val, key_id_tlv->len);
+
+                               assrt_tlv->kid_len = key_id_tlv->len;
+
+
+                               _free_tlv(key_id_tlv);
+                       }
+
+                       return assrt_tlv;
+               }
+       }
+
+
+       return NULL;
+}
+
+static fido_reg_assertion_t*
+__fido_handler_decode_reg_assertion(const char *uaf_reg_resp)
+{
+       if (uaf_reg_resp == NULL)
+               return NULL;
+
+
+       JsonParser *parser = json_parser_new();
+
+       GError * err = NULL;
+       json_parser_load_from_data(parser, uaf_reg_resp, -1, &err);
+       if (err != NULL)
+               return NULL;
+
+       JsonNode *root = json_parser_get_root(parser);
+       RET_IF_FAIL(root != NULL, NULL);
+
+       JsonArray *root_arr = json_node_get_array(root);
+       RET_IF_FAIL(root_arr != NULL, NULL);
+
+       JsonObject *arr_elem_obj = json_array_get_object_element(root_arr, 0);
+       RET_IF_FAIL(arr_elem_obj != NULL, NULL);
+
+       JsonArray *asrt_arr = json_object_get_array_member(arr_elem_obj, "assertions");
+       RET_IF_FAIL(asrt_arr != NULL, NULL);
+
+       JsonObject *assrt_arr_obj = json_array_get_object_element(asrt_arr, 0);
+       RET_IF_FAIL(assrt_arr_obj != NULL, NULL);
+
+       const char *assrt_str = json_object_get_string_member(assrt_arr_obj, "assertion");
+       RET_IF_FAIL(assrt_str != NULL, NULL);
+
+
+       return __tlv_decode_reg_assertion(assrt_str);
+}
+
+static char*
+__fido_handler_get_json_reg_req(const char *uname)
+{
+       char *json_orig = __read(REG_REQ_FILE_NAME_OFFLINE);
+       if (json_orig == NULL)
+               return NULL;
+
+       return __replace(json_orig, "TEXT1", uname);
+}
+
+static char*
+__fido_handler_get_json_auth_req(const char *kid)
+{
+       char *json_orig = __read(AUTH_REQ_FILE_NAME_OFFLINE);
+       if (json_orig == NULL)
+               return NULL;
+
+       char *kid_enc = __b64url_encode(kid, strlen(kid));
+       return __replace(json_orig, "TEXT1", kid_enc);
+}
+
+static char*
+__fido_handler_get_json_dereg_req(const char *kid)
+{
+       char *json_orig = __read(DEREG_REQ_FILE_NAME_OFFLINE);
+       if (json_orig == NULL)
+               return NULL;
+
+       char *kid_enc = __b64url_encode(kid, strlen(kid));
+       return __replace(json_orig, "TEXT1", kid_enc);
+}
+
+void
+__reg_cb(fido_error_e tizen_error_code, const char *uaf_response_json, void *user_data)
+{
+
+       fh_t *fh = user_data;
+       if (tizen_error_code != FIDO_ERROR_NONE) {
+               fh->reg_cb(NULL, tizen_error_code, fh->user_data);
+
+               return;
+       }
+
+       fido_reg_assertion_t *reg_data = __fido_handler_decode_reg_assertion(uaf_response_json);
+       fh->reg_cb(reg_data, tizen_error_code, fh->user_data);
+
+}
+
+static void
+__auth_cb(fido_error_e tizen_error_code, const char *uaf_response_json, void *user_data)
+{
+
+       fh_t *fh = user_data;
+       if (tizen_error_code != FIDO_ERROR_NONE) {
+               fh->auth_cb(NULL, tizen_error_code, fh->user_data);
+
+               return;
+       }
+
+       fido_reg_assertion_t *reg_data = __fido_handler_decode_reg_assertion(uaf_response_json);
+       fh->auth_cb(reg_data, tizen_error_code, fh->user_data);
+
+}
+
+static void
+__dreg_cb(fido_error_e tizen_error_code, const char *uaf_response_json, void *user_data)
+{
+       fh_t *fh = user_data;
+       fh->dreg_cb(tizen_error_code, fh->user_data);
+}
+
+int
+fido_handler_req_reg(const char *uname, on_reg_resp cb, void *user_data)
+{
+       dlog_print(DLOG_INFO, LOG_TAG, "rademo uname=[%s]", uname);
+
+       char *reg_req = __fido_handler_get_json_reg_req(uname);
+       if (reg_req == NULL)
+               return -1;
+
+       dlog_print(DLOG_INFO, LOG_TAG, "rademo req=[%s]", reg_req);
+
+       fh_t *fh = calloc(1, sizeof(fh_t));
+       fh->reg_cb = cb;
+       fh->user_data = user_data;
+
+       int ret = fido_uaf_get_response_message(reg_req, NULL, __reg_cb, fh);
+       if (ret != FIDO_ERROR_NONE)
+               free(fh);
+
+       return ret;
+}
+
+int
+fido_handler_req_auth(const char *kid, on_auth_resp cb, void *user_data)
+{
+       char *auth_req = __fido_handler_get_json_auth_req(kid);
+       if (auth_req == NULL)
+               return -1;
+
+       fh_t *fh = calloc(1, sizeof(fh_t));
+       fh->auth_cb = cb;
+       fh->user_data = user_data;
+
+       int ret = fido_uaf_get_response_message(auth_req, NULL, __auth_cb, fh);
+       if (ret != FIDO_ERROR_NONE)
+               free(fh);
+
+       return ret;
+}
+
+
+int
+fido_handler_req_dereg(const char *kid, on_dereg_resp cb, void *user_data)
+{
+       char *dreg_req = __fido_handler_get_json_dereg_req(kid);
+       if (dreg_req == NULL)
+               return -1;
+
+       fh_t *fh = calloc(1, sizeof(fh_t));
+       fh->dreg_cb = cb;
+       fh->user_data = user_data;
+
+       int ret = fido_uaf_get_response_message(dreg_req, NULL, __dreg_cb, fh);
+       if (ret != FIDO_ERROR_NONE)
+               free(fh);
+
+
+       return ret;
+}
+
diff --git a/test/RADemoTV/src/rademotv.c b/test/RADemoTV/src/rademotv.c
new file mode 100644 (file)
index 0000000..c3bb27a
--- /dev/null
@@ -0,0 +1,531 @@
+/*
+ * Copyright (c) 2014 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 <fido.h>
+#include <dlog.h>
+#include "rademotv.h"
+#include "storage_handler.h"
+#include "fido_handler.h"
+
+
+#define USERNAME "Manasij"
+
+#define ELM_DEMO_EDJ "/home/owner/apps_rw/org.example.rademotv/res/ui-controls.edj"
+
+typedef struct _popup_data {
+       Evas_Object *popup;
+       char *str;
+} popup_data;
+
+static void
+__popup_finish(void *data, Evas_Object *obj, void *event_info)
+{
+       evas_object_del(data);
+}
+
+static void
+__wait_popup_back(void *data, Evas_Object *obj, void *event_info)
+{
+       /*Ignore*/
+}
+
+static void
+__hide_waiting(appdata_s *ad)
+{
+       if (ad->w_popup == NULL)
+               return;
+
+       evas_object_hide(ad->w_popup);
+       evas_object_del(ad->w_popup);
+       ad->w_popup = NULL;
+
+       return;
+}
+
+static void
+__show_waiting(char *popup_str, appdata_s *ad)
+{
+       ad->w_popup = elm_popup_add(ad->win);
+
+       elm_popup_align_set(ad->w_popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+       evas_object_size_hint_weight_set(ad->w_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_object_text_set(ad->w_popup, popup_str);
+
+       eext_object_event_callback_add(ad->w_popup, EEXT_CALLBACK_BACK, __wait_popup_back, NULL);
+
+       evas_object_show(ad->w_popup);
+
+       return;
+}
+
+static void
+create_popup(char *popup_str, appdata_s *ad)
+{
+       Evas_Object *popup = elm_popup_add(ad->win);
+       Evas_Object *btn;
+
+       elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+       evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_object_text_set(popup, popup_str);
+
+       btn = elm_button_add(popup);
+       elm_object_style_set(btn, "popup");
+       evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_object_text_set(btn, "OK");
+       elm_object_part_content_set(popup, "button1", btn);
+       eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL);
+
+       evas_object_smart_callback_add(btn, "clicked", __popup_finish, popup);
+
+       evas_object_show(popup);
+
+       return;
+}
+
+static char *
+__get_error_str(fido_error_e error_code)
+{
+
+       char *error_str = calloc(1,128);
+
+       if(error_code == FIDO_ERROR_NONE)
+               strcpy(error_str, "SUCCESS");
+       else if (error_code == FIDO_ERROR_OUT_OF_MEMORY)
+               strcpy(error_str, "FIDO_ERROR_OUT_OF_MEMORY");
+       else if (error_code == FIDO_ERROR_INVALID_PARAMETER)
+               strcpy(error_str, "FIDO_ERROR_INVALID_PARAMETER");
+       else if (error_code == FIDO_ERROR_NO_DATA)
+               strcpy(error_str, "FIDO_ERROR_NO_DATA");
+       else if (error_code == FIDO_ERROR_PERMISSION_DENIED)
+               strcpy(error_str, "FIDO_ERROR_PERMISSION_DENIED");
+       else if (error_code == FIDO_ERROR_NOT_SUPPORTED)
+               strcpy(error_str, "FIDO_ERROR_NOT_SUPPORTED");
+       else if (error_code == FIDO_ERROR_USER_ACTION_IN_PROGRESS)
+               strcpy(error_str, "FIDO_ERROR_USER_ACTION_IN_PROGRESS");
+       else if (error_code == FIDO_ERROR_USER_CANCELLED)
+               strcpy(error_str, "FIDO_ERROR_USER_CANCELLED");
+       else if (error_code == FIDO_ERROR_UNSUPPORTED_VERSION)
+               strcpy(error_str, "FIDO_ERROR_UNSUPPORTED_VERSION");
+       else if (error_code == FIDO_ERROR_NO_SUITABLE_AUTHENTICATOR)
+               strcpy(error_str, "FIDO_ERROR_NO_SUITABLE_AUTHENTICATOR");
+       else if (error_code == FIDO_ERROR_PROTOCOL_ERROR)
+               strcpy(error_str, "FIDO_ERROR_PROTOCOL_ERROR");
+       else if (error_code == FIDO_ERROR_UNTRUSTED_FACET_ID)
+               strcpy(error_str, "FIDO_ERROR_UNTRUSTED_FACET_ID");
+       else
+               strcpy(error_str, "FIDO_ERROR_UNKNOWN");
+       return error_str;
+}
+
+//static void
+//__show_error(int tizen_error_code, appdata_s *app_data)
+//{
+//     char *error_string = get_error_code(tizen_error_code);
+//     create_popup(error_string, app_data, false);
+//     free(error_string);
+//}
+
+static void
+win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       /* To make your application go to background,
+               Call the elm_win_lower() instead
+               Evas_Object *win = (Evas_Object *) data;
+               elm_win_lower(win); */
+       ui_app_exit();
+}
+
+static void
+list_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       Elm_Object_Item *it = event_info;
+       elm_list_item_selected_set(it, EINA_FALSE);
+}
+
+static Eina_Bool
+naviframe_pop_cb(void *data, Elm_Object_Item *it)
+{
+       ui_app_exit();
+       return EINA_FALSE;
+}
+
+static void
+__reg_cb(fido_reg_assertion_t *reg_resp, int err, void *user_data)
+{
+       appdata_s *ad = user_data;
+
+       __hide_waiting(ad);
+
+       if (reg_resp == NULL || err != 0) {
+               create_popup(__get_error_str(err), ad);
+               return;
+       }
+
+       fido_data_t *data = calloc(1, sizeof(fido_data_t));
+       data->aaid = reg_resp->aaid;
+       data->kid = reg_resp->kid;
+       data->uname = strdup(ad->uname);
+
+       storage_handler_store(data);
+
+       free(data->uname);
+       free(data);
+
+       create_popup("Registered Successfully", ad);
+       create_list_view(ad);
+}
+
+static void
+__auth_cb(fido_reg_assertion_t *reg_resp, int err, void *user_data)
+{
+       appdata_s *ad = user_data;
+
+       __hide_waiting(ad);
+
+       if (reg_resp == NULL || err != 0) {
+               create_popup(__get_error_str(err), ad);
+               return;
+       }
+
+       fido_data_t *resp_data = calloc(1, sizeof(fido_data_t));
+       resp_data->aaid = reg_resp->aaid;
+
+       fido_data_t *stored_data = storage_handler_search(resp_data);
+       if (stored_data == NULL) {
+               create_popup("Authentication Failed", ad);
+       } else {
+               /*TODO Key verification*/
+               create_popup("Authenticated Successfully", ad);
+       }
+
+       create_list_view(ad);
+}
+
+static void
+__dereg_cb(int err, void *user_data)
+{
+       appdata_s *ad = user_data;
+
+       __hide_waiting(ad);
+
+       if (err != 0) {
+               create_popup("De-Registration Failed", ad);
+               return;
+       }
+
+       int ret = storage_handler_delete_all();
+       if (ret == 0) {
+               create_popup("De-Registration Completed", ad);
+       } else {
+               /*TODO Key verification*/
+               create_popup("De-Registration Failed", ad);
+       }
+
+       create_list_view(ad);
+}
+
+static void
+__uname_set(void *data, Evas_Object *obj, void *event_info)
+{
+       appdata_s *ad = data;
+       const char *ip = elm_entry_entry_get(ad->u_entry);
+
+       if (ip == NULL)
+               return;
+
+       ad->uname = strdup(ip);
+       dlog_print(DLOG_INFO, LOG_TAG, "rademo uname=[%s]", ad->uname);
+
+       //char *uname = strdup(ip);
+       int ret = fido_handler_req_reg(ad->uname, __reg_cb, ad);
+       evas_object_del(ad->u_popup);
+       if (ret != 0) {
+               create_popup(__get_error_str(ret), ad);
+               return;
+       }
+       __show_waiting("Waiting for Accessory Device Response", ad);
+}
+
+static void
+__get_uname_from_user(appdata_s *ad)
+{
+       /* popup */
+       ad->u_popup = elm_popup_add(ad->nf);
+       elm_popup_align_set(ad->u_popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+       eext_object_event_callback_add(ad->u_popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL);
+       evas_object_size_hint_weight_set(ad->u_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_object_part_text_set(ad->u_popup, "title,text", "Enter User Name");
+
+       ad->u_layout = elm_layout_add(ad->u_popup);
+       elm_layout_file_set(ad->u_layout, ELM_DEMO_EDJ, "popup_input_text");
+       evas_object_size_hint_weight_set(ad->u_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_object_content_set(ad->u_popup, ad->u_layout);
+
+       ad->u_entry = elm_entry_add(ad->u_layout);
+       elm_entry_single_line_set(ad->u_entry, EINA_TRUE);
+       elm_entry_scrollable_set(ad->u_entry, EINA_TRUE);
+       evas_object_size_hint_weight_set(ad->u_entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(ad->u_entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       eext_entry_selection_back_event_allow_set(ad->u_entry, EINA_TRUE);
+       //elm_object_part_text_set(ad->u_entry, "elm.guide", "Guide Text");
+       elm_object_part_content_set(ad->u_layout, "elm.swallow.content" , ad->u_entry);
+
+       /* Set button */
+       Evas_Object *btn = elm_button_add(ad->u_popup);
+       elm_object_style_set(btn, "popup");
+       elm_object_text_set(btn, "Set");
+       elm_object_part_content_set(ad->u_popup, "button1", btn);
+       evas_object_smart_callback_add(btn, "clicked", __uname_set, ad);
+
+       evas_object_show(ad->u_popup);
+}
+
+void
+start_reg(void *data, Evas_Object *obj, void *event_info)
+{
+       __get_uname_from_user(data);
+}
+
+void
+start_auth(void *data, Evas_Object *obj, void *event_info)
+{
+       fido_data_t *stored_data = storage_handler_search(NULL);
+       if (stored_data == NULL || stored_data->kid == NULL) {
+               appdata_s *ad = data;
+               create_popup("Not Registered", ad);
+               return;
+       }
+
+       int ret = fido_handler_req_auth(stored_data->kid, __auth_cb, data);
+       if (ret != 0) {
+               appdata_s *ad = data;
+               create_popup(__get_error_str(ret), ad);
+               return;
+       }
+       __show_waiting("Waiting for Accessory Device Response", data);
+}
+
+void
+start_dereg(void *data, Evas_Object *obj, void *event_info)
+{
+       fido_data_t *stored_data = storage_handler_search(NULL);
+       if (stored_data == NULL || stored_data->kid == NULL) {
+               appdata_s *ad = data;
+               create_popup("Not Registered", ad);
+               return;
+       }
+
+       int ret = fido_handler_req_dereg(stored_data->kid, __dereg_cb, data);
+       if (ret != 0) {
+               appdata_s *ad = data;
+               create_popup(__get_error_str(ret), ad);
+               return;
+       }
+       __show_waiting("Waiting for Accessory Device Response", data);
+}
+
+void
+create_list_view(appdata_s *ad)
+{
+       if (ad->list != NULL)
+               elm_list_clear(ad->list);
+
+       Evas_Object *btn;
+       Evas_Object *nf = ad->nf;
+       Elm_Object_Item *nf_it;
+       ad->stored_data = storage_handler_search(NULL);
+
+       /* List */
+       ad->list = elm_list_add(nf);
+       elm_list_mode_set(ad->list, ELM_LIST_COMPRESS);
+       evas_object_smart_callback_add(ad->list, "selected", list_selected_cb, NULL);
+
+       /* Main Menu Items Here */
+       if (ad->stored_data == NULL) {
+               elm_list_item_append(ad->list, "Register New User", NULL, NULL, start_reg, ad);
+       } else {
+               elm_list_item_append(ad->list, "Authenticate", NULL, NULL, start_auth, ad);
+               elm_list_item_append(ad->list, "De-Register", NULL, NULL, start_dereg, ad);
+       }
+
+       elm_list_go(ad->list);
+
+       /* This button is set for devices which doesn't have H/W back key. */
+       btn = elm_button_add(nf);
+       elm_object_style_set(btn, "naviframe/end_btn/default");
+       if (ad->stored_data == NULL) {
+               nf_it = elm_naviframe_item_push(nf, "No Previous Registration", btn, NULL, ad->list, NULL);
+       } else {
+               nf_it = elm_naviframe_item_push(nf, ad->stored_data->uname, btn, NULL, ad->list, NULL);
+       }
+       elm_naviframe_item_pop_cb_set(nf_it, naviframe_pop_cb, ad->win);
+}
+
+static void
+create_base_gui(appdata_s *ad)
+{
+       /*
+        * Widget Tree
+        * Window
+        *  - conform
+        *   - layout main
+        *    - naviframe */
+
+       /* Window */
+       ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
+       elm_win_conformant_set(ad->win, EINA_TRUE);
+       elm_win_autodel_set(ad->win, EINA_TRUE);
+
+       if (elm_win_wm_rotation_supported_get(ad->win)) {
+               int rots[4] = { 0, 90, 180, 270 };
+               elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
+       }
+
+       evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
+
+       /* Conformant */
+       ad->conform = elm_conformant_add(ad->win);
+       evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(ad->win, ad->conform);
+       evas_object_show(ad->conform);
+
+       /* Indicator */
+       /* elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW); */
+
+       /* Base Layout */
+       ad->layout = elm_layout_add(ad->conform);
+       evas_object_size_hint_weight_set(ad->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_layout_theme_set(ad->layout, "layout", "application", "default");
+       evas_object_show(ad->layout);
+
+       elm_object_content_set(ad->conform, ad->layout);
+
+       /* Naviframe */
+       ad->nf = elm_naviframe_add(ad->layout);
+       create_list_view(ad);
+       elm_object_part_content_set(ad->layout, "elm.swallow.content", ad->nf);
+       eext_object_event_callback_add(ad->nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
+       eext_object_event_callback_add(ad->nf, EEXT_CALLBACK_MORE, eext_naviframe_more_cb, NULL);
+
+       /* Show window after base gui is set up */
+       evas_object_show(ad->win);
+}
+
+static bool
+app_create(void *data)
+{
+       /* Hook to take necessary actions before main event loop starts
+          Initialize UI resources and application's data
+          If this function returns true, the main loop of application starts
+          If this function returns false, the application is terminated */
+       appdata_s *ad = data;
+
+       elm_app_base_scale_set(1.8);
+       create_base_gui(ad);
+
+       return true;
+}
+
+static void
+app_control(app_control_h app_control, void *data)
+{
+       /* Handle the launch request. */
+}
+
+static void
+app_pause(void *data)
+{
+       /* Take necessary actions when application becomes invisible. */
+}
+
+static void
+app_resume(void *data)
+{
+       /* Take necessary actions when application becomes visible. */
+}
+
+static void
+app_terminate(void *data)
+{
+       /* Release all resources. */
+}
+
+static void
+ui_app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_LANGUAGE_CHANGED*/
+       char *locale = NULL;
+       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+       elm_language_set(locale);
+       free(locale);
+       return;
+}
+
+static void
+ui_app_orient_changed(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
+       return;
+}
+
+static void
+ui_app_region_changed(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_REGION_FORMAT_CHANGED*/
+}
+
+static void
+ui_app_low_battery(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_LOW_BATTERY*/
+}
+
+static void
+ui_app_low_memory(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_LOW_MEMORY*/
+}
+
+int
+main(int argc, char *argv[])
+{
+       appdata_s ad = {0,};
+       int ret = 0;
+
+       ui_app_lifecycle_callback_s event_callback = {0,};
+       app_event_handler_h handlers[5] = {NULL, };
+
+       event_callback.create = app_create;
+       event_callback.terminate = app_terminate;
+       event_callback.pause = app_pause;
+       event_callback.resume = app_resume;
+       event_callback.app_control = app_control;
+
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
+       ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);
+
+       ret = ui_app_main(argc, argv, &event_callback, &ad);
+       if (ret != APP_ERROR_NONE) {
+               dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
+       }
+
+       return ret;
+}
diff --git a/test/RADemoTV/src/storage_handler.c b/test/RADemoTV/src/storage_handler.c
new file mode 100644 (file)
index 0000000..6761453
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * storage_handler.c
+ *
+ *  Created on: Sep 7, 2016
+ *      Author: manasij.r
+ */
+
+#include <stdlib.h>
+#include "storage_handler.h"
+#include <app_preference.h>
+#include "util.h"
+
+int
+storage_handler_store(const fido_data_t *data)
+{
+       RET_IF_FAIL(data != NULL, -1);
+
+       preference_set_string("uname", data->uname);
+       preference_set_string("kid", data->kid);
+       preference_set_string("aaid", data->aaid);
+
+       return 0;
+}
+
+fido_data_t*
+storage_handler_search(const fido_data_t *filter)
+{
+       fido_data_t *data = calloc(1, sizeof(fido_data_t));
+
+       char *uname = NULL;
+       char *kid = NULL;
+       char *aaid = NULL;
+
+       preference_get_string("uname", &uname);
+       preference_get_string("kid", &kid);
+       preference_get_string("aaid", &aaid);
+
+       if ((uname == NULL) || (kid == NULL) || (aaid == NULL)) {
+               free(data);
+               return NULL;
+       }
+
+       if (filter == NULL) {
+               data->aaid = aaid;
+               data->kid = kid;
+               data->uname = uname;
+
+               return data;
+       }
+
+       if ((filter->aaid != NULL)) {
+
+               if (strcmp(filter->aaid, aaid) != 0) {
+                       free(data);
+                       return NULL;
+               }
+       }
+       if ((filter->kid != NULL)) {
+
+               if (strcmp(filter->kid, kid) != 0) {
+                       free(data);
+                       return NULL;
+               }
+       }
+       if ((filter->uname != NULL)) {
+
+               if (strcmp(filter->uname, uname) != 0) {
+                       free(data);
+                       return NULL;
+               }
+       }
+
+       data->aaid = aaid;
+       data->kid = kid;
+       data->uname = uname;
+
+       return data;
+}
+
+int
+storage_handler_delete_all(void)
+{
+       preference_remove_all();
+       return 0;
+}
diff --git a/test/RADemoTV/tizen-manifest.xml b/test/RADemoTV/tizen-manifest.xml
new file mode 100644 (file)
index 0000000..9d608c4
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.example.rademotv" version="1.0.0">
+    <profile name="mobile"/>
+    <ui-application appid="org.example.rademotv" exec="rademotv" launch_mode="single" multiple="false" nodisplay="false" taskmanage="true" type="capp">
+        <label>rademotv</label>
+        <icon>fido.png</icon>
+    </ui-application>
+    <privileges>
+        <privilege>http://tizen.org/privilege/fido.client</privilege>
+    </privileges>
+</manifest>
diff --git a/test/conformance_test/FIDOSample/.cproject b/test/conformance_test/FIDOSample/.cproject
new file mode 100644 (file)
index 0000000..be8f695
--- /dev/null
@@ -0,0 +1,610 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+       <storageModule moduleId="org.eclipse.cdt.core.settings">
+               <cconfiguration id="org.tizen.nativecore.config.sbi.gcc45.app.debug.1294257923">
+                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.tizen.nativecore.config.sbi.gcc45.app.debug.1294257923" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+                               <externalSettings/>
+                               <extensions>
+                                       <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+                                       <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.tizen.nativecore.NativeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                               </extensions>
+                       </storageModule>
+                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                               <configuration artifactName="fidosample" buildArtefactType="org.tizen.nativecore.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.tizen.nativecore.buildArtefactType.app,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;" id="org.tizen.nativecore.config.sbi.gcc45.app.debug.1294257923" name="Debug" parent="org.tizen.nativecore.config.sbi.gcc45.app.debug">
+                                       <folderInfo id="org.tizen.nativecore.config.sbi.gcc45.app.debug.1294257923." name="/" resourcePath="">
+                                               <toolChain id="org.tizen.nativecore.toolchain.sbi.gcc45.app.debug.457270679" name="Tizen Native Toolchain" superClass="org.tizen.nativecore.toolchain.sbi.gcc45.app.debug">
+                                                       <targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.tizen.nativeide.target.sbi.gnu.platform.base.841483355" osList="linux,win32" superClass="org.tizen.nativeide.target.sbi.gnu.platform.base"/>
+                                                       <builder autoBuildTarget="all" buildPath="${workspace_loc:/FIDOSample}/Debug" enableAutoBuild="true" id="org.tizen.nativecore.target.sbi.gnu.builder.822651865" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Tizen Application Builder" superClass="org.tizen.nativecore.target.sbi.gnu.builder"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.1098807218" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/>
+                                                       <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.187309063" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
+                                                               <option id="gnu.cpp.compiler.option.optimization.level.1553252788" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
+                                                               <option defaultValue="gnu.cpp.compiler.debugging.level.max" id="sbi.gnu.cpp.compiler.option.debugging.level.core.223559038" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core" valueType="enumerated"/>
+                                                               <option defaultValue="false" id="sbi.gnu.cpp.compiler.option.misc.pic.core.1433401865" name="-fPIC option" superClass="sbi.gnu.cpp.compiler.option.misc.pic.core" valueType="boolean"/>
+                                                               <option id="sbi.gnu.cpp.compiler.option.1365099980" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs">
+                                                                       <listOptionValue builtIn="false" value="mobile-3.0-emulator.core_llvm37.i386.core.app"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.531304528" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES3&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/KHR&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/SDL2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appcore-agent&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appfw&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/attach-panel&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/badge&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/base&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/cairo&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/calendar-service2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/chromium-ewk&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ckm&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/contacts-svc&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/content&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/context-service&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/csr&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dali&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dali-toolkit&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dbus-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/device&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dlog&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-buffer-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-con-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-file-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-imf-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-imf-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-input-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-input-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-ipc-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ector-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/e_dbus-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/edje-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-extension&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efreet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1/eina&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eio-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eldbus-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/elementary-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/embryo-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/emile-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eo-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eom&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-client-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/feedback&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/fontconfig&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/freetype2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/geofence&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/gio-unix-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/glib-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/harfbuzz&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/iotcon&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/location&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/maps&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media-content&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/messaging&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/metadata-editor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minicontrol&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minizip&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/network&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/notification&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/nsd/&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/phonenumber-utils&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/sensor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/service-adaptor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/shortcut&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/storage&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/system&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ui&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vulkan&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/web&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_service&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_viewer_evas&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/wifi-direct&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/yaca&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/dbus-1.0/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/glib-2.0/include&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.cpp.compiler.option.frameworks_cflags.core.57168434" name="Tizen-Frameworks-Other-Cflags" superClass="sbi.gnu.cpp.compiler.option.frameworks_cflags.core" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="${TC_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value=" -fPIE"/>
+                                                                       <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+                                                               </option>
+                                                               <option id="gnu.cpp.compiler.option.include.paths.601576279" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.cpp.compiler.option.frameworks.core.385644722" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs">
+                                                                       <listOptionValue builtIn="false" value="Native_API"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.174572190" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+                                                       </tool>
+                                                       <tool command="clang" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.339330986" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
+                                                               <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.1576375117" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
+                                                               <option defaultValue="gnu.c.debugging.level.max" id="sbi.gnu.c.compiler.option.debugging.level.core.1263845907" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core" valueType="enumerated"/>
+                                                               <option defaultValue="false" id="sbi.gnu.c.compiler.option.misc.pic.core.1428784412" name="-fPIC option" superClass="sbi.gnu.c.compiler.option.misc.pic.core" valueType="boolean"/>
+                                                               <option id="sbi.gnu.c.compiler.option.1757898274" name="Tizen-Target" superClass="sbi.gnu.c.compiler.option" valueType="userObjs">
+                                                                       <listOptionValue builtIn="false" value="mobile-3.0-emulator.core_llvm37.i386.core.app"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.c.compiler.option.frameworks_inc.core.1506326638" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES3&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/KHR&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/SDL2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appcore-agent&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appfw&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/attach-panel&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/badge&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/base&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/cairo&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/calendar-service2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/chromium-ewk&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ckm&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/contacts-svc&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/content&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/context-service&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/csr&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dali&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dali-toolkit&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dbus-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/device&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dlog&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-buffer-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-con-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-file-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-imf-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-imf-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-input-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-input-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-ipc-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ector-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/e_dbus-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/edje-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-extension&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efreet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1/eina&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eio-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eldbus-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/elementary-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/embryo-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/emile-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eo-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eom&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-client-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/feedback&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/fontconfig&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/freetype2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/geofence&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/gio-unix-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/glib-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/harfbuzz&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/iotcon&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/location&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/maps&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media-content&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/messaging&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/metadata-editor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minicontrol&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minizip&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/network&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/notification&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/nsd/&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/phonenumber-utils&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/sensor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/service-adaptor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/shortcut&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/storage&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/system&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ui&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vulkan&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/web&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_service&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_viewer_evas&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/wifi-direct&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/yaca&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/dbus-1.0/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/glib-2.0/include&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.c.compiler.option.frameworks_cflags.core.1367628143" name="Tizen-Frameworks-Other-Cflags" superClass="sbi.gnu.c.compiler.option.frameworks_cflags.core" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="${TC_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value=" -fPIE"/>
+                                                                       <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+                                                               </option>
+                                                               <option id="gnu.c.compiler.option.include.paths.2039918584" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.c.compiler.option.frameworks.core.173800772" name="Tizen-Frameworks" superClass="sbi.gnu.c.compiler.option.frameworks.core" valueType="userObjs">
+                                                                       <listOptionValue builtIn="false" value="Native_API"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.536039701" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+                                                       </tool>
+                                                       <tool id="org.tizen.nativeide.tool.sbi.gnu.c.linker.base.1842917047" name="C Linker" superClass="org.tizen.nativeide.tool.sbi.gnu.c.linker.base"/>
+                                                       <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.linker.943053959" name="C++ Linker" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.linker">
+                                                               <option defaultValue="false" id="sbi.gnu.cpp.linker.option.shared_flag.core.285663499" name="Linker.Shared" superClass="sbi.gnu.cpp.linker.option.shared_flag.core" valueType="boolean"/>
+                                                               <option defaultValue="false" id="sbi.gnu.cpp.linker.option.noundefined.core.963915080" name="Report unresolved symbol references (-Wl,--no-undefined)" superClass="sbi.gnu.cpp.linker.option.noundefined.core" valueType="boolean"/>
+                                                               <option id="sbi.gnu.cpp.linker.option.frameworks_lflags.core.1031658708" name="Tizen-Frameworks-Other-Lflags" superClass="sbi.gnu.cpp.linker.option.frameworks_lflags.core" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="${TC_LINKER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="${RS_LINKER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="-pie -lpthread "/>
+                                                                       <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="-Xlinker --version-script=&quot;${PROJ_PATH}/.exportMap&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="-L&quot;${SBI_SYSROOT}/usr/lib&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="$(RS_LIBRARIES)"/>
+                                                               </option>
+                                                               <option id="gnu.cpp.link.option.paths.2010106666" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/lib}&quot;"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.545062717" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+                                                                       <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+                                                                       <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+                                                               </inputType>
+                                                       </tool>
+                                                       <tool command="i386-linux-gnueabi-as" id="org.tizen.nativeapp.tool.sbi.gnu.assembler.base.754264914" name="Assembler" superClass="org.tizen.nativeapp.tool.sbi.gnu.assembler.base">
+                                                               <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1105641169" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+                                                       </tool>
+                                                       <tool id="org.tizen.nativecore.tool.fnmapgen.177084884" name="C FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen"/>
+                                                       <tool id="org.tizen.nativecore.tool.fnmapgen.cpp.781762655" name="C++ FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen.cpp"/>
+                                                       <tool id="org.tizen.nativecore.tool.ast.498860237" name="C Static Analyzer" superClass="org.tizen.nativecore.tool.ast"/>
+                                                       <tool id="org.tizen.nativecore.tool.ast.cpp.1320375851" name="C++ Static Analyzer" superClass="org.tizen.nativecore.tool.ast.cpp"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib.2073726469" name="Archive Generator" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.po.compiler.311931961" name="PO Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.po.compiler"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.541771488" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler"/>
+                                               </toolChain>
+                                       </folderInfo>
+                                       <sourceEntries>
+                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="res"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="shared"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+                                       </sourceEntries>
+                               </configuration>
+                       </storageModule>
+                       <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+               </cconfiguration>
+               <cconfiguration id="org.tizen.nativecore.config.sbi.gcc45.app.release.1136749094">
+                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.tizen.nativecore.config.sbi.gcc45.app.release.1136749094" moduleId="org.eclipse.cdt.core.settings" name="Release">
+                               <externalSettings/>
+                               <extensions>
+                                       <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+                                       <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.tizen.nativecore.NativeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                               </extensions>
+                       </storageModule>
+                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                               <configuration artifactName="org.example.fidosample" buildArtefactType="org.tizen.nativecore.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.tizen.nativecore.buildArtefactType.app,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;" id="org.tizen.nativecore.config.sbi.gcc45.app.release.1136749094" name="Release" parent="org.tizen.nativecore.config.sbi.gcc45.app.release">
+                                       <folderInfo id="org.tizen.nativecore.config.sbi.gcc45.app.release.1136749094." name="/" resourcePath="">
+                                               <toolChain id="org.tizen.nativecore.toolchain.sbi.gcc45.app.release.862843768" name="Tizen Native Toolchain" superClass="org.tizen.nativecore.toolchain.sbi.gcc45.app.release">
+                                                       <targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.tizen.nativeide.target.sbi.gnu.platform.base.1276891174" osList="linux,win32" superClass="org.tizen.nativeide.target.sbi.gnu.platform.base"/>
+                                                       <builder buildPath="${workspace_loc:/FIDOSample}/Release" id="org.tizen.nativecore.target.sbi.gnu.builder.1375695689" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Tizen Application Builder" superClass="org.tizen.nativecore.target.sbi.gnu.builder"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.830485332" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/>
+                                                       <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.489116302" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
+                                                               <option id="gnu.cpp.compiler.option.optimization.level.987691966" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
+                                                               <option defaultValue="gnu.cpp.compiler.debugging.level.default" id="sbi.gnu.cpp.compiler.option.debugging.level.core.1505762988" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core" valueType="enumerated"/>
+                                                               <option defaultValue="false" id="sbi.gnu.cpp.compiler.option.misc.pic.core.1396241771" name="-fPIC option" superClass="sbi.gnu.cpp.compiler.option.misc.pic.core" valueType="boolean"/>
+                                                               <option id="sbi.gnu.cpp.compiler.option.1352110291" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs">
+                                                                       <listOptionValue builtIn="false" value="mobile-3.0-emulator.core_llvm37.i386.core.app"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.1143506565" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES3&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/KHR&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/SDL2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appcore-agent&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appfw&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/attach-panel&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/badge&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/base&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/cairo&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/calendar-service2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/chromium-ewk&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ckm&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/contacts-svc&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/content&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/context-service&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/csr&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dali&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dali-toolkit&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dbus-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/device&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dlog&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-buffer-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-con-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-file-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-imf-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-imf-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-input-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-input-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-ipc-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ector-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/e_dbus-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/edje-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-extension&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efreet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1/eina&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eio-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eldbus-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/elementary-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/embryo-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/emile-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eo-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eom&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-client-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/feedback&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/fontconfig&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/freetype2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/geofence&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/gio-unix-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/glib-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/harfbuzz&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/iotcon&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/location&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/maps&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media-content&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/messaging&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/metadata-editor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minicontrol&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minizip&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/network&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/notification&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/nsd/&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/phonenumber-utils&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/sensor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/service-adaptor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/shortcut&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/storage&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/system&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ui&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vulkan&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/web&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_service&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_viewer_evas&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/wifi-direct&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/yaca&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/dbus-1.0/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/glib-2.0/include&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.cpp.compiler.option.frameworks_cflags.core.726631054" superClass="sbi.gnu.cpp.compiler.option.frameworks_cflags.core" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="${TC_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value=" -fPIE"/>
+                                                                       <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+                                                               </option>
+                                                               <option id="gnu.cpp.compiler.option.include.paths.2089387549" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.cpp.compiler.option.frameworks.core.348988531" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs">
+                                                                       <listOptionValue builtIn="false" value="Native_API"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.2137121011" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+                                                       </tool>
+                                                       <tool command="clang" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.290338780" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
+                                                               <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.2063485939" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
+                                                               <option defaultValue="gnu.c.debugging.level.default" id="sbi.gnu.c.compiler.option.debugging.level.core.1542993472" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core" valueType="enumerated"/>
+                                                               <option defaultValue="false" id="sbi.gnu.c.compiler.option.misc.pic.core.1145941581" name="-fPIC option" superClass="sbi.gnu.c.compiler.option.misc.pic.core" valueType="boolean"/>
+                                                               <option id="sbi.gnu.c.compiler.option.1096690980" superClass="sbi.gnu.c.compiler.option" valueType="userObjs">
+                                                                       <listOptionValue builtIn="false" value="mobile-3.0-emulator.core_llvm37.i386.core.app"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.c.compiler.option.frameworks_inc.core.1911420229" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/EGL&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/GLES3&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/KHR&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/SDL2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appcore-agent&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/appfw&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/attach-panel&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/badge&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/base&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/cairo&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/calendar-service2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/chromium-ewk&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ckm&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/contacts-svc&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/content&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/context-service&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/csr&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dali&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dali-toolkit&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dbus-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/device&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/dlog&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-buffer-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-con-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-file-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-imf-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-imf-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-input-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-input-evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ecore-ipc-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ector-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/e_dbus-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/edje-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efl-extension&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/efreet-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eina-1/eina&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eio-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eldbus-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/elementary-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/embryo-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/emile-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eo-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/eom&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ethumb-client-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/evas-1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/feedback&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/fontconfig&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/freetype2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/geofence&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/gio-unix-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/glib-2.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/harfbuzz&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/iotcon&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/json-glib-1.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/location&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/maps&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/media-content&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/messaging&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/metadata-editor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minicontrol&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/minizip&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/network&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/notification&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/nsd/&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/phonenumber-utils&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/sensor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/service-adaptor&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/shortcut&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/storage&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/system&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/telephony&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/ui&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/vulkan&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/web&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_service&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/widget_viewer_evas&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/wifi-direct&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/yaca&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/dbus-1.0/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/lib/glib-2.0/include&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.c.compiler.option.frameworks_cflags.core.385200874" superClass="sbi.gnu.c.compiler.option.frameworks_cflags.core" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="${TC_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value=" -fPIE"/>
+                                                                       <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+                                                               </option>
+                                                               <option id="gnu.c.compiler.option.include.paths.1471856880" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
+                                                               </option>
+                                                               <option id="sbi.gnu.c.compiler.option.frameworks.core.486551532" superClass="sbi.gnu.c.compiler.option.frameworks.core" valueType="userObjs">
+                                                                       <listOptionValue builtIn="false" value="Native_API"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1956535695" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+                                                       </tool>
+                                                       <tool id="org.tizen.nativeide.tool.sbi.gnu.c.linker.base.1853168940" name="C Linker" superClass="org.tizen.nativeide.tool.sbi.gnu.c.linker.base"/>
+                                                       <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.linker.1827165968" name="C++ Linker" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.linker">
+                                                               <option defaultValue="false" id="sbi.gnu.cpp.linker.option.shared_flag.core.1633414702" name="Linker.Shared" superClass="sbi.gnu.cpp.linker.option.shared_flag.core" valueType="boolean"/>
+                                                               <option defaultValue="false" id="sbi.gnu.cpp.linker.option.noundefined.core.288964063" name="Report unresolved symbol references (-Wl,--no-undefined)" superClass="sbi.gnu.cpp.linker.option.noundefined.core" valueType="boolean"/>
+                                                               <option id="sbi.gnu.cpp.linker.option.frameworks_lflags.core.1019604882" superClass="sbi.gnu.cpp.linker.option.frameworks_lflags.core" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="${TC_LINKER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="${RS_LINKER_MISC}"/>
+                                                                       <listOptionValue builtIn="false" value="-pie -lpthread "/>
+                                                                       <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="-Xlinker --version-script=&quot;${PROJ_PATH}/.exportMap&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="-L&quot;${SBI_SYSROOT}/usr/lib&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="$(RS_LIBRARIES)"/>
+                                                               </option>
+                                                               <option id="gnu.cpp.link.option.paths.2062157365" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/lib}&quot;"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.9051221" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+                                                                       <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+                                                                       <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+                                                               </inputType>
+                                                       </tool>
+                                                       <tool command="i386-linux-gnueabi-as" id="org.tizen.nativeapp.tool.sbi.gnu.assembler.base.1118617402" name="Assembler" superClass="org.tizen.nativeapp.tool.sbi.gnu.assembler.base">
+                                                               <inputType id="cdt.managedbuild.tool.gnu.assembler.input.619942447" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+                                                       </tool>
+                                                       <tool id="org.tizen.nativecore.tool.fnmapgen.360602832" name="C FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen"/>
+                                                       <tool id="org.tizen.nativecore.tool.fnmapgen.cpp.170508763" name="C++ FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen.cpp"/>
+                                                       <tool id="org.tizen.nativecore.tool.ast.943270127" name="C Static Analyzer" superClass="org.tizen.nativecore.tool.ast"/>
+                                                       <tool id="org.tizen.nativecore.tool.ast.cpp.805127209" name="C++ Static Analyzer" superClass="org.tizen.nativecore.tool.ast.cpp"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib.279942213" name="Archive Generator" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.po.compiler.1770447282" name="PO Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.po.compiler"/>
+                                                       <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.115316938" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler"/>
+                                               </toolChain>
+                                       </folderInfo>
+                                       <sourceEntries>
+                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="res"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="shared"/>
+                                               <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+                                       </sourceEntries>
+                               </configuration>
+                       </storageModule>
+                       <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+               </cconfiguration>
+       </storageModule>
+       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+               <project id="FIDOSample.org.tizen.nativecore.target.sbi.gcc45.app.813732158" name="Tizen Native Application" projectType="org.tizen.nativecore.target.sbi.gcc45.app"/>
+       </storageModule>
+       <storageModule moduleId="scannerConfiguration">
+               <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+               <scannerConfigBuildInfo instanceId="org.tizen.nativecore.config.sbi.gcc45.app.debug.1294257923">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+               </scannerConfigBuildInfo>
+               <scannerConfigBuildInfo instanceId="org.tizen.nativecore.config.sbi.gcc45.app.release.1136749094">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+               </scannerConfigBuildInfo>
+       </storageModule>
+       <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+       <storageModule moduleId="refreshScope" versionNumber="2">
+               <configuration configurationName="Debug">
+                       <resource resourceType="PROJECT" workspacePath="/FIDOSample"/>
+               </configuration>
+               <configuration configurationName="Release">
+                       <resource resourceType="PROJECT" workspacePath="/FIDOSample"/>
+               </configuration>
+       </storageModule>
+</cproject>
diff --git a/test/conformance_test/FIDOSample/.exportMap b/test/conformance_test/FIDOSample/.exportMap
new file mode 100644 (file)
index 0000000..43e310e
--- /dev/null
@@ -0,0 +1,4 @@
+{
+       global: main;
+       local: *;
+};
diff --git a/test/conformance_test/FIDOSample/.package-stamp b/test/conformance_test/FIDOSample/.package-stamp
new file mode 100644 (file)
index 0000000..40cbe59
--- /dev/null
@@ -0,0 +1 @@
+TPK
\ No newline at end of file
diff --git a/test/conformance_test/FIDOSample/.project b/test/conformance_test/FIDOSample/.project
new file mode 100644 (file)
index 0000000..606d4fa
--- /dev/null
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>FIDOSample</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+                       <triggers>full,incremental,</triggers>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.cdt.core.cnature</nature>
+               <nature>org.eclipse.cdt.core.ccnature</nature>
+               <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+               <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+       </natures>
+</projectDescription>
diff --git a/test/conformance_test/FIDOSample/.rds_delta b/test/conformance_test/FIDOSample/.rds_delta
new file mode 100644 (file)
index 0000000..a72638e
--- /dev/null
@@ -0,0 +1,6 @@
+#delete
+#add
+#modify
+author-signature.xml
+signature1.xml
+res/auth_req.json
diff --git a/test/conformance_test/FIDOSample/.sdk_delta.info b/test/conformance_test/FIDOSample/.sdk_delta.info
new file mode 100644 (file)
index 0000000..a834b08
Binary files /dev/null and b/test/conformance_test/FIDOSample/.sdk_delta.info differ
diff --git a/test/conformance_test/FIDOSample/.sign/.manifest.tmp b/test/conformance_test/FIDOSample/.sign/.manifest.tmp
new file mode 100644 (file)
index 0000000..5a9feb7
--- /dev/null
@@ -0,0 +1,7 @@
+bin/fidosample__DEL__dPStffQQK83Gd7Fl8JNsV9BI0k/ro3WBvOCtm7wX58o=
+res/auth_req.json__DEL__j7hIl7grnSZKXAzh4qnbWVyT32x3yuYSZm7KRmqLfYE=
+res/dereg_req.json__DEL__L24gBp9GVTWCIjQhk3ep3zbxCms8uoJ3aroMM0GXaoE=
+res/reg_req.json__DEL__pZfa3at5/sxgjlqZboukM+CsvcKsakhbqH7BVjY7HtI=
+shared/res/fidosample.png__DEL__1d0oEZHqPn+QzNzGIHwj9ODby6x9ggFs9uOsav6jPNs=
+tizen-manifest.xml__DEL__9gsi/nBiIA5VEM2Mwsr7AEyd4gKDIXYRbZ3FJscZHQE=
+author-signature.xml__DEL__QZePglPUC73qYQHySrBWVi3hKAwvZxa5zvRQrowdlxI=
diff --git a/test/conformance_test/FIDOSample/.sign/author-signature.xml b/test/conformance_test/FIDOSample/.sign/author-signature.xml
new file mode 100644 (file)
index 0000000..ab41cce
--- /dev/null
@@ -0,0 +1,78 @@
+<Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="AuthorSignature">
+<SignedInfo>
+<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></CanonicalizationMethod>
+<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"></SignatureMethod>
+<Reference URI="bin%2Ffidosample">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>dPStffQQK83Gd7Fl8JNsV9BI0k/ro3WBvOCtm7wX58o=</DigestValue>
+</Reference>
+<Reference URI="res%2Fauth_req.json">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>j7hIl7grnSZKXAzh4qnbWVyT32x3yuYSZm7KRmqLfYE=</DigestValue>
+</Reference>
+<Reference URI="res%2Fdereg_req.json">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>L24gBp9GVTWCIjQhk3ep3zbxCms8uoJ3aroMM0GXaoE=</DigestValue>
+</Reference>
+<Reference URI="res%2Freg_req.json">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>pZfa3at5/sxgjlqZboukM+CsvcKsakhbqH7BVjY7HtI=</DigestValue>
+</Reference>
+<Reference URI="shared%2Fres%2Ffidosample.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>1d0oEZHqPn+QzNzGIHwj9ODby6x9ggFs9uOsav6jPNs=</DigestValue>
+</Reference>
+<Reference URI="tizen-manifest.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>9gsi/nBiIA5VEM2Mwsr7AEyd4gKDIXYRbZ3FJscZHQE=</DigestValue>
+</Reference>
+<Reference URI="#prop">
+<Transforms>
+<Transform Algorithm="http://www.w3.org/2006/12/xml-c14n11"></Transform>
+</Transforms>
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>lpo8tUDs054eLlBQXiDPVDVKfw30ZZdtkRs1jd7H5K8=</DigestValue>
+</Reference>
+</SignedInfo>
+<SignatureValue>
+LRLjFwHRzrHZAPQXXCGRz6dKmrHQRbp8cmyxTWDJd9EPDG5/5avsJ3y+JGKKeRPTIH9HfNRHzN3g
+T9BnAeGKCZgon8qQp9+cV83S5MHFsW6ZKbNvkL/0LDsN5N0u4lJjYXTiOO2FNHpopu2/rkrmylyN
+gkXX/r5fy1goFpSYD/8=
+</SignatureValue>
+<KeyInfo>
+<X509Data>
+<X509Certificate>
+MIIClTCCAX2gAwIBAgIGAVWW5WFDMA0GCSqGSIb3DQEBBQUAMFYxGjAYBgNVBAoMEVRpemVuIEFz
+c29jaWF0aW9uMRowGAYDVQQLDBFUaXplbiBBc3NvY2lhdGlvbjEcMBoGA1UEAwwTVGl6ZW4gRGV2
+ZWxvcGVycyBDQTAeFw0xMjExMDEwMDAwMDBaFw0xOTAxMDEwMDAwMDBaMBExDzANBgNVBAMMBmF1
+dGhvcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEApQoQG76AhcGiaETu54POHH1PJlQRJk6y
++e6WWnbO6rc9HxFyA/37KdPO8okqiifUw9q9gRT3vN5dk5QHcS7dtsWcN4wmpf/gunezYMFc76q+
+BR1xEt3di0TSROqHrD+3yS4tyKVSlaXtPFIyR5RMAI3X3k1np9/1SWjpEAt9mskCAwEAAaMyMDAw
+DAYDVR0TAQH/BAIwADALBgNVHQ8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUHAwMwDQYJKoZIhvcN
+AQEFBQADggEBAC+4orztdjnriaP3CHkHMGmNU9VxhfXZqMM8zycz3HYhfffUkWYKKsT+1ZQisKON
+3odhBQGDgQussm9PpQFyQ1epkeLbVTDXRwSE4vAiJpZwKRVmcHzi8/l9i4DxvecI5RgAX1BBBUCw
+6FRDlLmJ2Kvz6wVS8CTRsXp6DyDMQl6OkmMwKbvAGFhpbVmy8l6G+QEpTsU4WY9gigHjJ2tafVI7
+XREhC+8+BrViOTNx7FxqXgoD+cSb8UUEtqSb6H72XQZLgW2FK1WvWzMCyseE2wzi9dUCgAtdF5tI
+FGEd9WPy119WDEzes8sAdkeCxGtiycN99kP/m/2j3Ubt2G7E6LA=
+</X509Certificate>
+<X509Certificate>
+MIIDOTCCAiGgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMRowGAYDVQQKDBFUaXplbiBBc3NvY2lh
+dGlvbjEaMBgGA1UECwwRVGl6ZW4gQXNzb2NpYXRpb24xHjAcBgNVBAMMFVRpemVuIERldmVsb3Bl
+cnMgUm9vdDAeFw0xMjAxMDEwMDAwMDBaFw0yNzAxMDEwMDAwMDBaMFYxGjAYBgNVBAoMEVRpemVu
+IEFzc29jaWF0aW9uMRowGAYDVQQLDBFUaXplbiBBc3NvY2lhdGlvbjEcMBoGA1UEAwwTVGl6ZW4g
+RGV2ZWxvcGVycyBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANVGhRGmMIUyBA7o
+PCz8Sxut6z6HNkF4oDIuzuKaMzRYPeWodwe9O0gmqAkToQHfwg2giRhE5GoPld0fq+OYMMwSasCu
+g8dwODx1eDeSYVuOLWRxpAmbTXOsSFi6VoWeyaPEm18JBHvZBsU5YQtgZ6Kp7MqzvQg3pXOxtajj
+vyHxiatJl+xXrHgcXC1wgyG3buty7u/Fi2mvKXJ0PRJcCjjK81dqe/Vr20sRUCrbk02zbm5ggFt/
+jIEhV8wbFRQpliobc7J4dSTKhFfrqGM8rdd54LYhD7gSI1CFSe16pUXfcVR7FhJztRaiGLnCrwBE
+dyTZ248+D4L/qR/D0axb3jcCAwEAAaMQMA4wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOC
+AQEAnOXXQ/1O/QTDHyrmQDtFziqPY3xWlJBqJtEqXiT7Y+Ljpe66e+Ee/OjQMlZe8gu21/8cKklH
+95RxjopMWCVedXDUbWdvS2+CdyvVW/quT2E0tjqIzXDekUTYwwhlPWlGxvfj3VsxqSFq3p8Brl04
+1Gx5RKAGyKVsMfTLhbbwSWwApuBUxYfcNpKwLWGPXkysu+HctY03OKv4/xKBnVWiN8ex/Sgesi0M
++OBAOMdZMPK32uJBTeKFx1xZgTLIhk45V0hPOomPjZloiv0LSS11eyd451ufjW0iHRE7WlpR6EvI
+W6TFyZgMpQq+kg4hWl2SBTf3s2VI8Ygz7gj8TMlClg==
+</X509Certificate>
+</X509Data>
+</KeyInfo>
+<Object Id="prop"><SignatureProperties xmlns:dsp="http://www.w3.org/2009/xmldsig-properties"><SignatureProperty Id="profile" Target="#AuthorSignature"><dsp:Profile URI="http://www.w3.org/ns/widgets-digsig#profile"></dsp:Profile></SignatureProperty><SignatureProperty Id="role" Target="#AuthorSignature"><dsp:Role URI="http://www.w3.org/ns/widgets-digsig#role-author"></dsp:Role></SignatureProperty><SignatureProperty Id="identifier" Target="#AuthorSignature"><dsp:Identifier></dsp:Identifier></SignatureProperty></SignatureProperties></Object>
+</Signature>
\ No newline at end of file
diff --git a/test/conformance_test/FIDOSample/.sign/signature1.xml b/test/conformance_test/FIDOSample/.sign/signature1.xml
new file mode 100644 (file)
index 0000000..dffd59d
--- /dev/null
@@ -0,0 +1,80 @@
+<Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="DistributorSignature">
+<SignedInfo>
+<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></CanonicalizationMethod>
+<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"></SignatureMethod>
+<Reference URI="author-signature.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>QZePglPUC73qYQHySrBWVi3hKAwvZxa5zvRQrowdlxI=</DigestValue>
+</Reference>
+<Reference URI="bin%2Ffidosample">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>dPStffQQK83Gd7Fl8JNsV9BI0k/ro3WBvOCtm7wX58o=</DigestValue>
+</Reference>
+<Reference URI="res%2Fauth_req.json">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>j7hIl7grnSZKXAzh4qnbWVyT32x3yuYSZm7KRmqLfYE=</DigestValue>
+</Reference>
+<Reference URI="res%2Fdereg_req.json">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>L24gBp9GVTWCIjQhk3ep3zbxCms8uoJ3aroMM0GXaoE=</DigestValue>
+</Reference>
+<Reference URI="res%2Freg_req.json">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>pZfa3at5/sxgjlqZboukM+CsvcKsakhbqH7BVjY7HtI=</DigestValue>
+</Reference>
+<Reference URI="shared%2Fres%2Ffidosample.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>1d0oEZHqPn+QzNzGIHwj9ODby6x9ggFs9uOsav6jPNs=</DigestValue>
+</Reference>
+<Reference URI="tizen-manifest.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>9gsi/nBiIA5VEM2Mwsr7AEyd4gKDIXYRbZ3FJscZHQE=</DigestValue>
+</Reference>
+<Reference URI="#prop">
+<Transforms>
+<Transform Algorithm="http://www.w3.org/2006/12/xml-c14n11"></Transform>
+</Transforms>
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>u/jU3U4Zm5ihTMSjKGlGYbWzDfRkGphPPHx3gJIYEJ4=</DigestValue>
+</Reference>
+</SignedInfo>
+<SignatureValue>
+HowP8FFbFjT6ZRVS5R4jPra8oZENIv/4UhLELrQjdKrI+mWCareTg7wbpMiC1OiAq9HCIhIhRglS
+H8+CdxqrbZb7+PR0Sst8LNnkByAdfboQ/MATSmXeIQBF2h60rjWG/TYl7L4+Qr6lb9ksJdJboHmT
+dKzZzMY/LNBDsolVAEQ=
+</SignatureValue>
+<KeyInfo>
+<X509Data>
+<X509Certificate>
+MIICmzCCAgQCCQDXI7WLdVZwiTANBgkqhkiG9w0BAQUFADCBjzELMAkGA1UEBhMCS1IxDjAMBgNV
+BAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6ZW4gVGVzdCBDQTEiMCAGA1UE
+CwwZVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEkMCIGA1UEAwwbVGl6ZW4gUHVibGljIERpc3Ry
+aWJ1dG9yIENBMB4XDTEyMTAyOTEzMDMwNFoXDTIyMTAyNzEzMDMwNFowgZMxCzAJBgNVBAYTAktS
+MQ4wDAYDVQQIDAVTdXdvbjEOMAwGA1UEBwwFU3V3b24xFjAUBgNVBAoMDVRpemVuIFRlc3QgQ0Ex
+IjAgBgNVBAsMGVRpemVuIERpc3RyaWJ1dG9yIFRlc3QgQ0ExKDAmBgNVBAMMH1RpemVuIFB1Ymxp
+YyBEaXN0cmlidXRvciBTaWduZXIwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALtMvlc5hENK
+90ZdA+y66+Sy0enD1gpZDBh5T9RP0oRsptJv5jjNTseQbQi0SZOdOXb6J7iQdlBCtR343RpIEz8H
+mrBy7mSY7mgwoU4EPpp4CTSUeAuKcmvrNOngTp5Hv7Ngf02TTHOLK3hZLpGayaDviyNZB5PdqQdB
+hokKjzAzAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAvGp1gxxAIlFfhJH1efjb9BJK/rtRkbYn9+Ez
+GEbEULg1svsgnyWisFimI3uFvgI/swzr1eKVY3Sc8MQ3+Fdy3EkbDZ2+WAubhcEkorTWjzWz2fL1
+vKaYjeIsuEX6TVRUugHWudPzcEuQRLQf8ibZWjbQdBmpeQYBMg5x+xKLCJc=
+</X509Certificate>
+<X509Certificate>
+MIICtDCCAh2gAwIBAgIJAMDbehElPNKvMA0GCSqGSIb3DQEBBQUAMIGVMQswCQYDVQQGEwJLUjEO
+MAwGA1UECAwFU3V3b24xDjAMBgNVBAcMBVN1d29uMRYwFAYDVQQKDA1UaXplbiBUZXN0IENBMSMw
+IQYDVQQLDBpUVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEpMCcGA1UEAwwgVGl6ZW4gUHVibGlj
+IERpc3RyaWJ1dG9yIFJvb3QgQ0EwHhcNMTIxMDI5MTMwMjUwWhcNMjIxMDI3MTMwMjUwWjCBjzEL
+MAkGA1UEBhMCS1IxDjAMBgNVBAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6
+ZW4gVGVzdCBDQTEiMCAGA1UECwwZVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEkMCIGA1UEAwwb
+VGl6ZW4gUHVibGljIERpc3RyaWJ1dG9yIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDe
+OTS/3nXvkDEmsFCJIvRlQ3RKDcxdWJJp625pFqHdmoJBdV+x6jl1raGK2Y1sp2Gdvpjc/z92yzAp
+bE/UVLPh/tRNZPeGhzU4ejDDm7kzdr2f7Ia0U98K+OoY12ucwg7TYNItj9is7Cj4blGfuMDzd2ah
+2AgnCGlwNwV/pv+uVQIDAQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACqJ
+KO33YdoGudwanZIxMdXuxnnD9R6u72ltKk1S4zPfMJJv482CRGCI4FK6djhlsI4i0Lt1SVIJEed+
+yc3qckGm19dW+4xdlkekon7pViEBWuyHw8OWv3RXtTum1+PGHjBJ2eYY4ZKIpz73U/1NC16sTB/0
+VhfnkHwPltmrpYVe
+</X509Certificate>
+</X509Data>
+</KeyInfo>
+<Object Id="prop"><SignatureProperties xmlns:dsp="http://www.w3.org/2009/xmldsig-properties"><SignatureProperty Id="profile" Target="#DistributorSignature"><dsp:Profile URI="http://www.w3.org/ns/widgets-digsig#profile"></dsp:Profile></SignatureProperty><SignatureProperty Id="role" Target="#DistributorSignature"><dsp:Role URI="http://www.w3.org/ns/widgets-digsig#role-distributor"></dsp:Role></SignatureProperty><SignatureProperty Id="identifier" Target="#DistributorSignature"><dsp:Identifier></dsp:Identifier></SignatureProperty></SignatureProperties></Object>
+</Signature>
\ No newline at end of file
diff --git a/test/conformance_test/FIDOSample/.tproject b/test/conformance_test/FIDOSample/.tproject
new file mode 100644 (file)
index 0000000..56660b2
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<tproject xmlns="http://www.tizen.org/tproject">
+    <platforms>
+        <platform>
+            <name>mobile-3.0</name>
+        </platform>
+    </platforms>
+    <package>
+        <blacklist/>
+        <resFallback autoGen="true"/>
+    </package>
+</tproject>
diff --git a/test/conformance_test/FIDOSample/inc/fidosample.h b/test/conformance_test/FIDOSample/inc/fidosample.h
new file mode 100644 (file)
index 0000000..f38f214
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef __fidosample_H__
+#define __fidosample_H__
+
+#include <stdio.h>
+#include <app.h>
+#include <Elementary.h>
+#include <system_settings.h>
+#include <dlog.h>
+#include <efl_extension.h>
+
+#ifdef  LOG_TAG
+#undef  LOG_TAG
+#endif
+#define LOG_TAG "fidosample"
+
+#if !defined(PACKAGE)
+#define PACKAGE "org.example.fidosample"
+#endif
+
+typedef struct appdata {
+       Evas_Object *win;
+       Evas_Object *conform;
+       Evas_Object *layout;
+       Evas_Object *nf;
+       Evas_Object *datetime;
+       Evas_Object *popup;
+       Evas_Object *button;
+       struct tm saved_time;
+} appdata_s;
+
+void start_discover(void *data, Evas_Object *obj, void *event_info);
+void start_check_policy(void *data, Evas_Object *obj, void *event_info);
+void start_registration(void *data, Evas_Object *obj, void *event_info);
+void start_auth(void *data, Evas_Object *obj, void *event_info);
+void start_de_registration(void *data, Evas_Object *obj, void *event_info);
+
+#endif /* __fidosample_H__ */
diff --git a/test/conformance_test/FIDOSample/project_def.prop b/test/conformance_test/FIDOSample/project_def.prop
new file mode 100644 (file)
index 0000000..eb187b9
--- /dev/null
@@ -0,0 +1,11 @@
+APPNAME = fidosample
+
+type = app
+profile = mobile-3.0
+
+USER_SRCS = src/fidosample.c
+USER_DEFS =
+USER_INC_DIRS = inc
+USER_OBJS =
+USER_LIBS =
+USER_EDCS =
diff --git a/test/conformance_test/FIDOSample/res/auth_req.json b/test/conformance_test/FIDOSample/res/auth_req.json
new file mode 100644 (file)
index 0000000..97794b6
--- /dev/null
@@ -0,0 +1,25 @@
+[
+  {
+    "header": {
+      "upv": {
+        "major": 1,
+        "minor": 0
+      },
+      "op": "Auth",
+      "appID": "tizen:pkg-key-hash:x75XV5IcXwi7mD7E78FqtebUZQYtXqKo/QCf8DSTCME=",
+      "serverData": "emKubKMS8RxYOth7J8enT_x7dQWBaO1CiC0fGmSEhX56kq2RYo1LRpwvfHlzYRI3p9Ay-l4zJcV3lX6rQ0CYNWi5nNDabClFm3k0pPj0kX5V-db9ejN_05y2J6wqztSD"
+    },
+    "challenge": "1AM2yZY4-9SG4Ns7-hMdB8IV_FTDKFFiUqNJNVbsVoo",
+    "policy": {
+      "accepted": [
+        [
+          {
+            "aaid": [
+              "TEST#1111"
+            ]
+          }
+        ]
+      ]
+    }
+  }
+]
diff --git a/test/conformance_test/FIDOSample/res/dereg_req.json b/test/conformance_test/FIDOSample/res/dereg_req.json
new file mode 100644 (file)
index 0000000..97e5ce7
--- /dev/null
@@ -0,0 +1,17 @@
+[
+    {
+        "header": {
+            "upv": {
+                "major": "1",
+                "minor": "0"
+            },
+            "op": "Dereg"
+        },
+        "authenticators": [
+            {
+                "aaid": "0001#8001",
+                "keyID": "uWrbo_8JI1HmPESrNAStTVV8ZbBrzLsf_kZu1QKX2YY"
+            }
+        ]
+    }
+]
diff --git a/test/conformance_test/FIDOSample/res/reg_req.json b/test/conformance_test/FIDOSample/res/reg_req.json
new file mode 100644 (file)
index 0000000..b586547
--- /dev/null
@@ -0,0 +1,26 @@
+[
+  {
+    "header": {
+      "upv": {
+        "major": 1,
+        "minor": 0
+      },
+      "op": "Reg",
+      "appID": "tizen:pkg-key-hash:x75XV5IcXwi7mD7E78FqtebUZQYtXqKo/QCf8DSTCME=",
+      "serverData": "nwV8EPqS5raZdAgH3GD9Z-ytCA9MkiiWaCsr1GHHNJ2yUh3HaV1HHxd4Z67FefJOD5sQYZvipfg5BavhdWPMecD2SH39aJixoXN9ZaNwRlcftJe9WbtPNDC9q5V9WX7Z5jCwkAwehcI"
+    },
+    "challenge": "9pIcUwwrY5eD9o3OwfhkeHLnoIl0vaeJUbxSHMe_XgE",
+    "username": "TEXT1",
+    "policy": {
+      "accepted": [
+        [
+          {
+            "aaid": [
+              "TEST#1111"
+            ]
+          }
+        ]
+      ]
+    }
+  }
+]
diff --git a/test/conformance_test/FIDOSample/shared/res/fidosample.png b/test/conformance_test/FIDOSample/shared/res/fidosample.png
new file mode 100644 (file)
index 0000000..9765b1b
Binary files /dev/null and b/test/conformance_test/FIDOSample/shared/res/fidosample.png differ
diff --git a/test/conformance_test/FIDOSample/src/fidosample.c b/test/conformance_test/FIDOSample/src/fidosample.c
new file mode 100644 (file)
index 0000000..1cad45b
--- /dev/null
@@ -0,0 +1,711 @@
+/*
+ * Copyright (c) 2014 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 "fidosample.h"
+#include "fido.h"
+#include <dlog.h>
+
+#define _REG_REQ_FILE_NAME "/home/owner/apps_rw/org.example.fidosample/res/reg_req.json"
+#define _AUTH_REQ_FILE_NAME "/home/owner/apps_rw/org.example.fidosample/res/auth_req.json"
+#define _DEREG_REQ_FILE_NAME "/home/owner/apps_rw/org.example.fidosample/res/dereg_req.json"
+
+static char *json_reg = NULL;
+static char *json_auth = NULL;
+static char *json_dereg = NULL;
+
+typedef enum {
+       LOG_TYPE_UAF_REQ,
+       LOG_TYPE_UAF_RESP,
+       LOG_TYPE_REQ_FROM_SERVER_REG,
+       LOG_TYPE_REQ_FROM_SERVER_AUTH,
+       LOG_TYPE_REQ_FROM_SERVER_DEREG,
+       LOG_TYPE_RESP_TO_SERVER_REG,
+       LOG_TYPE_RESP_TO_SERVER_AUTH,
+       LOG_TYPE_RESP_TO_SERVER_DEREG
+} log_type_e;
+
+#define LOG_FILE_NAME_MAX_LEN 5000
+
+static void
+__log_to_file(log_type_e tag, const char *str)
+{
+       struct timeval tv;
+       if (gettimeofday(&tv, NULL) < 0)
+               return;
+
+       char *fn = calloc(1, LOG_FILE_NAME_MAX_LEN);
+
+       switch (tag) {
+
+       case LOG_TYPE_UAF_REQ:
+               snprintf(fn, LOG_FILE_NAME_MAX_LEN - 1, "%s%s_%ld.txt", app_get_data_path(), "UAF_REQ", tv.tv_sec);
+               break;
+
+       case LOG_TYPE_UAF_RESP:
+               snprintf(fn, LOG_FILE_NAME_MAX_LEN - 1, "%s%s_%ld.txt", app_get_data_path(), "UAF_RESP", tv.tv_sec);
+               break;
+
+       case LOG_TYPE_REQ_FROM_SERVER_REG:
+               snprintf(fn, LOG_FILE_NAME_MAX_LEN - 1, "%s%s_%ld.txt", app_get_data_path(), "REQ_FROM_SERVER_REG", tv.tv_sec);
+               break;
+
+       case LOG_TYPE_REQ_FROM_SERVER_AUTH:
+               snprintf(fn, LOG_FILE_NAME_MAX_LEN - 1, "%s%s_%ld.txt", app_get_data_path(), "REQ_FROM_SERVER_AUTH", tv.tv_sec);
+               break;
+
+       case LOG_TYPE_REQ_FROM_SERVER_DEREG:
+               snprintf(fn, LOG_FILE_NAME_MAX_LEN - 1, "%s%s_%ld.txt", app_get_data_path(), "REQ_FROM_SERVER_DEREG", tv.tv_sec);
+               break;
+
+       case LOG_TYPE_RESP_TO_SERVER_REG:
+               snprintf(fn, LOG_FILE_NAME_MAX_LEN - 1, "%s%s_%ld.txt", app_get_data_path(), "RESP_TO_SERVER_REG", tv.tv_sec);
+               break;
+
+       case LOG_TYPE_RESP_TO_SERVER_AUTH:
+               snprintf(fn, LOG_FILE_NAME_MAX_LEN - 1, "%s%s_%ld.txt", app_get_data_path(), "RESP_TO_SERVER_AUTH", tv.tv_sec);
+               break;
+
+       case LOG_TYPE_RESP_TO_SERVER_DEREG:
+               snprintf(fn, LOG_FILE_NAME_MAX_LEN - 1, "%s%s_%ld.txt", app_get_data_path(), "RESP_TO_SERVER_DEREG", tv.tv_sec);
+               break;
+
+       default:
+               snprintf(fn, LOG_FILE_NAME_MAX_LEN - 1, "%s_%ld.txt", app_get_data_path(), tv.tv_sec);
+
+       }
+
+       dlog_print(DLOG_INFO, "org.example.fidosample", "Log file name [%s]",  fn);
+
+       errno = 0;
+
+       FILE *fp = fopen(fn, "wb");
+       if (fp == NULL) {
+               dlog_print(DLOG_INFO, "org.example.fidosample", "fopen failed [%d]",  errno);
+               return;
+       }
+       int len = fwrite(str, sizeof(char), strlen(str), fp);
+       dlog_print(DLOG_INFO, "org.example.fidosample", "%d bytes logged",  len);
+       fclose(fp);
+}
+
+static char*
+__read(const char *file_name)
+{
+       FILE *file = fopen(file_name, "rb");
+       if (file == NULL)
+               return NULL;
+
+       fseek(file, 0, SEEK_END);
+       long size = ftell(file);
+       if (size <= 0) {
+               fclose(file);
+               return NULL;
+       }
+
+       fseek(file, 0, SEEK_SET);
+
+       char *json = calloc(1, size + 1);
+       int num_bytes = fread(json, size, 1, file);
+       if (num_bytes <= 0) {
+               free(json);
+               fclose(file);
+               return NULL;
+       }
+
+       json[size] = 0;
+
+       fclose(file);
+
+       return json;
+
+}
+
+static void _response_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       evas_object_del(data);
+}
+
+static void create_popup(char *popup_str, appdata_s *ad)
+{
+       dlog_print(DLOG_INFO, "org.tizen.Fidosample", "fido %s", popup_str);
+
+       Evas_Object *popup = elm_popup_add(ad->win);
+       Evas_Object *btn;
+
+       elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+       evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_object_text_set(popup, popup_str);
+
+       btn = elm_button_add(popup);
+       elm_object_style_set(btn, "popup");
+       evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_object_text_set(btn, "OK");
+       elm_object_part_content_set(popup, "button1", btn);
+       eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL);
+       evas_object_smart_callback_add(btn, "clicked", _response_cb, popup);
+       evas_object_show(popup);
+
+       return;
+}
+
+char*
+get_error_code(fido_error_e error_code)
+{
+
+       char *error_str = calloc(1, 128);
+
+       if (error_code == FIDO_ERROR_NONE)
+               strcpy(error_str, "SUCCESS");
+       else if (error_code == FIDO_ERROR_OUT_OF_MEMORY)
+               strcpy(error_str, "FIDO_ERROR_OUT_OF_MEMORY");
+       else if (error_code == FIDO_ERROR_INVALID_PARAMETER)
+               strcpy(error_str, "FIDO_ERROR_INVALID_PARAMETER");
+       else if (error_code == FIDO_ERROR_NO_DATA)
+               strcpy(error_str, "FIDO_ERROR_NO_DATA");
+       else if (error_code == FIDO_ERROR_PERMISSION_DENIED)
+               strcpy(error_str, "FIDO_ERROR_PERMISSION_DENIED");
+       else if (error_code == FIDO_ERROR_NOT_SUPPORTED)
+               strcpy(error_str, "FIDO_ERROR_NOT_SUPPORTED");
+       else if (error_code == FIDO_ERROR_USER_ACTION_IN_PROGRESS)
+               strcpy(error_str, "FIDO_ERROR_USER_ACTION_IN_PROGRESS");
+       else if (error_code == FIDO_ERROR_USER_CANCELLED)
+               strcpy(error_str, "FIDO_ERROR_USER_CANCELLED");
+       else if (error_code == FIDO_ERROR_UNSUPPORTED_VERSION)
+               strcpy(error_str, "FIDO_ERROR_UNSUPPORTED_VERSION");
+       else if (error_code == FIDO_ERROR_NO_SUITABLE_AUTHENTICATOR)
+               strcpy(error_str, "FIDO_ERROR_NO_SUITABLE_AUTHENTICATOR");
+       else if (error_code == FIDO_ERROR_PROTOCOL_ERROR)
+               strcpy(error_str, "FIDO_ERROR_PROTOCOL_ERROR");
+       else if (error_code == FIDO_ERROR_UNTRUSTED_FACET_ID)
+               strcpy(error_str, "FIDO_ERROR_UNTRUSTED_FACET_ID");
+       else
+               strcpy(error_str, "FIDO_ERROR_UNKNOWN");
+       return error_str;
+}
+
+static void
+__show_error(int tizen_error_code, appdata_s *app_data)
+{
+       char *error_string = get_error_code(tizen_error_code);
+       create_popup(error_string, app_data);
+       free(error_string);
+}
+
+void fido_attestation_type_cb_list(fido_auth_attestation_type_e att_type, void *user_data)
+{
+       char *str = (char *) user_data;
+
+       char tmp[1024] = {0,};
+       sprintf(tmp, " | Attestation Type = [%d]", att_type);
+       strcat(str, tmp);
+}
+
+static void
+__print_authinfo(const fido_authenticator_h auth, appdata_s *ad)
+{
+       dlog_print(DLOG_INFO, "org.tizen.Fidosample", "fido __print_authinfo");
+
+       char str[5000] = {0,};
+       str[0] = '\0';
+       strcpy(str, "DISCOVER RESPONSE");
+       char tmp[1024] = {0,};
+
+       char *title =  NULL;
+       fido_authenticator_get_title(auth, &title);
+       if (title != NULL) {
+               sprintf(tmp, " | Title = [%s]", title);
+               strcat(str, tmp);
+       }
+       free(title);
+
+       char *aaid = NULL;
+       fido_authenticator_get_aaid(auth, &aaid);
+       if (aaid != NULL) {
+               sprintf(tmp, " | AAID = [%s]", aaid);
+               strcat(str, tmp);
+       }
+       free(aaid);
+
+       char *description = NULL;
+       fido_authenticator_get_description(auth, &description);
+       if (description != NULL) {
+               sprintf(tmp, " | Description = [%s]", description);
+               strcat(str, tmp);
+       }
+       free(description);
+
+       char *scheme = NULL;
+       fido_authenticator_get_assertion_scheme(auth, &scheme);
+       if (scheme != NULL) {
+               sprintf(tmp, " | Scheme = [%s]", scheme);
+               strcat(str, tmp);
+       }
+       free(scheme);
+
+       fido_authenticator_foreach_attestation_type(auth, fido_attestation_type_cb_list, str);
+
+       fido_auth_algo_e get_algo = -1;
+       fido_authenticator_get_algorithm(auth, &get_algo);
+       if (get_algo != -1) {
+               sprintf(tmp, " | Algo = [%d]", get_algo);
+               strcat(str, tmp);
+       }
+
+       fido_auth_user_verify_type_e user_ver = -1;
+       fido_authenticator_get_verification_method(auth, &user_ver);
+       if (user_ver != -1) {
+               sprintf(tmp, " | Verification = [%d]", user_ver);
+               strcat(str, tmp);
+       }
+
+       fido_auth_key_protection_type_e key_protection = -1;
+       fido_authenticator_get_key_protection_method(auth, &key_protection);
+       if (key_protection != -1) {
+               sprintf(tmp, " | Key Protection = [%d]", key_protection);
+               strcat(str, tmp);
+       }
+
+       fido_auth_matcher_protection_type_e matcher_protection = -1;
+       fido_authenticator_get_matcher_protection_method(auth, &matcher_protection);
+       if (matcher_protection != -1) {
+               sprintf(tmp, " | Matcher Protection = [%d]", matcher_protection);
+               strcat(str, tmp);
+       }
+
+       fido_auth_attachment_hint_e attachment_hint = -1;
+       fido_authenticator_get_attachment_hint(auth, &attachment_hint);
+       if (attachment_hint != -1) {
+               sprintf(tmp, " | Attachment Hint = [%d]", attachment_hint);
+               strcat(str, tmp);
+       }
+
+       fido_auth_tc_display_type_e tc_discplay = -1;
+       fido_authenticator_get_tc_discplay(auth, &tc_discplay);
+       if (tc_discplay != -1) {
+               sprintf(tmp, " | Tc Display = [%d]", tc_discplay);
+               strcat(str, tmp);
+       }
+
+       char *tc_display_type = NULL;
+       fido_authenticator_get_tc_display_type(auth, &tc_display_type);
+       if (tc_display_type != NULL) {
+               sprintf(tmp, " | Tc Display Type = [%s]", tc_display_type);
+               strcat(str, tmp);
+       }
+       free(tc_display_type);
+
+       char *icon = NULL;
+       fido_authenticator_get_icon(auth, &icon);
+       if (icon != NULL) {
+               sprintf(tmp, " | Icon = [%s]", icon);
+               strcat(str, tmp);
+       }
+       free(icon);
+
+       create_popup(str, ad);
+}
+
+static void
+auth_list_cb(const fido_authenticator_h auth, void *user_data)
+{
+       dlog_print(DLOG_INFO, "org.tizen.Fidosample", "fido auth_list_cb");
+
+       appdata_s *ad = user_data;
+       __print_authinfo(auth, ad);
+}
+
+void
+start_discover(void *data, Evas_Object *obj, void *event_info)
+{
+       int ret = fido_foreach_authenticator(auth_list_cb, data);
+       dlog_print(DLOG_INFO, "org.tizen.Fidosample", "fido_get_available_authenticators = [%d]", ret);
+
+       if (ret != FIDO_ERROR_NONE)
+               __show_error(ret, (appdata_s *)data);
+
+}
+
+void
+start_check_policy(void *data, Evas_Object *obj, void *event_info)
+{
+       bool is_supported = false;
+       int ret = fido_uaf_is_supported(json_reg, &is_supported);
+       dlog_print(DLOG_INFO, "org.tizen.Fidosample", "fido_uaf_is_supported = [%d]", ret);
+
+       char str[2048] = {0,};
+       str[0] = '\0';
+
+       strcpy(str, "CHECK POLICY RESPONSE | ");
+
+       if (ret != FIDO_ERROR_NONE) {
+               char *error_string = get_error_code(ret);
+
+               sprintf(str, "[%s]", error_string);
+               create_popup(str, (appdata_s *) data);
+               free(error_string);
+       } else {
+               if (is_supported == true)
+                       sprintf(str, "TRUE");
+               else
+                       sprintf(str, "FALSE");
+
+               create_popup(str, (appdata_s *) data);
+       }
+}
+
+static void
+_process_cb(fido_error_e tizen_error_code, const char *uaf_response, void *user_data)
+{
+       dlog_print(DLOG_INFO, "org.tizen.Fidosample", "process response = [%d]", tizen_error_code);
+
+       if (tizen_error_code == 0 && uaf_response != NULL) {
+               dlog_print(DLOG_INFO, "org.tizen.Fidosample", "uaf response = %s", uaf_response);
+
+               __log_to_file(LOG_TYPE_UAF_RESP, uaf_response);
+
+               const int max_popup_str_len = strlen(uaf_response) + 500;
+               char *popup_str = calloc(1, max_popup_str_len);
+
+               snprintf(popup_str, max_popup_str_len - 1, "UAF Response =%s", uaf_response);
+
+               create_popup(popup_str, (appdata_s *) user_data);
+               free(popup_str);
+       } else {
+               __show_error(tizen_error_code, (appdata_s *)user_data);
+       }
+}
+
+void
+start_registration(void *data, Evas_Object *obj, void *event_info)
+{
+       if (json_reg != NULL) {
+               int ret = fido_uaf_get_response_message(json_reg, NULL, _process_cb, data);
+               dlog_print(DLOG_INFO, "org.tizen.Fidosample", "fido_request_get_registration_response = [%d]", ret);
+               if (ret != FIDO_ERROR_NONE)
+                       __show_error(ret, (appdata_s *)data);
+       }
+}
+
+void
+start_auth(void *data, Evas_Object *obj, void *event_info)
+{
+       if (json_auth != NULL) {
+               int ret = fido_uaf_get_response_message(json_auth, NULL, _process_cb, data);
+               dlog_print(DLOG_INFO, "org.tizen.Fidosample", "fido_request_get_authentication_response = [%d]", ret);
+
+               if (ret != FIDO_ERROR_NONE)
+                       __show_error(ret, (appdata_s *)data);
+       }
+}
+
+static void
+_process_dereg_cb(fido_error_e tizen_error_code, const char *uaf_response, void *user_data)
+{
+       dlog_print(DLOG_INFO, "org.tizen.Fidosample", "process response = [%d]", tizen_error_code);
+
+       if (uaf_response)
+               dlog_print(DLOG_INFO, "org.tizen.Fidosample", "uaf_response = [%s]", uaf_response);
+       else
+               dlog_print(DLOG_INFO, "org.tizen.Fidosample", "uaf_response = [NULL]");
+
+       char *error_string = get_error_code(tizen_error_code);
+       create_popup(error_string, (appdata_s *) user_data);
+       free(error_string);
+}
+
+void
+start_de_registration(void *data, Evas_Object *obj, void *event_info)
+{
+       if (json_reg != NULL) {
+               int ret = fido_uaf_get_response_message(json_dereg, NULL, _process_dereg_cb, data);
+               dlog_print(DLOG_INFO, "org.tizen.Fidosample", "fido_request_get_deregistration_response = [%d]", ret);
+
+               if (ret != FIDO_ERROR_NONE)
+                       __show_error(ret, (appdata_s *)data);
+       }
+}
+
+static void
+_process_cb_for_notify_pos(fido_error_e tizen_error_code, const char *uaf_response, void *user_data)
+{
+       dlog_print(DLOG_INFO, "org.tizen.Fidosample", "process response = [%d]", tizen_error_code);
+
+       if (tizen_error_code == 0) {
+               dlog_print(DLOG_INFO, "org.tizen.Fidosample", "uaf response = %s", uaf_response);
+
+               int ret = fido_uaf_set_server_result(FIDO_SERVER_STATUS_CODE_OK, uaf_response);
+               dlog_print(DLOG_INFO, "org.tizen.Fidosample", "fido_uaf_set_server_result =[%d]", ret);
+
+               char *error_string = get_error_code(tizen_error_code);
+               create_popup(error_string, (appdata_s *) user_data);
+               free(error_string);
+       } else {
+               __show_error(tizen_error_code, (appdata_s *)user_data);
+       }
+}
+
+static void
+_process_cb_for_notify_neg(fido_error_e tizen_error_code, const char *uaf_response, void *user_data)
+{
+       dlog_print(DLOG_INFO, "org.tizen.Fidosample", "process response = [%d]", tizen_error_code);
+
+       if (tizen_error_code == 0) {
+               dlog_print(DLOG_INFO, "org.tizen.Fidosample", "uaf response = %s", uaf_response);
+
+               int ret = fido_uaf_set_server_result(0, uaf_response);
+               dlog_print(DLOG_INFO, "org.tizen.Fidosample", "fido_uaf_set_server_result =[%d]", ret);
+
+               char *error_string = get_error_code(tizen_error_code);
+               create_popup(error_string, (appdata_s *) user_data);
+               free(error_string);
+       } else {
+               __show_error(tizen_error_code, (appdata_s *)user_data);
+       }
+}
+
+void
+start_notify_pos(void *data, Evas_Object *obj, void *event_info)
+{
+       if (json_reg != NULL) {
+               int ret = fido_uaf_get_response_message(json_reg, NULL, _process_cb_for_notify_pos, data);
+               dlog_print(DLOG_INFO, "org.tizen.Fidosample", "fido_request_get_registration_response = [%d]", ret);
+       }
+}
+
+void
+start_notify_neg(void *data, Evas_Object *obj, void *event_info)
+{
+       if (json_reg != NULL) {
+               int ret = fido_uaf_get_response_message(json_reg, NULL, _process_cb_for_notify_neg, data);
+               dlog_print(DLOG_INFO, "org.tizen.Fidosample", "fido_request_get_registration_response = [%d]", ret);
+       }
+}
+
+static void
+win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       /* To make your application go to background,
+               Call the elm_win_lower() instead
+               Evas_Object *win = (Evas_Object *) data;
+               elm_win_lower(win); */
+       ui_app_exit();
+}
+
+static void
+list_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       Elm_Object_Item *it = event_info;
+       elm_list_item_selected_set(it, EINA_FALSE);
+}
+
+static Eina_Bool
+naviframe_pop_cb(void *data, Elm_Object_Item *it)
+{
+       ui_app_exit();
+       return EINA_FALSE;
+}
+
+static void
+create_list_view(appdata_s *ad)
+{
+       Evas_Object *list;
+       Evas_Object *btn;
+       Evas_Object *nf = ad->nf;
+       Elm_Object_Item *nf_it;
+
+       /* List */
+       list = elm_list_add(nf);
+       elm_list_mode_set(list, ELM_LIST_COMPRESS);
+       evas_object_smart_callback_add(list, "selected", list_selected_cb, NULL);
+
+       /* Main Menu Items Here */
+       elm_list_item_append(list, "Find Authenticator", NULL, NULL, start_discover, ad);
+       elm_list_item_append(list, "Check UAF Message Supported", NULL, NULL, start_check_policy, ad);
+       elm_list_item_append(list, "Registration", NULL, NULL, start_registration, ad);
+       elm_list_item_append(list, "Authentication", NULL, NULL, start_auth, ad);
+       elm_list_item_append(list, "De-Registration", NULL, NULL, start_de_registration, ad);
+       elm_list_item_append(list, "Set Server Result with Success", NULL, NULL, start_notify_pos, ad);
+       elm_list_item_append(list, "Set Server Result with Failure", NULL, NULL, start_notify_neg, ad);
+
+       elm_list_go(list);
+
+       /* This button is set for devices which doesn't have H/W back key. */
+       btn = elm_button_add(nf);
+       elm_object_style_set(btn, "naviframe/end_btn/default");
+       nf_it = elm_naviframe_item_push(nf, "FIDO Test App", btn, NULL, list, NULL);
+       elm_naviframe_item_pop_cb_set(nf_it, naviframe_pop_cb, ad->win);
+}
+
+static void
+create_base_gui(appdata_s *ad)
+{
+       /*
+        * Widget Tree
+        * Window
+        *  - conform
+        *   - layout main
+        *    - naviframe */
+
+       /* Window */
+       ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
+       elm_win_conformant_set(ad->win, EINA_TRUE);
+       elm_win_autodel_set(ad->win, EINA_TRUE);
+
+       if (elm_win_wm_rotation_supported_get(ad->win)) {
+               int rots[4] = { 0, 90, 180, 270 };
+               elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
+       }
+
+       evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
+
+       /* Conformant */
+       ad->conform = elm_conformant_add(ad->win);
+       evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(ad->win, ad->conform);
+       evas_object_show(ad->conform);
+
+       /* Indicator */
+       /* elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW); */
+
+       /* Base Layout */
+       ad->layout = elm_layout_add(ad->conform);
+       evas_object_size_hint_weight_set(ad->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_layout_theme_set(ad->layout, "layout", "application", "default");
+       evas_object_show(ad->layout);
+
+       elm_object_content_set(ad->conform, ad->layout);
+
+       /* Naviframe */
+       ad->nf = elm_naviframe_add(ad->layout);
+       create_list_view(ad);
+       elm_object_part_content_set(ad->layout, "elm.swallow.content", ad->nf);
+       eext_object_event_callback_add(ad->nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
+       eext_object_event_callback_add(ad->nf, EEXT_CALLBACK_MORE, eext_naviframe_more_cb, NULL);
+
+       /* Show window after base gui is set up */
+       evas_object_show(ad->win);
+}
+
+static bool
+app_create(void *data)
+{
+       /* Hook to take necessary actions before main event loop starts
+          Initialize UI resources and application's data
+          If this function returns true, the main loop of application starts
+          If this function returns false, the application is terminated */
+       appdata_s *ad = data;
+
+       elm_app_base_scale_set(1.8);
+       create_base_gui(ad);
+
+       json_reg = __read(_REG_REQ_FILE_NAME);
+       json_auth = __read(_AUTH_REQ_FILE_NAME);
+       json_dereg = __read(_DEREG_REQ_FILE_NAME);
+
+       return true;
+}
+
+static void
+app_control(app_control_h app_control, void *data)
+{
+       /* Handle the launch request. */
+}
+
+static void
+app_pause(void *data)
+{
+       /* Take necessary actions when application becomes invisible. */
+}
+
+static void
+app_resume(void *data)
+{
+       /* Take necessary actions when application becomes visible. */
+}
+
+static void
+app_terminate(void *data)
+{
+       /* Release all resources. */
+}
+
+static void
+ui_app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_LANGUAGE_CHANGED*/
+       char *locale = NULL;
+       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+       elm_language_set(locale);
+       free(locale);
+       return;
+}
+
+static void
+ui_app_orient_changed(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
+       return;
+}
+
+static void
+ui_app_region_changed(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_REGION_FORMAT_CHANGED*/
+}
+
+static void
+ui_app_low_battery(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_LOW_BATTERY*/
+}
+
+static void
+ui_app_low_memory(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_LOW_MEMORY*/
+}
+
+int
+main(int argc, char *argv[])
+{
+       dlog_print(DLOG_ERROR, LOG_TAG, "Launching fido sample");
+
+       appdata_s ad = {0,};
+       int ret = 0;
+
+       ui_app_lifecycle_callback_s event_callback = {0,};
+       app_event_handler_h handlers[5] = {NULL, };
+
+       event_callback.create = app_create;
+       event_callback.terminate = app_terminate;
+       event_callback.pause = app_pause;
+       event_callback.resume = app_resume;
+       event_callback.app_control = app_control;
+
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
+       ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);
+
+       ret = ui_app_main(argc, argv, &event_callback, &ad);
+       if (ret != APP_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
+
+       return ret;
+}
diff --git a/test/conformance_test/FIDOSample/tizen-manifest.xml b/test/conformance_test/FIDOSample/tizen-manifest.xml
new file mode 100644 (file)
index 0000000..64c1b7e
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.example.fidosample" version="1.0.0">
+    <profile name="mobile"/>
+    <ui-application appid="org.example.fidosample" exec="fidosample" launch_mode="single" multiple="false" nodisplay="false" taskmanage="true" type="capp">
+        <label>fidosample</label>
+        <icon>fidosample.png</icon>
+    </ui-application>
+    <privileges>
+        <privilege>http://tizen.org/privilege/account.read</privilege>
+        <privilege>http://tizen.org/privilege/account.write</privilege>
+        <privilege>http://tizen.org/privilege/fido.client</privilege>
+    </privileges>
+</manifest>
diff --git a/test/conformance_test/manasij.p12 b/test/conformance_test/manasij.p12
new file mode 100644 (file)
index 0000000..83a03ce
Binary files /dev/null and b/test/conformance_test/manasij.p12 differ
diff --git a/test/org.example.rademotv-1.0.0-arm.tpk b/test/org.example.rademotv-1.0.0-arm.tpk
new file mode 100644 (file)
index 0000000..ff7e221
Binary files /dev/null and b/test/org.example.rademotv-1.0.0-arm.tpk differ
diff --git a/test/shell_tc/CMakeLists.txt b/test/shell_tc/CMakeLists.txt
new file mode 100644 (file)
index 0000000..68f221a
--- /dev/null
@@ -0,0 +1,77 @@
+SET(FIDO_ASM_SHELL_TC fido-asm-shell-tc)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(FIDO_ASM_SHELL_TC_PKGS REQUIRED
+               dlog
+               db-util
+               glib-2.0
+               capi-base-common
+               pkgmgr-info
+               gio-2.0
+               gio-unix-2.0
+               gmodule-2.0
+               vconf
+               cynara-client
+               cynara-session
+               cynara-creds-gdbus
+               capi-network-connection
+               openssl
+               sqlite3
+               json-glib-1.0
+               capi-base-common
+               capi-appfw-application
+               capi-appfw-app-manager
+               aul
+)
+
+FOREACH(flag ${FIDO_ASM_SHELL_TC_PKGS_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/test/shell_tc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/server/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/server/states/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/server/ops/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/datatypes/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/jsonutil/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/uafv1tlvutil/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/cryptoutil/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/datatypes/auth/)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/silent_auth)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/uiutil/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/datatypes/auth/)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/silent_auth)
+
+FILE( GLOB FIDO_ASM_SHELL_TC_SRCS_CC
+       ../../server/ops/src/*.cpp
+       ../../server/states/src/*.cpp
+       ../../common/datatypes/src/*.cpp
+       ../../common/jsonutil/src/*.cpp
+       ../../common/uafv1tlvutil/src/*.cpp
+       ../../common/cryptoutil/src/*.cpp
+       ../../silent_auth/*.cpp
+       ../../common/uiutil/src/*.cpp
+       ../../silent_auth/*.cpp
+       *.cpp
+)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror -Wno-unused-result")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -Wno-unused-result")
+SET(CMAKE_LDFLAGS "-Wl,-zdefs")
+
+MESSAGE( STATUS "CMAKE_C_FLAGS:         " ${CMAKE_C_FLAGS} )
+MESSAGE( STATUS "CMAKE_CXX_FLAGS:         " ${CMAKE_CXX_FLAGS} )
+MESSAGE( STATUS "CMAKE_LDFLAGS:         " ${CMAKE_LDFLAGS} )
+MESSAGE( STATUS "FIDO_ASM_SHELL_TC_PKGS_LDFLAGS:         " ${FIDO_ASM_SHELL_TC_PKGS_LDFLAGS} )
+
+ADD_EXECUTABLE(${FIDO_ASM_SHELL_TC} 
+       ${FIDO_ASM_SHELL_TC_SRCS_CC} 
+       ../../server/src/AuthenrManager.cpp
+       ../../server/src/AuthenrStub.cpp
+       ../../server/src/AsmStorage.cpp
+       )
+
+TARGET_LINK_LIBRARIES(${FIDO_ASM_SHELL_TC} ${FIDO_ASM_SHELL_TC_PKGS_LDFLAGS})
+
+INSTALL(TARGETS ${FIDO_ASM_SHELL_TC} DESTINATION /opt/usr/devel/fido_asm/tc)
diff --git a/test/shell_tc/fido_asm_shell_tc.cpp b/test/shell_tc/fido_asm_shell_tc.cpp
new file mode 100644 (file)
index 0000000..3902b26
--- /dev/null
@@ -0,0 +1,2175 @@
+
+#include "fido_asm_shell_tc_util.h"
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib.h>
+#include "AuthenrManager.h"
+#include "AuthenrStub.h"
+#include "TlvData.h"
+#include "AuthnrTypes.h"
+#include "AsmStorage.h"
+#include "AsmHelper.h"
+#include "JsonUtil.h"
+#include "AsmRegRequest.h"
+#include "AsmAuthRequest.h"
+#include "AsmDeregRequest.h"
+#include "AsmGetRegsRequest.h"
+#include "../../silent_auth/silent_auth_entry.h"
+#include "asmcrypto.h"
+#include "JsonUtil.h"
+#include "AsmOp.h"
+#include "AsmOpFactory.h"
+
+#include <openssl/bio.h>
+#include <openssl/evp.h>
+#include <openssl/buffer.h>
+#include "TCUiAdaptor.h"
+
+#define SAFE_DELETE(x) do {\
+       if (x != NULL) {\
+               free(x);    \
+               x = NULL;\
+       }\
+} while(0)
+
+/* A 256 bit key */
+const unsigned char *key_test = (unsigned char *)"01234567890123456789012345678901";
+
+/* A 128 bit IV */
+const unsigned char *iv_test = (unsigned char *)"01234567890123456";
+
+void get_user_choice(void);
+
+int
+b64UrlDecode(const unsigned char *in,  int inlen,
+                                               unsigned char *out, int *outlen)
+{
+
+       int npadChars = (inlen %4) == 0 ? 0 : (4 - (inlen%4));
+       unsigned char *base64 = (unsigned char *) malloc(inlen + npadChars);
+       if(base64 == NULL) {
+               return -1;
+       }
+
+       memcpy(base64, in, inlen);
+
+       int i;
+       for(i =0; i < inlen ; i++) {
+               if(base64[i] == '-')
+                       base64[i] = '+';
+
+               else if(base64[i] == '_')
+                       base64[i] = '/';
+
+       }
+
+       if(npadChars != 0)
+               memset(base64 + inlen, '=', npadChars);
+
+       BIO * b64 = NULL;
+       BIO * bmem = NULL;
+       b64 = BIO_new(BIO_f_base64());
+       if(b64 == NULL) {
+
+               SAFE_DELETE(base64);
+               return -1;
+       }
+       BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
+       bmem = BIO_new_mem_buf(base64, inlen);
+       if(bmem == NULL) {
+
+               SAFE_DELETE(base64);
+               return -1;
+       }
+
+       bmem = BIO_push(b64, bmem);
+       *outlen = BIO_read(bmem, out, inlen);
+       if(*outlen <= 0) {
+
+               SAFE_DELETE(base64);
+               return -1;
+       }
+
+       if(bmem)
+               BIO_free_all(bmem);
+
+       return 0;
+}
+
+static void
+print_hex(Buffer *buffer)
+{
+       printf("\nBuffer START\n");
+       if (buffer == NULL)
+               return;
+
+       int len = buffer->len;
+       for (int i = 0; i < len; i++) {
+               printf("%02x", buffer->data[i]);
+       }
+       printf("\nBuffer END\n");
+}
+
+void
+testTLV_getInfo(void)
+{
+
+       //int i = 0;
+       printf("==============testTLV GETINFO start============== \n");
+
+       /*1) Create GetAuthInfoResp*/
+       GetAuthInfoResp *getInfoResp = NULL;
+       GetAuthInfoResp *getInfoRespOrig = (GetAuthInfoResp*)calloc(1, sizeof(GetAuthInfoResp));
+       getInfoRespOrig->apiVersion = 0x01;
+       getInfoRespOrig->statusCode = 0x0000;
+
+                               AuthenticatorInfo *auth = (AuthenticatorInfo*)calloc(1, sizeof(AuthenticatorInfo));
+                               auth->__aaid = (char*)calloc(1, 128);
+                               snprintf(auth->__aaid, 127, "%s", "0011#0701");
+                               auth->__authenticatorIndex = 0;
+
+                               auth->__meta = ALLOC(AuthenticatorMetaData);
+                               auth->__meta->authenticatorType = 0x0020;
+                               auth->__meta->maxKeyHandles = 0x20;
+                               auth->__meta->userVerification = 0x00000040;
+                               auth->__meta->keyProtection = 0x0006;
+                               auth->__meta->matcherProtection = 0x0002;
+                               auth->__meta->transactionConfirmationDisplay = 0x0000;
+                               auth->__meta->authenticationAlg = 0x0001;
+
+                               auth->__tcDispConType = (char*)calloc(1,128);
+                               snprintf(auth->__tcDispConType, 127, "%s", "text/plain");
+
+
+                               GList *tcDispList = NULL;
+                               DisplayTc *disp = ALLOC(DisplayTc);
+                               disp->width = 0x00000002;
+                               disp->height = 0x00000004;
+                               disp->bitDepth = 0x06;
+                               disp->colorType = 0x08;
+                               disp->compression = 0x0A;
+                               disp->filter = 0x0C;
+                               disp->interlace = 0x0F;
+                               disp->plte = (char*)calloc(1, 128);
+                               snprintf(disp->plte, 127, "%s", "rgb");
+                               tcDispList = g_list_append(tcDispList, disp);
+                               auth->__tcDisplayPNGCharacteristics = g_list_first(tcDispList);
+
+
+                               auth->__assertionScheme = (char*)calloc(1,128);
+                               snprintf(auth->__assertionScheme, 127, "%s", "UAFVITLV");
+
+                               GList *attTypes = NULL;
+                               int atTyp = 0x3e07;
+                               attTypes = g_list_append(attTypes, GINT_TO_POINTER(atTyp));
+                               auth->__attestationTypes = g_list_first(attTypes);
+
+       GList *authList = NULL;
+       authList = g_list_append(authList, auth);
+
+       getInfoRespOrig->authList = g_list_first(authList);
+
+
+
+       Buffer *getInfoRespBuff = NULL;
+       TlvEncodable<GetAuthInfoResp> encodableResp(getInfoRespOrig);
+       AuthenticatorInfo *authInfo = NULL;
+       DisplayTc *tcDisp = NULL;
+       GList *authinfoList = NULL;
+
+       int ret = encodableResp.setEncoder(EID_UAFV1_GETINFO_RESP);
+       if (ret == 0) {
+               printf("setEncoder EID_UAFV1_GETINFO_RESP PASS \n");
+       }
+       else {
+               printf("setEncoder EID_UAFV1_GETINFO_RESP FAIL \n");
+               goto ERR;
+       }
+
+       /*2) Create TLV encoded buffer*/
+       getInfoRespBuff = encodableResp.encode();
+       if (getInfoRespBuff != 0) {
+               printf("encode EID_UAFV1_GETINFO_RESP PASS \n");
+               print_hex(getInfoRespBuff);
+       }
+       else {
+               printf("encode EID_UAFV1_GETINFO_RESP FAIL \n");
+               goto ERR;
+       }
+
+
+       /*3) Decode the TLV encoded buffer*/
+       getInfoResp = encodableResp.decode(getInfoRespBuff->data);
+       if (getInfoResp != NULL) {
+               printf("decode GetAuthInfoResp value PASS \n");
+       }
+       else {
+               printf("decode GetAuthInfoResp value FAIL \n");
+               goto ERR;
+       }
+
+       /*3) Compare (3) with (1)*/
+       if (getInfoResp->statusCode == getInfoRespOrig->statusCode)
+               printf("GetAuthInfoResp Status Code TLV decode PASS \n");
+       else
+               printf("GetAuthInfoResp Status Code TLV decode FAIL \n");
+
+       if (getInfoResp->apiVersion == getInfoRespOrig->apiVersion)
+               printf("GetAuthInfoResp API Version TLV decode PASS \n");
+       else
+               printf("GetAuthInfoResp API Version TLV decode FAIL \n");
+
+       authinfoList = getInfoResp->authList;
+       if (authinfoList != NULL) {
+               printf("Non NULL authinfoList value PASS \n");
+       }
+       else {
+               printf("Non NULL authinfoList value FAIL \n");
+               goto ERR;
+       }
+       authInfo = (AuthenticatorInfo*)(g_list_first(authinfoList)->data);
+       if (authInfo != NULL) {
+               printf("Non NULL authInfo value PASS \n");
+       }
+       else {
+               printf("Non NULL authInfo value FAIL \n");
+               goto ERR;
+       }
+
+       if (strcmp(authInfo->__aaid, auth->__aaid) == 0) {
+               printf("AAID PASS \n");
+       }
+       else {
+               printf("AAID FAIL \n");
+               goto ERR;
+       }
+
+       if (authInfo->__authenticatorIndex == auth->__authenticatorIndex) {
+               printf("Authenticator Index PASS \n");
+       }
+       else {
+               printf("Authenticator Index FAIL \n");
+               goto ERR;
+       }
+
+       //=========================================Meta Data========================================//
+       if (authInfo->__meta != NULL) {
+               printf("Authenticator Metadata NOT NULL PASS \n");
+       }
+       else {
+               printf("Authenticator Metadata NOT NULL FAIL \n");
+               goto ERR;
+       }
+
+       if (authInfo->__meta->authenticatorType == auth->__meta->authenticatorType) {
+               printf("Authenticator Metadata authenticatorType PASS \n");
+       }
+       else {
+               printf("Authenticator Metadata authenticatorType FAIL \n");
+               //goto ERR;
+       }
+
+       if (authInfo->__meta->authenticationAlg == auth->__meta->authenticationAlg) {
+               printf("Authenticator Metadata authenticationAlg PASS \n");
+       }
+       else {
+               printf("Authenticator Metadata authenticationAlg FAIL \n");
+               //goto ERR;
+       }
+
+       if (authInfo->__meta->keyProtection == auth->__meta->keyProtection) {
+               printf("Authenticator Metadata keyProtection PASS \n");
+       }
+       else {
+               printf("Authenticator Metadata keyProtection FAIL \n");
+               //goto ERR;
+       }
+
+       if (authInfo->__meta->matcherProtection == auth->__meta->matcherProtection) {
+               printf("Authenticator Metadata matcherProtection PASS \n");
+       }
+       else {
+               printf("Authenticator Metadata matcherProtection FAIL \n");
+               //goto ERR;
+       }
+
+       if (authInfo->__meta->maxKeyHandles == auth->__meta->maxKeyHandles) {
+               printf("Authenticator Metadata maxKeyHandles PASS \n");
+       }
+       else {
+               printf("Authenticator Metadata maxKeyHandles FAIL \n");
+               //goto ERR;
+       }
+
+       if (authInfo->__meta->transactionConfirmationDisplay == auth->__meta->transactionConfirmationDisplay) {
+               printf("Authenticator Metadata transactionConfirmationDisplay PASS \n");
+       }
+       else {
+               printf("Authenticator Metadata transactionConfirmationDisplay FAIL \n");
+               //goto ERR;
+       }
+
+       if (authInfo->__meta->userVerification == auth->__meta->userVerification) {
+               printf("Authenticator Metadata userVerification PASS \n");
+       }
+       else {
+               printf("Authenticator Metadata userVerification FAIL \n");
+               //goto ERR;
+       }
+       //=========================================Meta Data========================================//
+
+       if (authInfo->__tcDisplayPNGCharacteristics != NULL) {
+               printf("Non NULL tcDisplayPNGCharacteristics value PASS \n");
+       }
+       else {
+               printf("Non NULL tcDisplayPNGCharacteristics value FAIL \n");
+               goto ERR;
+       }
+
+
+               tcDisp = (DisplayTc*)(g_list_first(authInfo->__tcDisplayPNGCharacteristics)->data);
+
+               if(tcDisp->width == disp->width) {
+                       printf("Authenticator tcDisplayPNGCharacteristics width PASS \n");
+               }
+               else {
+                       printf("Authenticator tcDisplayPNGCharacteristics width FAIL \n");
+               }
+
+
+               if(tcDisp->height == disp->height) {
+                       printf("Authenticator tcDisplayPNGCharacteristics height PASS \n");
+               }
+               else {
+                       printf("Authenticator tcDisplayPNGCharacteristics height FAIL \n");
+               }
+
+
+               if(tcDisp->bitDepth == disp->bitDepth) {
+                       printf("Authenticator tcDisplayPNGCharacteristics bitDepth PASS \n");
+               }
+               else {
+                       printf("Authenticator tcDisplayPNGCharacteristics bitDepth FAIL \n");
+               }
+
+               if(tcDisp->colorType == disp->colorType) {
+                       printf("Authenticator tcDisplayPNGCharacteristics colorType PASS \n");
+               }
+               else {
+                       printf("Authenticator tcDisplayPNGCharacteristics colorType FAIL \n");
+               }
+
+               if(tcDisp->compression == disp->compression) {
+                       printf("Authenticator tcDisplayPNGCharacteristics compression PASS \n");
+               }
+               else {
+                       printf("Authenticator tcDisplayPNGCharacteristics compression FAIL \n");
+               }
+
+               if(tcDisp->filter == disp->filter) {
+                       printf("Authenticator tcDisplayPNGCharacteristics filter PASS \n");
+               }
+               else {
+                       printf("Authenticator tcDisplayPNGCharacteristics filter FAIL \n");
+               }
+
+               if(tcDisp->interlace == disp->interlace) {
+                       printf("Authenticator tcDisplayPNGCharacteristics interlace PASS \n");
+               }
+               else {
+                       printf("Authenticator tcDisplayPNGCharacteristics interlace FAIL \n");
+               }
+
+               if (strcmp(tcDisp->plte, disp->plte) == 0) {
+                       printf("plte PASS \n");
+               }
+               else {
+                       printf("plte FAIL \n");
+               }
+
+ERR:
+       printf("==============testTLV GETINFO end============== \n");
+       get_user_choice();
+}
+
+void
+testTLV_RegisterReq(void)
+{
+       //int i = 0;
+       printf("==============testTLV REGISTER REQUEST start============== \n");
+
+       /*1) Create GetRegiterReq*/
+
+       RegisterReq *getRegReqInfo = NULL;
+       RegisterReq *getRegReq = (RegisterReq*)calloc(1, sizeof(RegisterReq));
+
+       getRegReq->authIdx = 0x04;
+
+       getRegReq->appId = (char*)calloc(1, 512);
+       snprintf(getRegReq->appId, 511, "%s", "dummy_app_id");
+
+       const char *fc = "dummy_final_challenge";
+       getRegReq->fch = ALLOC(Buffer);
+       getRegReq->fch->data = NALLOC(5000, uint8_t);
+       memcpy(getRegReq->fch->data, fc, strlen(fc));
+       getRegReq->fch->len = strlen(fc);
+
+       getRegReq->userName = (char*)calloc(1, 128);
+       snprintf(getRegReq->userName, 127, "%s", "dummy_user_name");
+
+       getRegReq->attType = 0x0025;
+
+       const char *khA = "dummy_kh_access_token";
+       getRegReq->khAccessToken = ALLOC(Buffer);
+       getRegReq->khAccessToken->data = NALLOC(5000, uint8_t);
+       memcpy(getRegReq->khAccessToken->data, khA, strlen(khA));
+       getRegReq->khAccessToken->len = strlen(khA);
+
+       getRegReq->userVToken = (char*)calloc(1, 128);
+       snprintf(getRegReq->userVToken, 127, "%s", "dummy_user_verify_token");
+
+       Buffer *getRegReqBuff = NULL;
+       TlvEncodable<RegisterReq> encodableReq(getRegReq);
+
+       int ret = encodableReq.setEncoder(EID_UAFV1_REGISTER_REQ);
+       if (ret == 0) {
+               printf("setEncoder EID_UAFV1_REGISTER_REQ PASS \n");
+       }
+       else {
+               printf("setEncoder EID_UAFV1_REGISTER_REQ FAIL \n");
+               goto ERR;
+       }
+
+       /*2) Create TLV encoded buffer*/
+       getRegReqBuff = encodableReq.encode();
+       if (getRegReqBuff != 0) {
+               printf("encode EID_UAFV1_REGISTER_REQ PASS \n");
+               print_hex(getRegReqBuff);
+       }
+       else {
+               printf("encode EID_UAFV1_REGISTER_REQ FAIL \n");
+               goto ERR;
+       }
+
+       //===================================DECODE==============================//
+
+       getRegReqInfo = encodableReq.decode(getRegReqBuff->data);
+       if (getRegReqInfo != NULL) {
+               printf("decode EID_UAFV1_REGISTER_REQ PASS \n");
+       }
+       else {
+               printf("decode EID_UAFV1_REGISTER_REQ FAIL \n");
+               goto ERR;
+       }
+
+       //===================================DECODE==============================//
+
+       //===================================COMPARE==============================//
+
+       if(getRegReqInfo->authIdx == getRegReq->authIdx) {
+               printf("AUTHENTICATOR INDEX PASS \n");
+       }
+       else {
+               printf("AUTHENTICATOR INDEX FAIL \n");
+               goto ERR;
+       }
+
+       if (strcmp(getRegReqInfo->appId, getRegReq->appId) == 0) {
+               printf("APPID PASS \n");
+       }
+       else {
+               printf("APPID FAIL \n");
+               goto ERR;
+       }
+
+
+       if (memcmp(getRegReqInfo->fch->data, getRegReq->fch->data, getRegReq->fch->len) == 0) {
+               printf("FINAL CHALLENGE PASS \n");
+       }
+       else {
+               printf("FINAL CHALLENGE FAIL \n");
+               goto ERR;
+       }
+
+       if (strcmp(getRegReqInfo->userName, getRegReq->userName) == 0) {
+               printf("USERNAME PASS \n");
+       }
+       else {
+               printf("USERNAME FAIL \n");
+               goto ERR;
+       }
+
+       if(getRegReqInfo->attType == getRegReq->attType) {
+               printf("ATTESTATION TYPE PASS \n");
+       }
+       else {
+               printf("ATTESTATION TYPE FAIL \n");
+               goto ERR;
+       }
+
+       if (memcmp(getRegReqInfo->khAccessToken->data, getRegReq->khAccessToken->data, getRegReq->khAccessToken->len) == 0) {
+               printf("KEY HANDLE ACCESS TOKEN PASS \n");
+       }
+       else {
+               printf("KEY HANDLE ACCESS TOKEN FAIL \n");
+               goto ERR;
+       }
+
+       if (strcmp(getRegReqInfo->userVToken, getRegReq->userVToken) == 0) {
+               printf("USER VERIFICATION TOKEN PASS \n");
+       }
+       else {
+               printf("USER VERIFICATION TOKEN FAIL \n");
+               goto ERR;
+       }
+
+       //===================================COMPARE==============================//
+
+
+ERR:
+       printf("==============testTLV REGISTER REQUEST end============== \n");
+       get_user_choice();
+}
+
+void
+testTLV_RegisterResp(void)
+{
+       printf("==============testTLV REGISTER RESPONSE start============== \n");
+
+       /*1) Create GetRegiterResp*/
+
+       RegisterResp *getRegRespInfo = NULL;
+       RegisterResp *getRegResp = (RegisterResp*)calloc(1, sizeof(RegisterResp));
+
+       getRegResp->statusCode = 0x0004;
+
+       getRegResp->regAssertion = ALLOC(RegAssertion);
+
+       getRegResp->regAssertion->krd = ALLOC(Krd);
+
+               getRegResp->regAssertion->krd->aaid = (char*)calloc(1, 128);
+               snprintf(getRegResp->regAssertion->krd->aaid, 127, "%s", "ABCD#1234");
+
+               getRegResp->regAssertion->krd->assrtInfo = ALLOC(AssertionInfo);
+               getRegResp->regAssertion->krd->assrtInfo->authVersion = 0x0002;
+               getRegResp->regAssertion->krd->assrtInfo->authMode = 0x01;
+               getRegResp->regAssertion->krd->assrtInfo->signatureAlgAndEncoding = 0x0002;
+               getRegResp->regAssertion->krd->assrtInfo->publicKeyAlgAndEncoding = 0x0101;
+
+               const char *fc = "dummy_final_challenge";
+               getRegResp->regAssertion->krd->fch = ALLOC(Buffer);
+               getRegResp->regAssertion->krd->fch->data = NALLOC(5000, uint8_t);
+               memcpy(getRegResp->regAssertion->krd->fch->data, fc, strlen(fc));
+               getRegResp->regAssertion->krd->fch->len = strlen(fc);
+
+               getRegResp->regAssertion->krd->keyId = ALLOC(Buffer);
+               getRegResp->regAssertion->krd->keyId->data = NALLOC(128, uint8_t);
+               memcpy(getRegResp->regAssertion->krd->keyId->data, "dummy_key_id", 127);
+               getRegResp->regAssertion->krd->keyId->len = 12;
+
+               getRegResp->regAssertion->krd->counter = ALLOC(Counters);
+               getRegResp->regAssertion->krd->counter->signCounter = 0x00000003;
+               getRegResp->regAssertion->krd->counter->regCounter = 0x00000007;
+
+               getRegResp->regAssertion->krd->pubKey = ALLOC(Buffer);
+               getRegResp->regAssertion->krd->pubKey->data = NALLOC(128, uint8_t);
+               memcpy(getRegResp->regAssertion->krd->pubKey->data, "dummy_pub_key", 127);
+               getRegResp->regAssertion->krd->pubKey->len = 13;
+
+       getRegResp->regAssertion->attFull = ALLOC(AttestationBasicFull);
+       getRegResp->regAssertion->attFull->sig = ALLOC(Buffer);
+       getRegResp->regAssertion->attFull->sig->data = NALLOC(128, uint8_t);
+       memcpy(getRegResp->regAssertion->attFull->sig->data, "dummy_sign", 127);
+       getRegResp->regAssertion->attFull->sig->len = 10;
+
+       getRegResp->regAssertion->attFull->cert = ALLOC(Buffer);
+       getRegResp->regAssertion->attFull->cert->data = NALLOC(128, uint8_t);
+       memcpy(getRegResp->regAssertion->attFull->cert->data, "dummy_attest_cert", 127);
+       getRegResp->regAssertion->attFull->cert->len = 17;
+
+       getRegResp->kh = ALLOC(Buffer);
+       getRegResp->kh->data = NALLOC(128, uint8_t);
+       memcpy(getRegResp->kh->data, "dummy_final_challenge", 127);
+       getRegResp->kh->len = 21;
+
+       printf("==============testTLV REGISTER RESPONSE object formed============== \n");
+
+
+       Buffer *getRegRespBuff = NULL;
+       TlvEncodable<RegisterResp> encodableRegResp(getRegResp);
+
+       int ret = encodableRegResp.setEncoder(EID_UAFV1_REGISTER_RESP);
+       if (ret == 0) {
+               printf("setEncoder EID_UAFV1_REGISTER_RESP PASS \n");
+       }
+       else {
+               printf("setEncoder EID_UAFV1_REGISTER_RESP FAIL \n");
+               goto ERR;
+       }
+
+       /*2) Create TLV encoded buffer*/
+       getRegRespBuff = encodableRegResp.encode();
+       if (getRegRespBuff != NULL) {
+               printf("encode EID_UAFV1_REGISTER_RESP PASS \n");
+               print_hex(getRegRespBuff);
+       }
+       else {
+               printf("encode EID_UAFV1_REGISTER_RESP FAIL \n");
+               goto ERR;
+       }
+
+       //=======================================DECODE======================================//
+
+       getRegRespInfo = encodableRegResp.decode(getRegRespBuff->data);
+       if (getRegRespInfo != NULL) {
+               printf("decode EID_UAFV1_REGISTER_RESP PASS \n");
+       }
+       else {
+               printf("decode EID_UAFV1_REGISTER_RESP FAIL \n");
+               goto ERR;
+       }
+
+       //=======================================DECODE======================================//
+
+
+
+       //=======================================COMPARE======================================//
+
+       if (getRegRespInfo->statusCode == getRegResp->statusCode) {
+               printf("statusCode EID_UAFV1_REGISTER_RESP PASS \n");
+       }
+       else {
+               printf("statusCode EID_UAFV1_REGISTER_RESP FAIL \n");
+               goto ERR;
+       }
+
+               if (strcmp(getRegRespInfo->regAssertion->krd->aaid, getRegResp->regAssertion->krd->aaid) == 0) {
+                       printf("AAID EID_UAFV1_REGISTER_RESP PASS \n");
+               }
+               else {
+                       printf("AAID EID_UAFV1_REGISTER_RESP FAIL \n");
+                       goto ERR;
+               }
+
+                       if (getRegRespInfo->regAssertion->krd->assrtInfo->authVersion == getRegResp->regAssertion->krd->assrtInfo->authVersion) {
+                               printf("AuthVersion EID_UAFV1_REGISTER_RESP PASS \n");
+                       }
+                       else {
+                               printf("AuthVersion EID_UAFV1_REGISTER_RESP FAIL \n");
+                               goto ERR;
+                       }
+
+                       if (getRegRespInfo->regAssertion->krd->assrtInfo->authMode == getRegResp->regAssertion->krd->assrtInfo->authMode) {
+                               printf("AuthMode EID_UAFV1_REGISTER_RESP PASS \n");
+                       }
+                       else {
+                               printf("AuthMode EID_UAFV1_REGISTER_RESP FAIL \n");
+                               goto ERR;
+                       }
+
+                       if (getRegRespInfo->regAssertion->krd->assrtInfo->signatureAlgAndEncoding == getRegResp->regAssertion->krd->assrtInfo->signatureAlgAndEncoding) {
+                               printf("signatureAlgAndEncoding EID_UAFV1_REGISTER_RESP PASS \n");
+                       }
+                       else {
+                               printf("signatureAlgAndEncoding EID_UAFV1_REGISTER_RESP FAIL \n");
+                               goto ERR;
+                       }
+
+                       if (getRegRespInfo->regAssertion->krd->assrtInfo->publicKeyAlgAndEncoding == getRegResp->regAssertion->krd->assrtInfo->publicKeyAlgAndEncoding) {
+                               printf("publicKeyAlgAndEncoding EID_UAFV1_REGISTER_RESP PASS \n");
+                       }
+                       else {
+                               printf("publicKeyAlgAndEncoding EID_UAFV1_REGISTER_RESP FAIL \n");
+                               goto ERR;
+                       }
+
+               if (memcmp(getRegRespInfo->regAssertion->krd->fch->data , getRegResp->regAssertion->krd->fch->data,
+                                  getRegResp->regAssertion->krd->fch->len) == 0) {
+                       printf("fch EID_UAFV1_REGISTER_RESP PASS \n");
+               }
+               else {
+                       printf("fch EID_UAFV1_REGISTER_RESP FAIL \n");
+                       goto ERR;
+               }
+
+               if (memcmp(getRegRespInfo->regAssertion->krd->keyId->data ,
+                                  getRegResp->regAssertion->krd->keyId->data, getRegResp->regAssertion->krd->keyId->len) == 0) {
+                       printf("keyId EID_UAFV1_REGISTER_RESP PASS \n");
+               }
+               else {
+                       printf("keyId EID_UAFV1_REGISTER_RESP FAIL \n");
+                       goto ERR;
+               }
+
+                       if (getRegRespInfo->regAssertion->krd->counter->regCounter == getRegResp->regAssertion->krd->counter->regCounter) {
+                               printf("regCounter EID_UAFV1_REGISTER_RESP PASS \n");
+                       }
+                       else {
+                               printf("regCounter EID_UAFV1_REGISTER_RESP FAIL \n");
+                               goto ERR;
+                       }
+
+                       if (getRegRespInfo->regAssertion->krd->counter->signCounter == getRegResp->regAssertion->krd->counter->signCounter) {
+                               printf("signCounter EID_UAFV1_REGISTER_RESP PASS \n");
+                       }
+                       else {
+                               printf("signCounter EID_UAFV1_REGISTER_RESP FAIL \n");
+                               goto ERR;
+                       }
+
+               if (memcmp(getRegRespInfo->regAssertion->krd->pubKey->data ,
+                                  getRegResp->regAssertion->krd->pubKey->data, getRegResp->regAssertion->krd->pubKey->len) == 0) {
+                       printf("pubKey EID_UAFV1_REGISTER_RESP PASS \n");
+               }
+               else {
+                       printf("pubKey EID_UAFV1_REGISTER_RESP FAIL \n");
+                       goto ERR;
+               }
+
+                       if (memcmp(getRegRespInfo->regAssertion->attFull->sig->data ,
+                                          getRegResp->regAssertion->attFull->sig->data, getRegResp->regAssertion->attFull->sig->len) == 0) {
+                               printf("attFull->sig EID_UAFV1_REGISTER_RESP PASS \n");
+                       }
+                       else {
+                               printf("attFull->sig EID_UAFV1_REGISTER_RESP FAIL \n");
+                               goto ERR;
+                       }
+
+                       if (memcmp(getRegRespInfo->regAssertion->attFull->cert->data ,
+                                          getRegResp->regAssertion->attFull->cert->data, getRegResp->regAssertion->attFull->cert->len) == 0) {
+                               printf("attFull->cert EID_UAFV1_REGISTER_RESP PASS \n");
+                       }
+                       else {
+                               printf("attFull->cert EID_UAFV1_REGISTER_RESP FAIL \n");
+                               goto ERR;
+                       }
+
+       if (memcmp(getRegRespInfo->kh->data ,
+                          getRegResp->kh->data, getRegResp->kh->len) == 0) {
+               printf("keyHandle EID_UAFV1_REGISTER_RESP PASS \n");
+       }
+       else {
+               printf("keyHandle EID_UAFV1_REGISTER_RESP FAIL \n");
+               goto ERR;
+       }
+
+
+       //=======================================COMPARE======================================//
+
+ERR:
+       printf("==============testTLV REGISTER RESPONSE end============== \n");
+       get_user_choice();
+}
+
+void
+testTLV_SignReq(void)
+{
+       printf("==============testTLV AUTHENTICATOR REQUEST start============== \n");
+
+       /*1) Create getAuthReqInfo*/
+
+       AuthenticateReq *getAuthReqInfo = NULL;
+       AuthenticateReq *getAuthReq = ALLOC(AuthenticateReq);
+
+       getAuthReq->authIdx = 0x04;
+
+       getAuthReq->appId = (char*)calloc(1, 512);
+       snprintf(getAuthReq->appId, 511, "%s", "dummy_app_id");
+
+       const char *fc = "dummy_final_challenge";
+       getAuthReq->fch = ALLOC(Buffer);
+       getAuthReq->fch->data = NALLOC(5000, uint8_t);
+       memcpy(getAuthReq->fch->data, fc, strlen(fc));
+       getAuthReq->fch->len = strlen(fc);
+
+       getAuthReq->tc = (char*)calloc(1, 128);
+       snprintf(getAuthReq->tc, 127, "%s", "dummy_transaction_content");
+
+       const char *khA = "dummy_kh_access_token";
+       getAuthReq->khATok = ALLOC(Buffer);
+       getAuthReq->khATok->data = NALLOC(5000, uint8_t);
+       memcpy(getAuthReq->khATok->data, khA, strlen(khA));
+       getAuthReq->khATok->len = strlen(khA);
+
+       getAuthReq->userVToken = (char*)calloc(1, 128);
+       snprintf(getAuthReq->userVToken, 127, "%s", "dummy_user_verify_token");
+
+       Buffer *getAuthReqInfoBuff = NULL;
+       TlvEncodable<AuthenticateReq> encodableSignReq(getAuthReq);
+
+       int ret = encodableSignReq.setEncoder(EID_UAFV1_SIGN_REQ);
+       if (ret == 0) {
+               printf("setEncoder EID_UAFV1_SIGN_REQ PASS \n");
+       }
+       else {
+               printf("setEncoder EID_UAFV1_SIGN_REQ FAIL \n");
+               goto ERR;
+       }
+
+       /*2) Create TLV encoded buffer*/
+       getAuthReqInfoBuff = encodableSignReq.encode();
+       if (getAuthReqInfoBuff != NULL) {
+               printf("encode EID_UAFV1_SIGN_REQ PASS \n");
+               print_hex(getAuthReqInfoBuff);
+       }
+       else {
+               printf("encode EID_UAFV1_SIGN_REQ FAIL \n");
+               goto ERR;
+       }
+
+       //===============================DECODE=================================//
+
+       getAuthReqInfo = encodableSignReq.decode(getAuthReqInfoBuff->data);
+       if (getAuthReqInfo != NULL) {
+               printf("decode EID_UAFV1_SIGN_REQ PASS \n");
+       }
+       else {
+               printf("decode EID_UAFV1_SIGN_REQ FAIL \n");
+               goto ERR;
+       }
+
+       //===============================DECODE=================================//
+
+       //===============================COMPARE=================================//
+
+       if (getAuthReqInfo->authIdx == getAuthReq->authIdx) {
+               printf("authIdx EID_UAFV1_SIGN_REQ PASS \n");
+       }
+       else {
+               printf("authIdx EID_UAFV1_SIGN_REQ FAIL \n");
+               goto ERR;
+       }
+
+       if (strcmp(getAuthReqInfo->appId, getAuthReq->appId) == 0) {
+               printf("appId EID_UAFV1_SIGN_REQ PASS \n");
+       }
+       else {
+               printf("appId EID_UAFV1_SIGN_REQ FAIL \n");
+               goto ERR;
+       }
+
+       if (memcmp(getAuthReqInfo->fch->data, getAuthReq->fch->data, getAuthReq->fch->len) == 0) {
+               printf("fch EID_UAFV1_SIGN_REQ PASS \n");
+       }
+       else {
+               printf("appId EID_UAFV1_SIGN_REQ FAIL \n");
+               goto ERR;
+       }
+
+
+       if (strcmp(getAuthReqInfo->tc, getAuthReq->tc) == 0) {
+               printf("tc EID_UAFV1_SIGN_REQ PASS \n");
+       }
+       else {
+               printf("tc EID_UAFV1_SIGN_REQ FAIL \n");
+               goto ERR;
+       }
+
+
+       if (memcmp(getAuthReqInfo->khATok->data, getAuthReq->khATok->data, getAuthReq->khATok->len) == 0) {
+               printf("khATok EID_UAFV1_SIGN_REQ PASS \n");
+       }
+       else {
+               printf("khATok EID_UAFV1_SIGN_REQ FAIL \n");
+               goto ERR;
+       }
+
+
+       if (strcmp(getAuthReqInfo->userVToken, getAuthReq->userVToken) == 0) {
+               printf("userVToken EID_UAFV1_SIGN_REQ PASS \n");
+       }
+       else {
+               printf("userVToken EID_UAFV1_SIGN_REQ FAIL \n");
+               goto ERR;
+       }
+
+       //===============================COMPARE=================================//
+
+ERR:
+       printf("==============testTLV AUTHENTICATOR REQUEST end============== \n");
+       get_user_choice();
+}
+
+void
+testTLV_SignResp(void)
+{
+       printf("==============testTLV AUTHENTICATOR RESPONSE start============== \n");
+
+       AuthenticateResp *getAuthRespInfo = NULL;
+       AuthenticateResp *getAuthResp = ALLOC(AuthenticateResp);
+
+       getAuthResp->statusCode = 0x0004;
+
+       getAuthResp->authAssertion = ALLOC(AuthAssertion);
+
+               getAuthResp->authAssertion->sigData = ALLOC(SigData);
+
+                       getAuthResp->authAssertion->sigData->aaid = (char*)calloc(1, 128);
+                       snprintf(getAuthResp->authAssertion->sigData->aaid, 127, "%s", "ABCD#1234");
+
+                       getAuthResp->authAssertion->sigData->assrtInfo = ALLOC(AssertionInfo);
+
+                               getAuthResp->authAssertion->sigData->assrtInfo->authVersion = 0x0002;
+                               getAuthResp->authAssertion->sigData->assrtInfo->authMode = 0x01;
+                               getAuthResp->authAssertion->sigData->assrtInfo->signatureAlgAndEncoding = 0x0002;
+
+                       getAuthResp->authAssertion->sigData->authNonce = ALLOC(Buffer);
+
+                               getAuthResp->authAssertion->sigData->authNonce->len = 18;
+                               getAuthResp->authAssertion->sigData->authNonce->data = NALLOC(128, uint8_t);
+                               memcpy(getAuthResp->authAssertion->sigData->authNonce->data, "dummy_authnr_nonce", 127);
+
+                       const char *fc = "dummy_final_challenge";
+                       getAuthResp->authAssertion->sigData->fch = ALLOC(Buffer);
+                       getAuthResp->authAssertion->sigData->fch->data = NALLOC(5000, uint8_t);
+                       memcpy(getAuthResp->authAssertion->sigData->fch->data, fc, strlen(fc));
+                       getAuthResp->authAssertion->sigData->fch->len = strlen(fc);
+
+                       getAuthResp->authAssertion->sigData->tcHash = ALLOC(Buffer);
+
+                               getAuthResp->authAssertion->sigData->tcHash->len = 19;
+                               getAuthResp->authAssertion->sigData->tcHash->data = NALLOC(128, uint8_t);
+                               memcpy(getAuthResp->authAssertion->sigData->tcHash->data, "dummy_transact_hash", 127);
+
+                       getAuthResp->authAssertion->sigData->keyId = ALLOC(Buffer);
+
+                               getAuthResp->authAssertion->sigData->keyId->len = 12;
+                               getAuthResp->authAssertion->sigData->keyId->data = NALLOC(128, uint8_t);
+                               memcpy(getAuthResp->authAssertion->sigData->keyId->data, "dummy_key_id", 127);
+
+                       getAuthResp->authAssertion->sigData->counter = ALLOC(Counters);
+
+                               getAuthResp->authAssertion->sigData->counter->signCounter = 0x00000003;
+
+               getAuthResp->authAssertion->sig = ALLOC(Buffer);
+
+                       getAuthResp->authAssertion->sig->len = 10;
+                       getAuthResp->authAssertion->sig->data = NALLOC(128, uint8_t);
+                       memcpy(getAuthResp->authAssertion->sig->data, "dummy_sign", 127);
+
+
+       Buffer *getAuthRespInfoBuff = NULL;
+       TlvEncodable<AuthenticateResp> encodableSignResp(getAuthResp);
+
+       int ret = encodableSignResp.setEncoder(EID_UAFV1_SIGN_RESP);
+       if (ret == 0) {
+               printf("setEncoder EID_UAFV1_SIGN_RESP PASS \n");
+       }
+       else {
+               printf("setEncoder EID_UAFV1_SIGN_RESP FAIL \n");
+               goto ERR;
+       }
+
+       /*2) Create TLV encoded buffer*/
+       getAuthRespInfoBuff = encodableSignResp.encode();
+       if (getAuthRespInfoBuff != NULL) {
+               printf("encode EID_UAFV1_SIGN_RESP PASS \n");
+               print_hex(getAuthRespInfoBuff);
+       }
+       else {
+               printf("encode EID_UAFV1_SIGN_RESP FAIL \n");
+               goto ERR;
+       }
+
+       //=======================================DECODE=======================================//
+
+       getAuthRespInfo = encodableSignResp.decode(getAuthRespInfoBuff->data);
+       if (getAuthRespInfo != NULL) {
+               printf("decode EID_UAFV1_SIGN_RESP PASS \n");
+       }
+       else {
+               printf("decode EID_UAFV1_SIGN_RESP FAIL \n");
+               goto ERR;
+       }
+       //=======================================DECODE=======================================//
+
+       //=======================================COMPARE=======================================//
+
+       if (getAuthRespInfo->statusCode == getAuthResp->statusCode) {
+               printf("statusCode EID_UAFV1_SIGN_RESP PASS \n");
+       }
+       else {
+               printf("statusCode EID_UAFV1_SIGN_RESP FAIL \n");
+               goto ERR;
+       }
+
+               if (strcmp(getAuthRespInfo->authAssertion->sigData->aaid, getAuthResp->authAssertion->sigData->aaid) == 0) {
+                       printf("aaid EID_UAFV1_SIGN_RESP PASS \n");
+               }
+               else {
+                       printf("aaid EID_UAFV1_SIGN_RESP FAIL \n");
+                       goto ERR;
+               }
+
+                       if (getAuthRespInfo->authAssertion->sigData->assrtInfo->authVersion == getAuthResp->authAssertion->sigData->assrtInfo->authVersion) {
+                               printf("authVersion EID_UAFV1_SIGN_RESP PASS \n");
+                       }
+                       else {
+                               printf("authVersion EID_UAFV1_SIGN_RESP FAIL \n");
+                               goto ERR;
+                       }
+
+                       if (getAuthRespInfo->authAssertion->sigData->assrtInfo->authMode == getAuthResp->authAssertion->sigData->assrtInfo->authMode) {
+                               printf("authMode EID_UAFV1_SIGN_RESP PASS \n");
+                       }
+                       else {
+                               printf("authMode EID_UAFV1_SIGN_RESP FAIL \n");
+                               goto ERR;
+                       }
+
+                       if (getAuthRespInfo->authAssertion->sigData->assrtInfo->signatureAlgAndEncoding == getAuthResp->authAssertion->sigData->assrtInfo->signatureAlgAndEncoding) {
+                               printf("signatureAlgAndEncoding EID_UAFV1_SIGN_RESP PASS \n");
+                       }
+                       else {
+                               printf("signatureAlgAndEncoding EID_UAFV1_SIGN_RESP FAIL \n");
+                               goto ERR;
+                       }
+
+               if (memcmp(getAuthRespInfo->authAssertion->sigData->authNonce->data,
+                                  getAuthResp->authAssertion->sigData->authNonce->data, getAuthResp->authAssertion->sigData->authNonce->len) == 0) {
+                       printf("authNonce EID_UAFV1_SIGN_RESP PASS \n");
+               }
+               else {
+                       printf("authNonce EID_UAFV1_SIGN_RESP FAIL \n");
+                       goto ERR;
+               }
+
+               if (memcmp(getAuthRespInfo->authAssertion->sigData->fch->data, getAuthResp->authAssertion->sigData->fch->data,
+                               getAuthResp->authAssertion->sigData->fch->len) == 0) {
+                       printf("fch EID_UAFV1_SIGN_RESP PASS \n");
+               }
+               else {
+                       printf("fch EID_UAFV1_SIGN_RESP FAIL \n");
+                       goto ERR;
+               }
+
+               if (memcmp(getAuthRespInfo->authAssertion->sigData->tcHash->data,
+                                  getAuthResp->authAssertion->sigData->tcHash->data, getAuthResp->authAssertion->sigData->tcHash->len) == 0) {
+                       printf("tcHash EID_UAFV1_SIGN_RESP PASS \n");
+               }
+               else {
+                       printf("tcHash EID_UAFV1_SIGN_RESP FAIL \n");
+                       goto ERR;
+               }
+
+               if (memcmp(getAuthRespInfo->authAssertion->sigData->keyId->data,
+                                  getAuthResp->authAssertion->sigData->keyId->data, getAuthResp->authAssertion->sigData->keyId->len) == 0) {
+                       printf("keyId EID_UAFV1_SIGN_RESP PASS \n");
+               }
+               else {
+                       printf("keyId EID_UAFV1_SIGN_RESP FAIL \n");
+                       goto ERR;
+               }
+
+                       if (getAuthRespInfo->authAssertion->sigData->counter->signCounter == getAuthResp->authAssertion->sigData->counter->signCounter) {
+                               printf("signCounter EID_UAFV1_SIGN_RESP PASS \n");
+                       }
+                       else {
+                               printf("signCounter EID_UAFV1_SIGN_RESP FAIL \n");
+                               goto ERR;
+                       }
+
+       if (memcmp(getAuthRespInfo->authAssertion->sig->data,
+                          getAuthResp->authAssertion->sig->data, getAuthResp->authAssertion->sig->len) == 0) {
+               printf("signature EID_UAFV1_SIGN_RESP PASS \n");
+       }
+       else {
+               printf("signature EID_UAFV1_SIGN_RESP FAIL \n");
+               goto ERR;
+       }
+
+       //=======================================COMPARE=======================================//
+
+ERR:
+       printf("==============testTLV AUTHENTICATOR RESPONSE end============== \n");
+       get_user_choice();
+}
+
+void
+testTLV_DeRegReq(void)
+{
+       printf("==============testTLV DEREGISTER REQUEST start============== \n");
+
+       DeregReq *getDeRegReqInfo = NULL;
+       DeregReq *getDeRegReq = ALLOC(DeregReq);
+
+       getDeRegReq->authIdx = 0x01;
+
+       getDeRegReq->appId = (char*)calloc(1, 512);
+       snprintf(getDeRegReq->appId, 511, "%s", "dummy_app_id");
+
+       getDeRegReq->keyId = (char*)calloc(1, 128);
+       snprintf(getDeRegReq->keyId, 127, "%s", "dummy_key_id");
+
+       const char *khA = "dummy_kh_access_token";
+       getDeRegReq->khATok = ALLOC(Buffer);
+       getDeRegReq->khATok->data = NALLOC(5000, uint8_t);
+       memcpy(getDeRegReq->khATok->data, khA, strlen(khA));
+       getDeRegReq->khATok->len = strlen(khA);
+
+       Buffer *getDeRegReqInfoBuff = NULL;
+       TlvEncodable<DeregReq> encodableDeRegReq(getDeRegReq);
+
+       int ret = encodableDeRegReq.setEncoder(EID_UAFV1_DEREG_REQ);
+       if (ret == 0) {
+               printf("setEncoder EID_UAFV1_DEREG_REQ PASS \n");
+       }
+       else {
+               printf("setEncoder EID_UAFV1_DEREG_REQ FAIL \n");
+               goto ERR;
+       }
+
+       /*2) Create TLV encoded buffer*/
+       getDeRegReqInfoBuff = encodableDeRegReq.encode();
+       if (getDeRegReqInfoBuff != NULL) {
+               printf("encode EID_UAFV1_DEREG_REQ PASS \n");
+               print_hex(getDeRegReqInfoBuff);
+       }
+       else {
+               printf("encode EID_UAFV1_DEREG_REQ FAIL \n");
+               goto ERR;
+       }
+
+       //================================DECODE==================================//
+
+       getDeRegReqInfo = encodableDeRegReq.decode(getDeRegReqInfoBuff->data);
+       if (getDeRegReqInfo != NULL) {
+               printf("decode EID_UAFV1_DEREG_REQ PASS \n");
+       }
+       else {
+               printf("decode EID_UAFV1_DEREG_REQ FAIL \n");
+               goto ERR;
+       }
+       //================================DECODE==================================//
+
+       //================================COMPARE==================================//
+
+       if (getDeRegReq->authIdx == getDeRegReqInfo->authIdx) {
+               printf("authIdx EID_UAFV1_DEREG_REQ PASS \n");
+       }
+       else {
+               printf("authIdx EID_UAFV1_DEREG_REQ FAIL \n");
+               goto ERR;
+       }
+
+       if (strcmp(getDeRegReq->appId, getDeRegReqInfo->appId) == 0) {
+               printf("appId EID_UAFV1_DEREG_REQ PASS \n");
+       }
+       else {
+               printf("appId EID_UAFV1_DEREG_REQ FAIL \n");
+               goto ERR;
+       }
+
+       if (strcmp(getDeRegReq->keyId, getDeRegReqInfo->keyId) == 0) {
+               printf("keyId EID_UAFV1_DEREG_REQ PASS \n");
+       }
+       else {
+               printf("keyId EID_UAFV1_DEREG_REQ FAIL \n");
+               goto ERR;
+       }
+
+       if (memcmp(getDeRegReq->khATok->data, getDeRegReqInfo->khATok->data, getDeRegReqInfo->khATok->len) == 0) {
+               printf("khATok EID_UAFV1_DEREG_REQ PASS \n");
+       }
+       else {
+               printf("khATok EID_UAFV1_DEREG_REQ FAIL \n");
+               goto ERR;
+       }
+       //================================COMPARE==================================//
+
+ERR:
+       printf("==============testTLV DEREGISTER REQUEST  end============== \n");
+       get_user_choice();
+
+}
+
+void
+testTLV_DeRegResp(void)
+{
+       printf("==============testTLV DEREGISTER RESPONSE start============== \n");
+
+       DeregResp *getDeRegRespInfo = NULL;
+       DeregResp *getDeRegResp = ALLOC(DeregResp);
+
+       getDeRegResp->statusCode = 0x0004;
+
+       Buffer *getDeRegRespInfoBuff = NULL;
+       TlvEncodable<DeregResp> encodableDeRegResp(getDeRegResp);
+
+       int ret = encodableDeRegResp.setEncoder(EID_UAFV1_DEREG_RESP);
+       if (ret == 0) {
+               printf("setEncoder EID_UAFV1_DEREG_RESP PASS \n");
+       }
+       else {
+               printf("setEncoder EID_UAFV1_DEREG_RESP FAIL \n");
+               goto ERR;
+       }
+
+       /*2) Create TLV encoded buffer*/
+       getDeRegRespInfoBuff = encodableDeRegResp.encode();
+       if (getDeRegRespInfoBuff != NULL) {
+               printf("encode EID_UAFV1_DEREG_RESP PASS \n");
+               print_hex(getDeRegRespInfoBuff);
+       }
+       else {
+               printf("encode EID_UAFV1_DEREG_REQ FAIL \n");
+               goto ERR;
+       }
+
+       //===================================DECODE=====================================//
+
+       getDeRegRespInfo = encodableDeRegResp.decode(getDeRegRespInfoBuff->data);
+       if (getDeRegRespInfo != NULL) {
+               printf("decode EID_UAFV1_DEREG_RESP PASS \n");
+       }
+       else {
+               printf("decode EID_UAFV1_DEREG_REQ FAIL \n");
+               goto ERR;
+       }
+
+       //===================================DECODE=====================================//
+
+       //===================================COMPARE=====================================//
+
+       if (getDeRegRespInfo->statusCode == getDeRegResp->statusCode) {
+               printf("statusCode EID_UAFV1_DEREG_RESP PASS \n");
+       }
+       else {
+               printf("statusCode EID_UAFV1_DEREG_REQ FAIL \n");
+               goto ERR;
+       }
+       //===================================COMPARE=====================================//
+
+ERR:
+       printf("==============testTLV DEREGISTER RESPONSE end============== \n");
+       get_user_choice();
+}
+
+void
+testAuthnrManager(void)
+{
+       AuthenrManager* mgr = AuthenrManager::getInstance();
+       if (mgr == NULL) {
+               printf("AuthenrManager::getInstance FAILED\n");
+               return;
+       }
+
+       printf("AuthenrManager::getInstance PASS\n");
+
+       std::vector<AuthenrStub*>* authList = mgr->getAllAuthenticators();
+       if (authList == NULL) {
+               printf("AuthenrManager::getAllAuthenticators FAILED\n");
+               return;
+       }
+
+       std::vector<AuthenrStub*>::iterator it;
+       for (it = authList->begin(); it < authList->end(); it++) {
+               AuthenrStub *authStub = *it;
+               if (authStub == NULL) {
+                       printf("authStub FAILED\n");
+               }
+               else {
+                       int ret = authStub->connect();
+                       if (ret != 0) {
+                               printf("AuthenrStub::connect FAILED\n");
+                       }
+                       else {
+                               printf("AuthenrStub::connect PASS\n");
+                       }
+               }
+       }
+
+       get_user_choice();
+}
+
+void
+testAuthDb(AsmStorage* obj)
+{
+       printf("Enter Auth Test Function \n");
+       //SEARCH DATA
+       IStorageParcel *parcel = new AuthStorageParcel();
+
+       parcel->setInt(INT_PROP_AUTH_ID, -1);
+       parcel->setString(STR_PROP_AUTH_NAME, "face_recog");
+
+       std::vector<IStorageParcel*> *searchData = obj->searchData(parcel);
+       unsigned int records_no = searchData->size();
+       printf("No of records found : %d\n", records_no);
+
+       //DELETE DATA
+       int ret = obj->deleteData(parcel);
+       if(ret == 0) {
+               printf("Records successfully deleted\n");
+       }
+       else if(ret == 1) {
+               printf("Records not deleted/ does not exists\n");
+       }
+}
+
+void searchByKeyId(AsmStorage* obj, const char *keyId)
+{
+       IStorageParcel *parcel = new AsmStorageParcel();
+
+       parcel->setInt(INT_PROP_ID, -1);
+       parcel->setInt(INT_PROP_AUTH_IDX, -1);
+
+       parcel->setString(STR_PROP_CALLER_ID, "");
+       parcel->setString(STR_PROP_APP_ID, "");
+       parcel->setString(STR_PROP_KEY_HANDLE, "");
+       parcel->setString(STR_PROP_KEY_ID, keyId);
+
+       std::vector<IStorageParcel*> *searchData = obj->searchData(parcel);
+       unsigned int records_no = searchData->size();
+       printf("No of records found : %d\n", records_no);
+}
+
+void
+searchByKeyHandle(AsmStorage* obj, const char *keyHandle)
+{
+       IStorageParcel *parcel = new AsmStorageParcel();
+
+       parcel->setInt(INT_PROP_ID, -1);
+       parcel->setInt(INT_PROP_AUTH_IDX, -1);
+
+       parcel->setString(STR_PROP_CALLER_ID, "");
+       parcel->setString(STR_PROP_APP_ID, "");
+       parcel->setString(STR_PROP_KEY_HANDLE, keyHandle);
+       parcel->setString(STR_PROP_KEY_ID, "");
+
+       std::vector<IStorageParcel*> *searchData = obj->searchData(parcel);
+       unsigned int records_no = searchData->size();
+       printf("No of records found : %d\n", records_no);
+}
+
+void deleteByKeyId(AsmStorage* obj, const char *keyId)
+{
+       IStorageParcel *parcel = new AsmStorageParcel();
+
+       parcel->setInt(INT_PROP_ID, -1);
+       parcel->setInt(INT_PROP_AUTH_IDX, -1);
+
+       parcel->setString(STR_PROP_CALLER_ID, "");
+       parcel->setString(STR_PROP_APP_ID, "");
+       parcel->setString(STR_PROP_KEY_HANDLE, "");
+       parcel->setString(STR_PROP_KEY_ID, keyId);
+
+       int ret = obj->deleteData(parcel);
+       if(ret == 0) {
+               printf("Records successfully deleted\n");
+       }
+       else if(ret == 1) {
+               printf("Records not deleted/ does not exists\n");
+       }
+}
+
+void
+testAsmDb(AsmStorage* obj)
+{
+       printf("Enter Asm Test Function \n");
+       //SEARCH DATA
+       const char *keyId = NULL;
+       const char *keyHandle = NULL;
+
+       keyId = "45678";
+       searchByKeyId(obj, keyId); //positive
+       keyHandle = "fido";
+       searchByKeyHandle(obj, keyHandle); //positive
+       keyId = "09876";
+       searchByKeyId(obj, keyId); //negative
+       keyHandle = "asm";
+       searchByKeyHandle(obj, keyHandle); //negative
+
+       //DELETE DATA
+       keyId = "45678";
+       deleteByKeyId(obj, keyId);
+}
+
+void
+testDb(void)
+{
+       //INITIALIZE DATABASES
+       AsmStorage* obj = AsmStorage::getInstance();
+       if (obj == NULL) {
+               printf("AsmStorage::getInstance FAILED\n");
+               return;
+       }
+
+       printf("AsmStorage::getInstance PASS\n");
+       printf("Asm and Auth databases initialized \n");
+
+       //INSERT DATA INTO BOTH AUTH AND ASM DATABASE
+       std::vector<IStorageParcel*> bulkData;
+
+       IStorageParcel *parcel = new AsmStorageParcel();
+
+       parcel->setInt(INT_PROP_AUTH_IDX, 2);
+
+       parcel->setString(STR_PROP_CALLER_ID, "12345");
+       parcel->setString(STR_PROP_APP_ID, "98765");
+       parcel->setString(STR_PROP_KEY_HANDLE, "fido");
+       parcel->setString(STR_PROP_KEY_ID, "45678");
+
+       bulkData.push_back(parcel);
+
+
+
+       IStorageParcel *parcel1 = new AuthStorageParcel();
+
+       parcel1->setInt(INT_PROP_AUTH_ID, 1);
+
+       parcel1->setString(STR_PROP_AUTH_NAME, "face_recog");
+
+       bulkData.push_back(parcel1);
+
+       int ret = obj->insertBulkData(&bulkData);
+       if(ret == 0) {
+               printf("Records successfully inserted\n");
+       }
+       else if(ret == 1) {
+               printf("Records not inserted/ already exists\n");
+       }
+
+       //SEARCH AND DELETE TESTING FOR ASM AND AUTH DATABASE
+       testAsmDb(obj);
+       testAuthDb(obj);
+
+       get_user_choice();
+}
+
+AsmRequest*
+testJsonReqCommon(const char *json, const char *expReqType)
+{
+       AsmVersion *ver = NULL;
+
+       AsmRequest *asmReq = JsonUtil::parseAsmRequestJson(json);
+       if (asmReq == NULL) {
+               printf("JsonUtil::parseAsmRequestJson FAILED\n");
+               goto CATCH;
+       }
+
+       printf("JsonUtil::parseAsmRequestJson PASSED \n");
+
+       ver = asmReq->getAsmVersion();
+       if (ver == NULL) {
+               printf("getAsmVersion FAILED\n");
+               goto CATCH;
+       }
+
+       printf("getAsmVersion PASSED \n");
+
+       if (ver->getMajor() == 1) {
+               printf("getMajor PASSED \n");
+       }
+       else {
+               printf("getMajor FAILED \n");
+       }
+
+       if (ver->getMinor() == 0) {
+               printf("getMinor PASSED \n");
+       }
+       else {
+               printf("getMinor FAILED \n");
+       }
+
+       if (asmReq->getRequesttype() == expReqType) {
+               printf("getRequesttype PASSED \n");
+       }
+       else {
+               printf("getRequesttype FAILED \n");
+       }
+
+       return asmReq;
+
+CATCH:
+       delete asmReq;
+       return NULL;
+}
+
+void
+testJsonGetInfoReq(void)
+{
+       printf("GetInfo Request \n");
+
+       const char *getInfoJson = "{\"asmVersion\":{\"major\":1,\"minor\":0},\"requestType\":\"GetInfo\"}";
+
+       AsmRequest *asmReqGetInfo = testJsonReqCommon(getInfoJson, "GetInfo");
+
+       delete asmReqGetInfo;
+}
+
+void
+testJsonRegReq(void)
+{
+       printf("Registration Request \n");
+
+       const char *regReqJson = "{\"args\":{\"appID\":\"https://qa-egypt.noknoktest.com:443/UAFSampleProxy/uaf/facets.uaf\",\"username\":\"user1\",\"finalChallenge\":\"eyJhcHBJRCI6Imh0dHBzOi8vcWEtZWd5cHQubm9rbm9rdGVzdC5jb206NDQzL1VBRlNhbXBsZVByb3h5L3VhZi9mYWNldHMudWFmIiwiY2hhbGxlbmdlIjoidVlCdUdRZjdyLUxORDE2UTBHVXBQUmkxMTJVakN0Y3ltM2F3am0tTW1tSSIsImNoYW5uZWxCaW5kaW5nIjp7fSwiZmFjZXRJRCI6ImNvbS5ub2tub2suYW5kcm9pZC5zYW1wbGVhcHAifQ\",\"attestationType\":15879},\"asmVersion\":{\"major\":1,\"minor\":0},\"authenticatorIndex\":1,\"requestType\":\"Register\"}";
+
+       AsmRegRequest *regArg = NULL;
+
+       AsmRequest *asmReqReg = testJsonReqCommon(regReqJson, "Register");
+       if (asmReqReg == NULL) {
+               goto CATCH;
+       }
+
+       if (asmReqReg->getAuthIndex() == 1) {
+               printf("getAuthIndex PASSED \n");
+       }
+       else {
+               printf("getAuthIndex FAILED \n");
+       }
+
+       if (asmReqReg->getArgs() == NULL) {
+               printf("getArgs FAILED \n");
+               goto CATCH;
+       }
+
+       printf("getArgs PASSED \n");
+
+       regArg = static_cast<AsmRegRequest*>(asmReqReg->getArgs());
+
+       if (regArg->getAppId() == "https://qa-egypt.noknoktest.com:443/UAFSampleProxy/uaf/facets.uaf") {
+               printf("getAppId PASSED \n");
+       }
+       else {
+               printf("getAppId FAILED \n");
+       }
+
+       if (regArg->getUserName() == "user1") {
+               printf("getUserName PASSED \n");
+       }
+       else {
+               printf("getUserName FAILED \n");
+       }
+
+       if (regArg->getFinalChallenge() == "eyJhcHBJRCI6Imh0dHBzOi8vcWEtZWd5cHQubm9rbm9rdGVzdC5jb206NDQzL1VBRlNhbXBsZVByb3h5L3VhZi9mYWNldHMudWFmIiwiY2hhbGxlbmdlIjoidVlCdUdRZjdyLUxORDE2UTBHVXBQUmkxMTJVakN0Y3ltM2F3am0tTW1tSSIsImNoYW5uZWxCaW5kaW5nIjp7fSwiZmFjZXRJRCI6ImNvbS5ub2tub2suYW5kcm9pZC5zYW1wbGVhcHAifQ") {
+               printf("getFinalChallenge PASSED \n");
+       }
+       else {
+               printf("getFinalChallenge FAILED \n");
+       }
+
+       if (regArg->getAttestationType() == 15879) {
+               printf("getAttestationType PASSED \n");
+       }
+       else {
+               printf("getAttestationType FAILED \n");
+       }
+
+CATCH:
+       delete asmReqReg;
+}
+
+void
+testJsonAuthReq(void)
+{
+       printf("Authenticate Request \n");
+
+       const char *authReqJson = "{\"args\":{\"appID\":\"https://qa-egypt.noknoktest.com:443/UAFSampleProxy/uaf/facets.uaf\",\"finalChallenge\":\"eyJhcHBJRCI6Imh0dHBzOi8vcWEtZWd5cHQubm9rbm9rdGVzdC5jb206NDQzL1VBRlNhbXBsZVByb3h5L3VhZi9mYWNldHMudWFmIiwiY2hhbGxlbmdlIjoiM3otaVN2TndENFFLd01kV1NCS0hGT2hNNDN4M1dGOHI1eU9yd0pmVzljSSIsImNoYW5uZWxCaW5kaW5nIjp7fSwiZmFjZXRJRCI6ImNvbS5ub2tub2suYW5kcm9pZC5zYW1wbGVhcHAifQ\"},\"asmVersion\":{\"major\":1,\"minor\":0},\"authenticatorIndex\":1,\"requestType\":\"Authenticate\"}";
+
+       AsmAuthRequest *authArg = NULL;
+
+       AsmRequest *asmReqAuth = testJsonReqCommon(authReqJson, "Authenticate");
+       if (asmReqAuth == NULL) {
+               goto CATCH;
+       }
+
+       if (asmReqAuth->getAuthIndex() == 1) {
+               printf("getAuthIndex PASSED \n");
+       }
+       else {
+               printf("getAuthIndex FAILED \n");
+       }
+
+       if (asmReqAuth->getArgs() == NULL) {
+               printf("getArgs FAILED \n");
+               goto CATCH;
+       }
+
+       printf("getArgs PASSED \n");
+
+       authArg = static_cast<AsmAuthRequest*>(asmReqAuth->getArgs());
+
+       if (authArg->getAppId() == "https://qa-egypt.noknoktest.com:443/UAFSampleProxy/uaf/facets.uaf") {
+               printf("getAppId PASSED \n");
+       }
+       else {
+               printf("getAppId FAILED \n");
+       }
+
+       if (authArg->getFCH() == "eyJhcHBJRCI6Imh0dHBzOi8vcWEtZWd5cHQubm9rbm9rdGVzdC5jb206NDQzL1VBRlNhbXBsZVByb3h5L3VhZi9mYWNldHMudWFmIiwiY2hhbGxlbmdlIjoiM3otaVN2TndENFFLd01kV1NCS0hGT2hNNDN4M1dGOHI1eU9yd0pmVzljSSIsImNoYW5uZWxCaW5kaW5nIjp7fSwiZmFjZXRJRCI6ImNvbS5ub2tub2suYW5kcm9pZC5zYW1wbGVhcHAifQ") {
+               printf("getFCH PASSED \n");
+       }
+       else {
+               printf("getFCH FAILED \n");
+       }
+
+CATCH:
+       delete asmReqAuth;
+}
+
+void
+testJsonDeRegReq(void)
+{
+       printf("Deregister Request \n");
+
+       const char *deregReqJson = "{\"args\":{\"appID\":\"https://qa-egypt.noknoktest.com:443/UAFSampleProxy/uaf/facets.uaf\",\"keyID\":\"1eVp7JIQlwm6YF0YEmGZdNCA27qZoIcZGC0Uaw71bR8\"},\"asmVersion\":{\"major\":1,\"minor\":0},\"authenticatorIndex\":1,\"requestType\":\"Deregister\"}";
+
+       AsmDeregRequest *deregArg = NULL;
+
+       AsmRequest *asmReqDereg = testJsonReqCommon(deregReqJson, "Deregister");
+       if (asmReqDereg == NULL) {
+               goto CATCH;
+       }
+
+       if (asmReqDereg->getAuthIndex() == 1) {
+               printf("getAuthIndex PASSED \n");
+       }
+       else {
+               printf("getAuthIndex FAILED \n");
+       }
+
+       if (asmReqDereg->getArgs() == NULL) {
+               printf("getArgs FAILED \n");
+               goto CATCH;
+       }
+
+       printf("getArgs PASSED \n");
+
+       deregArg = static_cast<AsmDeregRequest*>(asmReqDereg->getArgs());
+
+       if (deregArg->getAppId() == "https://qa-egypt.noknoktest.com:443/UAFSampleProxy/uaf/facets.uaf") {
+               printf("getAppId PASSED \n");
+       }
+       else {
+               printf("getAppId FAILED \n");
+       }
+
+       if (deregArg->getKeyId() == "1eVp7JIQlwm6YF0YEmGZdNCA27qZoIcZGC0Uaw71bR8") {
+               printf("getKeyId PASSED \n");
+       }
+       else {
+               printf("getKeyId FAILED \n");
+       }
+
+CATCH:
+       delete asmReqDereg;
+}
+
+void
+testJsonGetRegsReq(void)
+{
+       printf("GetRegistrations Request \n");
+
+       const char *getRegsJson = "{\"asmVersion\":{\"major\":1,\"minor\":0},\"authenticatorIndex\":1,\"requestType\":\"GetRegistrations\"}";
+
+       AsmRequest *asmReqGetRegs = testJsonReqCommon(getRegsJson, "GetRegistrations");
+
+       delete asmReqGetRegs;
+}
+
+#define GET_INFO_RESP_NEG "{\"statusCode\":1}"
+void
+testJsonGetInfoResp(void)
+{
+       char *getInfoNegResp = JsonUtil::composeAsmGetInfoResponse(1, NULL);
+       if (strcmp(getInfoNegResp, GET_INFO_RESP_NEG) == 0)
+               printf("Negative test for composeAsmGetInfoResponse PASSED \n");
+       else
+               printf("Negative test for composeAsmGetInfoResponse FAILED \n");
+
+       /*TODO: Rest of the test cases will be added once TLV is up for all auth DS*/
+}
+
+void
+testJson(void)
+{
+       testJsonGetInfoReq();
+       testJsonRegReq();
+       testJsonAuthReq();
+       testJsonDeRegReq();
+       testJsonGetRegsReq();
+       testJsonGetInfoResp();
+
+       get_user_choice();
+}
+
+void
+testOpGetReg()
+{
+       printf("==============testOp GETREGS start============== \n");
+
+       const char *asmReqJson = "{\"asmVersion\":{\"major\":1,\"minor\":0},\"authenticatorIndex\":1,\"requestType\":\"GetRegistrations\"}";
+
+       const std::string callerId = "caller_id";
+
+       AsmRequest *req = JsonUtil::parseAsmRequestJson(asmReqJson);
+
+       req->setCallerId(callerId);
+
+       AsmOp *operation = AsmOpFactory::createOperation(req);
+
+
+       char *asmResp = operation->execute();
+
+       printf("ASM GETREGS RESPOMSE : [%s]\n\n", asmResp);
+
+       printf("==============testOp GETREGS end============== \n\n\n");
+}
+
+char *
+compose_asm_dereg_request(char *appId, char *keyId, int authIdx)
+{
+
+       JsonBuilder *builder = json_builder_new();
+
+       json_builder_begin_object(builder);
+
+       json_builder_set_member_name(builder, "args");
+               json_builder_begin_object(builder);
+
+               json_builder_set_member_name(builder, "appID");
+               json_builder_add_string_value(builder, appId);
+
+               json_builder_set_member_name(builder, "keyID");
+               json_builder_add_string_value(builder, keyId);
+
+               json_builder_end_object(builder);
+
+       json_builder_set_member_name(builder, "asmVersion");
+               json_builder_begin_object(builder);
+
+               json_builder_set_member_name(builder, "major");
+               json_builder_add_int_value(builder, 1);
+
+               json_builder_set_member_name(builder, "minor");
+               json_builder_add_int_value(builder, 0);
+
+               json_builder_end_object(builder);
+
+       json_builder_set_member_name(builder, "authenticatorIndex");
+       json_builder_add_int_value(builder, authIdx);
+
+       json_builder_set_member_name(builder, "requestType");
+       json_builder_add_string_value(builder, "Deregister");
+
+       json_builder_end_object(builder);
+
+       JsonNode *root_builder = json_builder_get_root(builder);
+
+       JsonGenerator *gen = json_generator_new();
+       json_generator_set_root(gen, root_builder);
+
+       json_node_free(root_builder);
+       g_object_unref(builder);
+
+       gsize len = 0;
+       char *json = json_generator_to_data(gen, &len);
+       if (json != NULL) {
+               printf("compose_asm_dereg_request success\n");
+
+               if (gen != NULL)
+                       g_object_unref(gen);
+
+               printf("asmDeRegReqJson = %s\n", json);
+               return json;
+       }
+
+       printf("compose_asm_dereg_request failed\n");
+       g_object_unref(gen);
+
+       return NULL;
+}
+
+int
+testOpDeReg(Buffer *keyId)
+{
+       printf("==============testOp DEREGISTER start============== \n");
+
+       char *kId = (char*)calloc(1, 5000);
+       memcpy(kId, keyId->data, keyId->len);
+
+       char *appId = (char*)calloc(1, 5000);;
+       strcpy(appId, "https://qa-egypt.noknoktest.com:443/UAFSampleProxy/uaf/facets.uaf");
+
+       const char *asmReqJson = compose_asm_dereg_request(appId, kId, 1);
+
+       if(asmReqJson != NULL) {
+               const std::string callerId = "caller_id";
+
+               AsmRequest *req = JsonUtil::parseAsmRequestJson(asmReqJson);
+
+               req->setCallerId(callerId);
+
+               AsmOp *operation = AsmOpFactory::createOperation(req);
+
+
+               char *asmResp = operation->execute();
+
+               printf("\n\nASM DEREGISTER RESPONSE : [%s]\n\n", asmResp);
+       }
+       else {
+               printf("ERROR : ASM DEREGISTER REQ JSON IS NULL");
+               return 1;
+       }
+
+       printf("==============testOp DEREGISTER end============== \n\n\n");
+       return 0;
+}
+
+char *
+compose_asm_auth_req_json(char *appId, char *keyId, char *fc, int authIdx)
+{
+       JsonBuilder *builder = json_builder_new();
+
+       json_builder_begin_object(builder);
+
+       json_builder_set_member_name(builder, "args");
+               json_builder_begin_object(builder);
+
+               json_builder_set_member_name(builder, "appID");
+               json_builder_add_string_value(builder, appId);
+
+               json_builder_set_member_name(builder, "keyIDs");
+               json_builder_begin_array(builder);
+               json_builder_add_string_value(builder, keyId);
+               json_builder_end_array(builder);
+
+               json_builder_set_member_name(builder, "finalChallenge");
+               json_builder_add_string_value(builder, fc);
+
+               json_builder_end_object(builder);
+
+       json_builder_set_member_name(builder, "asmVersion");
+               json_builder_begin_object(builder);
+
+               json_builder_set_member_name(builder, "major");
+               json_builder_add_int_value(builder, 1);
+
+               json_builder_set_member_name(builder, "minor");
+               json_builder_add_int_value(builder, 0);
+
+               json_builder_end_object(builder);
+
+       json_builder_set_member_name(builder, "authenticatorIndex");
+       json_builder_add_int_value(builder, authIdx);
+
+       json_builder_set_member_name(builder, "requestType");
+       json_builder_add_string_value(builder, "Authenticate");
+
+       json_builder_end_object(builder);
+
+       JsonNode *root_builder = json_builder_get_root(builder);
+
+       JsonGenerator *gen = json_generator_new();
+       json_generator_set_root(gen, root_builder);
+
+       json_node_free(root_builder);
+       g_object_unref(builder);
+
+       gsize len = 0;
+       char *json = json_generator_to_data(gen, &len);
+       if (json != NULL) {
+               printf("compose_asm_auth_req_json success\n");
+
+               if (gen != NULL)
+                       g_object_unref(gen);
+
+               printf("asmAuthReqJson = %s\n", json);
+               return json;
+       }
+
+       printf("compose_asm_auth_req_json failed\n");
+       g_object_unref(gen);
+
+       return NULL;
+}
+
+int
+testOpAuth(Buffer *keyId)
+{
+       printf("==============testOp AUTHENTICATE start============== \n");
+
+       char *kId = (char*)calloc(1, 5000);
+       memcpy(kId, keyId->data, keyId->len);
+
+       char *appId = (char*)calloc(1, 5000);;
+       strcpy(appId, "https://qa-egypt.noknoktest.com:443/UAFSampleProxy/uaf/facets.uaf");
+
+       char *fc = (char*)calloc(1, 5000);
+       strcpy(fc,"eyJhcHBJRCI6Imh0dHBzOi8vcWEtZWd5cHQubm9rbm9rdGVzdC5jb206NDQzL1VBRlNhbXBsZVByb3h5L3VhZi9mYWNldHMudWFmIiwiY2hhbGxlbmdlIjoiM3otaVN2TndENFFLd01kV1NCS0hGT2hNNDN4M1dGOHI1eU9yd0pmVzljSSIsImNoYW5uZWxCaW5kaW5nIjp7fSwiZmFjZXRJRCI6ImNvbS5ub2tub2suYW5kcm9pZC5zYW1wbGVhcHAifQ");
+
+       const char *asmReqJson = compose_asm_auth_req_json(appId, kId, fc, 1);
+
+       if(asmReqJson != NULL) {
+               const std::string callerId = "caller_id";
+
+               AsmRequest *req = JsonUtil::parseAsmRequestJson(asmReqJson);
+
+               req->setCallerId(callerId);
+
+               AsmOp *operation = AsmOpFactory::createOperation(req);
+
+
+               char *asmResp = operation->execute();
+
+               printf("\n\nASM AUTHENTICATE RESPONSE : [%s]\n\n", asmResp);
+       }
+       else {
+               printf("ERROR : ASM AUTH REQ JSON IS NULL");
+               return 1;
+       }
+
+       printf("==============testOp AUTHENTICATE end============== \n\n\n");
+       return 0;
+}
+
+static int
+__parse_asm_reg_response_json(const unsigned char *asmRegResp, char **regAssrtn)
+{
+       printf("Asm Register Response len=[%d] \n", strlen((char*)asmRegResp));
+
+       /*TODO*/
+       JsonParser *parser  = json_parser_new();
+
+       GError *err = NULL;
+       json_parser_load_from_data(parser, (char*)asmRegResp, -1, &err);
+       if (err != NULL)
+       {
+               _ERR("Parsing failed=[%s]", err->message);
+               return -1;
+       }
+
+       JsonNode *root = json_parser_get_root(parser);
+
+       JsonObject *root_obj = json_node_get_object(root);
+       JsonObject *resDataObj = NULL;
+
+       resDataObj = json_object_get_object_member(root_obj, "responseData");
+
+       if(resDataObj != NULL)
+       {
+               const char *regAssrtn_temp = json_object_get_string_member(resDataObj, "assertion");
+
+               if (regAssrtn_temp != NULL)
+               {
+                       *regAssrtn = strdup(regAssrtn_temp);
+               }
+       }
+
+       if (parser != NULL)
+               g_object_unref(parser);
+
+       return 0;
+}
+
+Buffer*
+testOpReg()
+{
+       printf("==============testOp REGISTER start============== \n");
+
+       const char *asmReqJson = "{\"args\":{\"appID\":\"https://qa-egypt.noknoktest.com:443/UAFSampleProxy/uaf/facets.uaf\",\"username\":\"user1\",\"finalChallenge\":\"eyJhcHBJRCI6Imh0dHBzOi8vcWEtZWd5cHQubm9rbm9rdGVzdC5jb206NDQzL1VBRlNhbXBsZVByb3h5L3VhZi9mYWNldHMudWFmIiwiY2hhbGxlbmdlIjoidVlCdUdRZjdyLUxORDE2UTBHVXBQUmkxMTJVakN0Y3ltM2F3am0tTW1tSSIsImNoYW5uZWxCaW5kaW5nIjp7fSwiZmFjZXRJRCI6ImNvbS5ub2tub2suYW5kcm9pZC5zYW1wbGVhcHAifQ\",\"attestationType\":15879},\"asmVersion\":{\"major\":1,\"minor\":0},\"authenticatorIndex\":1,\"requestType\":\"Register\"}";
+
+       const std::string callerId = "caller_id";
+
+       AsmRequest *req = JsonUtil::parseAsmRequestJson(asmReqJson);
+
+       req->setCallerId(callerId);
+
+       AsmOp *operation = AsmOpFactory::createOperation(req);
+
+
+       char *asmResp = operation->execute();
+       printf("\n\nASM REGISTER RESPONSE : [%s]\n\n", asmResp);
+
+       char *regAssrtn = NULL;
+       __parse_asm_reg_response_json((unsigned char*)asmResp, &regAssrtn);
+
+       printf("\n\nASM REGISTER ASSERTION : [%s]\n\n", regAssrtn);
+
+       int inputSz = strlen(regAssrtn);
+       unsigned char* regAssrtn_b64_dec = NULL;
+
+       regAssrtn_b64_dec = (unsigned char*)calloc(1, inputSz*1.5);
+       int outputSz = 0;
+
+       if (0 != AsmCrypto::genB64Decodes((unsigned char*)regAssrtn,
+                                                                               inputSz,
+                                                                               regAssrtn_b64_dec,
+                                                                               &outputSz))
+       {
+               printf("Failed to decode base64.\n");
+               free(regAssrtn_b64_dec);
+               printf("==============testOp REGISTER end============== \n\n\n");
+               return NULL;
+       }
+
+       Buffer *testBuff = ALLOC(Buffer);
+       testBuff->data = NALLOC(5000, uint8_t);
+       memcpy(testBuff->data, regAssrtn_b64_dec, outputSz);
+       testBuff->len = outputSz;
+       printf("b64 Decoded Register Assertion : \n");
+       print_hex(testBuff);
+
+       RegAssertion *getRegAssrtnInfo = NULL;
+       TlvEncodable<RegAssertion> encodableRegAssrtn;
+
+       int ret = encodableRegAssrtn.setEncoder(EID_UAFV1_REG_ASSERTION_RESP);
+       if (ret == 0) {
+               printf("setEncoder EID_UAFV1_REG_ASSERTION_RESP PASS \n");
+       }
+       else {
+               printf("setEncoder EID_UAFV1_REG_ASSERTION_RESP FAIL \n");
+               return NULL;
+       }
+
+       getRegAssrtnInfo = encodableRegAssrtn.decode(testBuff->data);
+       if (getRegAssrtnInfo != NULL) {
+               printf("decode EID_UAFV1_REG_ASSERTION_RESP PASS \n");
+       }
+       else {
+               printf("decode EID_UAFV1_REG_ASSERTION_RESP FAIL \n");
+               return NULL;
+       }
+
+       printf("KEY ID obtained is [%s] \n", getRegAssrtnInfo->krd->keyId->data);
+       printf("KEY ID(hex) obtained is : \n");
+       print_hex(getRegAssrtnInfo->krd->keyId);
+
+       printf("==============testOp REGISTER end============== \n\n\n");
+       return getRegAssrtnInfo->krd->keyId;
+}
+
+void
+
+testOpGetInfo(void)
+{
+       printf("==============testOp GETINFO start============== \n");
+
+       const char *asmReqJson = "{\"asmVersion\":{\"major\":1,\"minor\":0},\"requestType\":\"GetInfo\"}";
+
+       const std::string callerId = "caller_id";
+
+       AsmRequest *req = JsonUtil::parseAsmRequestJson(asmReqJson);
+
+       req->setCallerId(callerId);
+
+       AsmOp *operation = AsmOpFactory::createOperation(req);
+
+
+       char *asmResp = operation->execute();
+
+       printf("ASM GETINFO RESPOMSE : [%s]\n\n", asmResp);
+
+       printf("==============testOp GETINFO end============== \n\n\n");
+
+}
+
+void
+testSilentAuth(void)
+{
+       int ret = 0;
+
+       testOpGetInfo();
+
+       Buffer *keyId = NULL;
+       keyId = testOpReg();
+
+       if(keyId != NULL) {
+               ret = testOpAuth(keyId);
+       }
+       else {
+               printf("Key Id obtaibed from Registeration process is NULL\n");
+       }
+
+       if(ret == 0) {
+               printf("User Authenticated :: SUCCESS\n");
+               testOpDeReg(keyId);
+       }
+       else {
+               printf("User Authenticated :: FAIL\n");
+       }
+
+       get_user_choice();
+}
+
+void
+testSilentAuthGetRegs(void)
+{
+       testOpGetReg();
+       get_user_choice();
+}
+
+void
+get_user_choice(void)
+{
+       int sel_opt = 0;
+       const int options[13] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
+       const char *names[13] = {       "AuthenticatorManager Test",
+                                                               "TLV Test - GETINFO",
+                                                               "TLV Test - REGISTER_REQ",
+                                                               "TLV Test - REGISTER_RESP",
+                                                               "TLV Test - SIGN_REQ",
+                                                               "TLV Test - SIGN_RESP",
+                                                               "TLV Test - DEREG_REQ",
+                                                               "TLV Test - DEREG_RESP",
+                                                               "Database Testing",
+                                                               "JSON Test",
+                                                               "Silent Auth Test(GetInfo, Register, Authenticate)",
+                                                               "Silent Auth GetRegistrations",
+                                                               "Exit"};
+
+       sel_opt = show_menu("Select action:", options, names, 13);
+       switch (sel_opt) {
+       case 1:
+               testAuthnrManager();
+               break;
+       case 2:
+               testTLV_getInfo();
+               break;
+       case 3:
+               testTLV_RegisterReq();
+               break;
+       case 4:
+               testTLV_RegisterResp();
+               break;
+       case 5:
+               testTLV_SignReq();
+               break;
+       case 6:
+               testTLV_SignResp();
+               break;
+       case 7:
+               testTLV_DeRegReq();
+               break;
+       case 8:
+               testTLV_DeRegResp();
+               break;
+       case 9:
+               testDb();
+               break;
+       case 10:
+               testJson();
+       case 11:
+               testSilentAuth();
+       case 12:
+               testSilentAuthGetRegs();
+       default:
+               exit(1);
+       }
+}
+
+int
+main(void)
+{
+       GMainLoop *mainloop = NULL;
+
+       mainloop = g_main_loop_new(NULL, FALSE);
+
+       get_user_choice();
+
+       g_main_loop_run(mainloop);
+
+       return 0;
+}
diff --git a/test/shell_tc/fido_asm_shell_tc_util.cpp b/test/shell_tc/fido_asm_shell_tc_util.cpp
new file mode 100644 (file)
index 0000000..803cde9
--- /dev/null
@@ -0,0 +1,110 @@
+/**
+ * Copyright (c) 2015 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 "fido_asm_shell_tc_util.h"
+
+#include <string.h>
+#include <stdio.h>
+
+bool 
+show_confirm_dialog(const char *title)
+{
+       const int options[2] = {1, 2};
+       const char *names[2] = { "No", "Yes" };
+
+       bool answer = false;
+
+       int sel = -1;
+       while (sel == -1) {
+               sel = show_menu(title, options, names, 2);
+               switch (sel) {
+               case 1:
+                       answer = false;
+                       break;
+               case 2:
+                       answer = true;
+                       break;
+               default:
+                       sel = -1;
+                       printf("ERROR: Incorrect input.\n");
+                       continue;
+               }
+       }
+
+       return answer;
+}
+
+int 
+show_menu(
+               const char *title,
+               const int *options,
+               const char **names,
+               int number_of_option)
+{
+       if (NULL == title || NULL == options || NULL == names || 0 >= number_of_option)
+               return -1;
+
+       int number_size = 1;
+
+       int tn_counter = number_of_option;
+       while (tn_counter /= 10)
+               ++number_size;
+
+       int max_len = strlen(title) - number_size - 2;
+
+       int i = 0;
+       for (i = 0; i < number_of_option; ++i) {
+               const int temp_len = strlen(names[i]);
+               if (max_len < temp_len)
+                       max_len = temp_len;
+       }
+
+       const int full_size = number_size + 2 + max_len;
+
+       printf("\n**");
+       for (i = 0; i < full_size; ++i)
+               printf("*");
+       printf("**\n");
+
+       printf("* %-*s *\n", full_size, title);
+
+       printf("*-");
+       for (i = 0; i < full_size; ++i)
+               printf("-");
+       printf("-*\n");
+
+       for (i = 0; i < number_of_option; ++i)
+               printf("* %0*i. %-*s *\n", number_size, options[i], max_len, names[i]);
+
+       printf("**");
+       for (i = 0; i < full_size; ++i)
+               printf("*");
+       printf("**\n\n");
+
+       int selection = 0;
+       printf("Your choice: ");
+       if (scanf("%25i", &selection) == 0) {
+               if (scanf("%*[^\n]%*c") != 0)
+                       printf("ERROR: Reading the input line error.\n");
+
+               printf("ERROR: Incorrect input.\n");
+               return -1;
+       }
+       scanf("%*[^\n]%*c");
+
+       return selection;
+}
+
diff --git a/test/shell_tc/fido_asm_shell_tc_util.h b/test/shell_tc/fido_asm_shell_tc_util.h
new file mode 100644 (file)
index 0000000..d289cf7
--- /dev/null
@@ -0,0 +1,38 @@
+
+#ifndef __FIDO_SHELL_TC_UTIL_H_
+#define __FIDO_SHELL_TC_UTIL_H_
+
+#include <stddef.h>
+#include <tizen.h>
+
+/**
+ * @brief Shows confirm dialog in console and gets answer (Yes/No).
+ *
+ * @since_tizen 3.0
+ * @param [in] title    The title for confirm dialog which will be printed
+ *                      before input of the answer
+ * @return false if answer is "No" and true if answer is "Yes"
+ */
+bool show_confirm_dialog(const char *title);
+
+/**
+ * @brief Shows menu in console and allows to get item from the array of options.
+ *
+ * @since_tizen 3.0
+ * @param [in] title               The title for show menu which will be printed
+ *                                 before options
+ * @param [in] options             The array with integer numbers of options
+ *                                 which will be shown
+ * @param [in] names               The array with names of options which will
+ *                                 be shown
+ * @param [in] number_of_option    The number of options which will be shown
+ * @return The selected item positive number from options array on success,
+ *         otherwise a negative error value
+ */
+int show_menu(
+        const char *title,
+        const int *options,
+        const char **names,
+        int number_of_option);
+
+#endif /* __FIDO_SHELL_TC_UTIL_H_ */
diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b4870d6
--- /dev/null
@@ -0,0 +1,61 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(ASM_UI asmui)
+
+SET(SRCS
+    ${CMAKE_SOURCE_DIR}/ui/src/asm_ui.c
+    ${CMAKE_SOURCE_DIR}/ui/src/asm_ui_ipc.c
+)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+INCLUDE_DIRECTORIES(
+    ${CMAKE_SOURCE_DIR}
+    ${CMAKE_SOURCE_DIR}/ui/
+    ${CMAKE_SOURCE_DIR}/common/
+    ${CMAKE_SOURCE_DIR}/common/uiutil/inc
+)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED
+       capi-appfw-application
+       bundle
+       dlog
+       ecore
+        pkgmgr-info
+       ecore-input
+       ecore-imf
+       edje
+       elementary
+       evas
+       gobject-2.0
+       gio-2.0
+       gio-unix-2.0
+       gmodule-2.0
+       aul
+       vconf
+       efl-extension
+        openssl
+)
+
+FOREACH(flag ${pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -Wall -g")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g ")
+SET(CMAKE_C_FLAGS_RELEASE "-O2")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
+
+ADD_EXECUTABLE(${ASM_UI} ${SRCS})
+TARGET_LINK_LIBRARIES(${ASM_UI} ${pkgs_LDFLAGS} fido-asm-dbus)
+
+INSTALL(TARGETS ${ASM_UI} DESTINATION /usr/apps/org.tizen.asmui/bin)
+
+# install desktop file & icon
+##SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/org.tizen.asmui.xml DESTINATION /usr/share/packages/)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/org.tizen.asmui.png DESTINATION /usr/share/icons/default/small)
diff --git a/ui/data/org.tizen.asmui.png b/ui/data/org.tizen.asmui.png
new file mode 100644 (file)
index 0000000..9765b1b
Binary files /dev/null and b/ui/data/org.tizen.asmui.png differ
diff --git a/ui/data/org.tizen.asmui.xml b/ui/data/org.tizen.asmui.xml
new file mode 100644 (file)
index 0000000..b885409
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.asmui" version="0.0.1" install-location="internal-only" api-version="2.4" type="rpm" preload="true">
+       <label>ASMUI</label>
+       <author email="manasij.r@samsung.com" href="www.samsung.com">Manasij Sur Roy</author>
+       <description>ASM UI</description>
+       <ui-application appid="org.tizen.asmui" exec="/usr/apps/org.tizen.asmui/bin/asmui" nodisplay="true" multiple="false" type="capp" taskmanage="false">
+               <icon>org.tizen.asmui.png</icon>
+               <label>ASMUI</label>
+               <background-category value="system"/>
+       </ui-application>
+       <privileges>
+               <privilege>http://tizen.org/privilege/account.read</privilege>
+               <privilege>http://tizen.org/privilege/account.write</privilege>
+       </privileges>
+
+</manifest>
diff --git a/ui/org.tizen.asmui.png b/ui/org.tizen.asmui.png
new file mode 100644 (file)
index 0000000..9765b1b
Binary files /dev/null and b/ui/org.tizen.asmui.png differ
diff --git a/ui/org.tizen.asmui.rule b/ui/org.tizen.asmui.rule
new file mode 100644 (file)
index 0000000..8a536ba
--- /dev/null
@@ -0,0 +1,24 @@
+#default include
+org.tizen.asmui app.default include
+
+#subject
+org.tizen.asmui dbus rw
+org.tizen.asmui com.samsung.setting::system rw
+org.tizen.asmui ail::db rw
+org.tizen.asmui app-svc::db rw
+org.tizen.asmui aul::launch x
+org.tizen.asmui xorg rw
+org.tizen.asmui system::use_internet r
+org.tizen.asmui sdbd rwx
+
+org.tizen.asmui pulseaudio::record r
+org.tizen.asmui com.samsung.browser rx
+org.tizen.asmui media-data::db rw
+org.tizen.asmui tizen::vconf::platform::rw rw
+org.tizen.asmui tizen::vconf::platform::r rw
+org.tizen.asmui tizen::vconf::display rwxl
+
+#object
+vconf org.tizen.asmui rw
+com.samsung.app-tray org.tizen.asmui rx
+sdbd org.tizen.asmui rwx
diff --git a/ui/org.tizen.asmui.xml b/ui/org.tizen.asmui.xml
new file mode 100644 (file)
index 0000000..b885409
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.asmui" version="0.0.1" install-location="internal-only" api-version="2.4" type="rpm" preload="true">
+       <label>ASMUI</label>
+       <author email="manasij.r@samsung.com" href="www.samsung.com">Manasij Sur Roy</author>
+       <description>ASM UI</description>
+       <ui-application appid="org.tizen.asmui" exec="/usr/apps/org.tizen.asmui/bin/asmui" nodisplay="true" multiple="false" type="capp" taskmanage="false">
+               <icon>org.tizen.asmui.png</icon>
+               <label>ASMUI</label>
+               <background-category value="system"/>
+       </ui-application>
+       <privileges>
+               <privilege>http://tizen.org/privilege/account.read</privilege>
+               <privilege>http://tizen.org/privilege/account.write</privilege>
+       </privileges>
+
+</manifest>
diff --git a/ui/src/asm_ui.c b/ui/src/asm_ui.c
new file mode 100644 (file)
index 0000000..77eebd3
--- /dev/null
@@ -0,0 +1,761 @@
+/*
+ * Copyright (c) 2014 - 2015 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 <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <signal.h>
+#include <glib.h>
+#if !GLIB_CHECK_VERSION(2, 31, 0)
+#include <glib/gmacros.h>
+#endif
+
+#include <openssl/sha.h>
+#include <openssl/evp.h>
+#include <openssl/rsa.h>
+#include <openssl/pem.h>
+#include <openssl/bio.h>
+#include <openssl/err.h>
+#include <openssl/rand.h>
+#include <openssl/bio.h>
+#include <openssl/aes.h>
+
+#include <app.h>
+#include <Elementary.h>
+#include <efl_extension.h>
+#include <dlog.h>
+#include <string.h>
+
+#include "asm_ui_ipc.h"
+#include "AsmUiCommonTypes.h"
+#include "AsmHelper.h"
+
+#define DIGEST_LEN 32
+
+typedef struct appdata {
+       /*UI*/
+       Evas_Object *win;
+       Evas_Object *conform;
+       Evas_Object *nf;
+       Evas_Object *genlist;
+       Evas_Object *label;
+       Evas_Object *layout;
+       Evas_Object *entry;
+
+       /*Data coming from fido-asm*/
+       char *mode;
+       char *nonce;
+       char *app_id_in;
+       char *text_in;
+       char **text_list_in;
+       int text_list_in_len;
+       char *token_in;
+} appdata_s;
+static appdata_s *__ad = NULL;
+
+static void
+allow_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       asm_ui_ipc_send_tc_result(__ad->nonce, TC_UI_RESULT_USER_ALLOWED);
+}
+
+static void
+deny_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       asm_ui_ipc_send_tc_result(__ad->nonce, TC_UI_RESULT_USER_DENIED);
+}
+
+static Eina_Bool
+naviframe_pop_cb_tc(void *data, Elm_Object_Item *it)
+{
+       asm_ui_ipc_send_tc_result(__ad->nonce, TC_UI_RESULT_USER_DENIED);
+       return EINA_FALSE;
+}
+
+Evas_Object *
+ui_utils_toolbar_add_tc(Evas_Object *parent)
+{
+       Evas_Object *toolbar = elm_toolbar_add(parent);
+
+       evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_show(toolbar);
+
+       elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_NONE);
+       elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND);
+       elm_toolbar_transverse_expanded_set(toolbar, EINA_TRUE);
+
+       return toolbar;
+}
+
+static void
+create_list_view_tc(void)
+{
+       Evas_Object *list;
+       Evas_Object *btn;
+       Evas_Object *nf = __ad->nf;
+       Elm_Object_Item *nf_it;
+
+       char content[1024] = {0, };
+       snprintf(content, 1023, "%s", __ad->text_in);
+
+       char title[128] = {0, };
+       snprintf(title, 127, "%s Requested", __ad->app_id_in);
+
+       /* List */
+       list = elm_list_add(nf);
+       elm_list_mode_set(list, ELM_LIST_COMPRESS);
+       //evas_object_smart_callback_add(list, "selected", list_selected_cb, NULL);
+
+       /* Main Menu Items Here */
+       elm_list_item_append(list, content, NULL, NULL, NULL, NULL);
+
+       elm_list_go(list);
+
+       /* This button is set for devices which doesn't have H/W back key. */
+       btn = elm_button_add(nf);
+       elm_object_style_set(btn, "naviframe/end_btn/default");
+       nf_it = elm_naviframe_item_push(nf, title, btn, NULL, list, NULL);
+       elm_naviframe_item_pop_cb_set(nf_it, naviframe_pop_cb_tc, __ad->win);
+
+       /*Toolbar*/
+       Evas_Object *toolbar = ui_utils_toolbar_add_tc(__ad->nf);
+       if(toolbar) {
+               evas_object_show(toolbar);
+
+               elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_NONE);
+
+               elm_toolbar_item_append(toolbar, NULL, "Allow", allow_clicked, NULL);
+               elm_toolbar_item_append(toolbar, NULL, "Deny", deny_clicked, NULL);
+
+               elm_object_item_part_content_set(nf_it, "toolbar", toolbar);
+
+               //evas_object_color_set(bg, 200, 170, 100, 255);
+                evas_object_show(toolbar);
+       }
+}
+
+static void
+create_base_gui_tc(void)
+{
+       elm_app_base_scale_set(1.8);
+
+       /* Window */
+       __ad->win = elm_win_util_standard_add("org.tizen.asmui", "org.tizen.asmui");
+       elm_win_conformant_set(__ad->win, EINA_TRUE);
+       elm_win_autodel_set(__ad->win, EINA_TRUE);
+
+       if (elm_win_wm_rotation_supported_get(__ad->win)) {
+               int rots[4] = { 0, 90, 180, 270 };
+               elm_win_wm_rotation_available_rotations_set(__ad->win, (const int *)(&rots), 4);
+       }
+
+       evas_object_smart_callback_add(__ad->win, "delete,request", deny_clicked, NULL);
+       eext_object_event_callback_add(__ad->win, EEXT_CALLBACK_BACK, deny_clicked, NULL);
+
+       /* Conformant */
+       __ad->conform = elm_conformant_add(__ad->win);
+       evas_object_size_hint_weight_set(__ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(__ad->win, __ad->conform);
+       evas_object_show(__ad->conform);
+
+       /* Base Layout */
+       __ad->layout = elm_layout_add(__ad->conform);
+       evas_object_size_hint_weight_set(__ad->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_layout_theme_set(__ad->layout, "layout", "application", "default");
+       evas_object_show(__ad->layout);
+
+       elm_object_content_set(__ad->conform, __ad->layout);
+
+       /* Naviframe */
+       __ad->nf = elm_naviframe_add(__ad->layout);
+
+       create_list_view_tc();
+
+       elm_object_part_content_set(__ad->layout, "elm.swallow.content", __ad->nf);
+       eext_object_event_callback_add(__ad->nf, EEXT_CALLBACK_BACK, deny_clicked, NULL);
+       eext_object_event_callback_add(__ad->nf, EEXT_CALLBACK_MORE, deny_clicked, NULL);
+
+       /* Show window after base gui is set up */
+       evas_object_show(__ad->win);
+}
+
+
+void
+show_tc_ui(void)
+{
+       create_base_gui_tc();
+       return;
+}
+
+static void
+account_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       asm_ui_ipc_send_account_result(__ad->nonce, AC_UI_RESULT_USER_SELCTED, data);
+}
+
+static void
+cancel_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       char *dummy = "dummy";
+       asm_ui_ipc_send_account_result(__ad->nonce, AC_UI_RESULT_USER_DENIED, dummy);
+}
+
+static Eina_Bool
+naviframe_pop_cb_account(void *data, Elm_Object_Item *it)
+{
+       char *dummy = "dummy";
+       asm_ui_ipc_send_account_result(__ad->nonce, AC_UI_RESULT_USER_DENIED, dummy);
+
+       return EINA_FALSE;
+}
+
+Evas_Object *
+ui_utils_toolbar_add_account(Evas_Object *parent)
+{
+       Evas_Object *toolbar = elm_toolbar_add(parent);
+
+       evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_show(toolbar);
+
+       elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_NONE);
+       elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND);
+       elm_toolbar_transverse_expanded_set(toolbar, EINA_TRUE);
+
+       return toolbar;
+}
+
+static void
+list_selected_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       dlog_print(DLOG_INFO, "org.tizen.asmui", "fido asm ui list_selected_cb");
+
+       Elm_Object_Item *it = event_info;
+       elm_list_item_selected_set(it, EINA_FALSE);
+}
+
+static void
+create_list_view_account(void)
+{
+       Evas_Object *list;
+       Evas_Object *btn;
+       Evas_Object *nf = __ad->nf;
+       Elm_Object_Item *nf_it;
+
+       char title[128] = {0, };
+       snprintf(title, 127, "Select Account for %s", __ad->app_id_in);
+
+       /* List */
+       list = elm_list_add(nf);
+       elm_list_mode_set(list, ELM_LIST_COMPRESS);
+       evas_object_smart_callback_add(list, "selected", list_selected_cb, NULL);
+
+       dlog_print(DLOG_INFO, "org.tizen.asmui", "fido asm ui account count %d", __ad->text_list_in_len);
+       int i = 0;
+       for (i = 0; i < __ad->text_list_in_len; i++) {
+               dlog_print(DLOG_INFO, "org.tizen.asmui", "fido asm ui account %s", __ad->text_list_in[i]);
+               elm_list_item_append(list, __ad->text_list_in[i], NULL, NULL,
+                                                        account_selected_cb, strdup(__ad->text_list_in[i]));
+       }
+
+
+       elm_list_go(list);
+       Evas_Object *rect = evas_object_rectangle_add(evas_object_evas_get(__ad->layout));
+       evas_object_size_hint_min_set(rect, 100, 100);
+       evas_object_color_set(rect, 200, 170, 100, 255);
+       evas_object_show(rect);
+
+       /* This button is set for devices which doesn't have H/W back key. */
+       btn = elm_button_add(nf);
+       elm_object_style_set(btn, "naviframe/end_btn/default");
+       nf_it = elm_naviframe_item_push(nf, title, btn, NULL, list, NULL);
+       elm_naviframe_item_pop_cb_set(nf_it, naviframe_pop_cb_account, __ad->win);
+
+       /*Toolbar*/
+       Evas_Object *toolbar = ui_utils_toolbar_add_account(__ad->nf);
+       if(toolbar) {
+               evas_object_show(toolbar);
+
+               elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_NONE);
+
+               elm_toolbar_item_append(toolbar, NULL, "Cancel", cancel_clicked, NULL);
+
+               elm_object_item_part_content_set(nf_it, "toolbar", toolbar);
+
+               //evas_object_color_set(bg, 200, 170, 100, 255);
+                evas_object_show(toolbar);
+       }
+}
+
+static void
+create_base_gui_account(void)
+{
+       elm_app_base_scale_set(1.8);
+
+       /* Window */
+       __ad->win = elm_win_util_standard_add("org.tizen.asmui", "org.tizen.asmui");
+       elm_win_conformant_set(__ad->win, EINA_TRUE);
+       elm_win_autodel_set(__ad->win, EINA_TRUE);
+
+       if (elm_win_wm_rotation_supported_get(__ad->win)) {
+               int rots[4] = { 0, 90, 180, 270 };
+               elm_win_wm_rotation_available_rotations_set(__ad->win, (const int *)(&rots), 4);
+       }
+
+       evas_object_smart_callback_add(__ad->win, "delete,request", cancel_clicked, NULL);
+       eext_object_event_callback_add(__ad->win, EEXT_CALLBACK_BACK, cancel_clicked, NULL);
+
+       /* Conformant */
+       __ad->conform = elm_conformant_add(__ad->win);
+       evas_object_size_hint_weight_set(__ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(__ad->win, __ad->conform);
+       evas_object_show(__ad->conform);
+
+       /* Base Layout */
+       __ad->layout = elm_layout_add(__ad->conform);
+       evas_object_size_hint_weight_set(__ad->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_layout_theme_set(__ad->layout, "layout", "application", "default");
+       evas_object_show(__ad->layout);
+
+       elm_object_content_set(__ad->conform, __ad->layout);
+
+       /* Naviframe */
+       __ad->nf = elm_naviframe_add(__ad->layout);
+
+       create_list_view_account();
+
+       elm_object_part_content_set(__ad->layout, "elm.swallow.content", __ad->nf);
+       eext_object_event_callback_add(__ad->nf, EEXT_CALLBACK_BACK, cancel_clicked, NULL);
+       eext_object_event_callback_add(__ad->nf, EEXT_CALLBACK_MORE, cancel_clicked, NULL);
+
+       /* Show window after base gui is set up */
+       evas_object_show(__ad->win);
+}
+
+
+void
+show_account_ui(void)
+{
+       create_base_gui_account();
+       return;
+}
+
+static void
+timeout_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       evas_object_hide(obj);
+}
+
+static void
+toast_popup(char *text)
+{
+       Evas_Object* popup = elm_popup_add(__ad->nf);
+       elm_object_style_set(popup, "toast");
+       elm_object_text_set(popup, text);
+       evas_object_show(popup);
+
+       evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_popup_timeout_set(popup, 2.0);
+       evas_object_smart_callback_add(popup, "timeout", timeout_cb, NULL);
+
+}
+
+int
+genB64Encode(const unsigned char *input, int inlen, unsigned char * output, int *outlen)
+{
+#if 0
+       EVP_ENCODE_CTX ctx;
+       int t = 0;
+       EVP_EncodeInit(&ctx);
+       EVP_EncodeUpdate(&ctx, output,outlen,input,inlen);
+       EVP_EncodeFinal(&ctx,output + *outlen, &t);
+       *outlen += t -1;
+#else
+       BIO * bmem = NULL;
+       BIO * b64 = NULL;
+       BUF_MEM * bptr = NULL;
+       b64 = BIO_new(BIO_f_base64());
+       if(b64 == NULL)
+       {
+               _ERR("BIO_new failed \n");
+               return -1;
+       }
+       BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
+
+       bmem = BIO_new(BIO_s_mem());
+       b64 = BIO_push(b64, bmem);
+       BIO_write(b64, input, inlen);
+       BIO_flush(b64);
+       BIO_get_mem_ptr(b64, &bptr);
+
+       memcpy(output, bptr->data, bptr->length);
+       output[bptr->length] = 0;
+       *outlen = bptr->length;
+       if(b64)
+       {
+               BIO_free_all(b64);
+       }
+       //printf("outlen is %d, out is %s\n",*outlen, output);
+#endif
+       int i;
+       for(i =0; i < *outlen ; i++)
+       {
+               if(output[i] == '+')
+               {
+                       output[i] = '-';
+               }
+               else if(output[i] == '/')
+               {
+                       output[i] = '_';
+               }
+               else if(output[i] == '=')
+               {
+                       *outlen = i ;
+                       output[i] = '\0';
+                       break;
+               }
+       }
+
+       _INFO("AsmCrypto::genB64Encode:: outlen = [%d]", *outlen);
+       return 0;
+}
+
+unsigned char*
+ToBase64Url(const unsigned char *input, int inputLen)
+{
+       _BEGIN;
+
+       int inputSz = inputLen; //input.size();
+
+       _INFO("AsmCrypto::ToBase64Url::input size = [%d]", inputSz);
+
+       unsigned char* output = NULL;
+       //MALLOC(output, unsigned char, inputSz*1.5);
+
+       output = (unsigned char*)calloc(1, inputSz*1.5);
+
+       int outputSz = 0;
+
+       if (0 != genB64Encode(input,
+                                               inputSz,
+                                               output,
+                                               &outputSz))
+       {
+               _ERR("Failed to encode base64.");
+               free(output);
+               return (unsigned char*)"";
+       }
+
+       _INFO("AsmCrypto::ToBase64Url::output size = [%d]", outputSz);
+       _INFO("AsmCrypto::ToBase64Url::output = [%s]", output);
+
+       _END;
+       return output;
+}
+
+bool
+genHash256(const void* input, unsigned long length, unsigned char* md)
+{
+       SHA256_CTX context;
+       if(!SHA256_Init(&context))
+               return false;
+
+       if(!SHA256_Update(&context, (unsigned char*)input, length))
+               return false;
+
+       if(!SHA256_Final(md, &context))
+               return false;
+
+       return true;
+}
+
+static void
+pin_save_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       if(elm_entry_is_empty(__ad->entry) == EINA_TRUE){
+               toast_popup("Enter PIN");
+               return;
+       }
+
+       const char *pin = elm_entry_entry_get(__ad->entry);
+
+       if (__ad->token_in == NULL) {
+               asm_ui_ipc_send_auth_result(0, __ad->nonce, 0, pin);
+               return;
+       }
+
+       unsigned char digest[DIGEST_LEN];
+       genHash256(pin, strlen(pin), digest);
+       char *pin_b64 = (char*)ToBase64Url(digest, DIGEST_LEN);
+
+       if (strcmp(pin_b64, __ad->token_in) == 0) {
+               asm_ui_ipc_send_auth_result(0, __ad->nonce, 0, pin);
+       }
+       else {
+               dlog_print(DLOG_INFO, "org.tizen.asmui", "fido asm ui [%s][%s][%s]", pin, pin_b64, __ad->token_in);
+               toast_popup("Incorrect PIN");
+               return;
+       }
+
+
+}
+
+static void
+pin_cancel_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       asm_ui_ipc_send_auth_result(0, __ad->nonce, -1, "dummy");
+       return;
+}
+
+
+static void
+create_base_gui_pin(int type)
+{
+       elm_app_base_scale_set(1.8);
+
+       /* Window */
+       __ad->win = elm_win_util_standard_add("org.tizen.asmui", "org.tizen.asmui");
+       elm_win_conformant_set(__ad->win, EINA_TRUE);
+       elm_win_autodel_set(__ad->win, EINA_TRUE);
+
+       if (elm_win_wm_rotation_supported_get(__ad->win)) {
+               int rots[4] = { 0, 90, 180, 270 };
+               elm_win_wm_rotation_available_rotations_set(__ad->win, (const int *)(&rots), 4);
+       }
+
+       evas_object_smart_callback_add(__ad->win, "delete,request", pin_cancel_clicked, NULL);
+       eext_object_event_callback_add(__ad->win, EEXT_CALLBACK_BACK, pin_cancel_clicked, NULL);
+
+       /* Conformant */
+       __ad->conform = elm_conformant_add(__ad->win);
+       evas_object_size_hint_weight_set(__ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(__ad->win, __ad->conform);
+       evas_object_show(__ad->conform);
+
+       /* Base Layout */
+       __ad->layout = elm_layout_add(__ad->conform);
+       evas_object_size_hint_weight_set(__ad->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_layout_theme_set(__ad->layout, "layout", "application", "default");
+       evas_object_show(__ad->layout);
+
+       elm_object_content_set(__ad->conform, __ad->layout);
+
+       /* Naviframe */
+       __ad->nf = elm_naviframe_add(__ad->layout);
+
+       __ad->entry = elm_entry_add(__ad->nf);
+       elm_object_part_text_set(__ad->entry, "elm.guide", "Enter Numeric PIN Here");
+       elm_entry_password_set(__ad->entry, EINA_TRUE);
+       elm_entry_input_panel_layout_set(__ad->entry, ELM_INPUT_PANEL_LAYOUT_NUMBERONLY);
+       elm_entry_scrollable_set(__ad->entry, EINA_FALSE);
+       evas_object_size_hint_weight_set(__ad->entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(__ad->entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+       /* This button is set for devices which doesn't have H/W back key. */
+       Evas_Object *btn = elm_button_add(__ad->nf);
+       elm_object_style_set(btn, "naviframe/end_btn/default");
+
+       char title[128] = {0, };
+       if (type == 0)
+               snprintf(title, 127, "Setup a New PIN");
+       else
+               snprintf(title, 127, "Verify PIN");
+
+       Evas_Object *nf_it = elm_naviframe_item_push(__ad->nf, title, btn, NULL, __ad->entry, NULL);
+
+       //elm_naviframe_item_pop_cb_set(nf_it, naviframe_pop_cb_account, __ad->win);
+
+       /*Toolbar*/
+       Evas_Object *toolbar = ui_utils_toolbar_add_account(__ad->nf);
+       if(toolbar) {
+               evas_object_show(toolbar);
+
+               elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_NONE);
+
+               elm_toolbar_item_append(toolbar, NULL, "Save", pin_save_clicked, NULL);
+
+               elm_toolbar_item_append(toolbar, NULL, "Cancel", pin_cancel_clicked, NULL);
+
+               elm_object_item_part_content_set(nf_it, "toolbar", toolbar);
+
+               //evas_object_color_set(bg, 200, 170, 100, 255);
+                evas_object_show(toolbar);
+       }
+
+
+       elm_object_part_content_set(__ad->layout, "elm.swallow.content", __ad->nf);
+       eext_object_event_callback_add(__ad->nf, EEXT_CALLBACK_BACK, pin_cancel_clicked, NULL);
+       eext_object_event_callback_add(__ad->nf, EEXT_CALLBACK_MORE, pin_cancel_clicked, NULL);
+
+       /* Show window after base gui is set up */
+       evas_object_show(__ad->win);
+}
+
+void
+show_pin_ui_enroll(void)
+{
+       create_base_gui_pin(0);
+       return;
+}
+
+void
+show_pin_ui_verify(void)
+{
+       create_base_gui_pin(1);
+       return;
+}
+
+static void
+app_control(app_control_h app_control, void *data)
+{
+       dlog_print(DLOG_INFO, "org.tizen.asmui", "fido asm ui app_control");
+
+       __ad->mode = NULL;
+       app_control_get_extra_data(app_control, TC_UI_KEY_MODE, &(__ad->mode));
+
+       __ad->nonce = NULL;
+       app_control_get_extra_data(app_control, TC_UI_KEY_NONCE, &(__ad->nonce));
+
+       if (strcmp(__ad->mode, TC_UI_VAL_MODE_TC) == 0) {
+               __ad->app_id_in = NULL;
+               app_control_get_extra_data(app_control, TC_UI_KEY_APP, &(__ad->app_id_in));
+
+               __ad->text_in = NULL;
+               app_control_get_extra_data(app_control, TC_UI_KEY_TEXT, &(__ad->text_in));
+
+               show_tc_ui();
+
+       } else if (strcmp(__ad->mode, TC_UI_VAL_MODE_ACCOUNT) == 0) {
+               __ad->app_id_in = NULL;
+               app_control_get_extra_data(app_control, TC_UI_KEY_APP, &(__ad->app_id_in));
+
+               __ad->text_list_in = NULL;
+               __ad->text_list_in_len = 0;
+               app_control_get_extra_data_array(app_control, TC_UI_KEY_ACC_LIST,
+                                                                                &(__ad->text_list_in), &(__ad->text_list_in_len));
+
+               show_account_ui();
+
+       } else  if (strcmp(__ad->mode, TC_UI_VAL_MODE_PIN_ENROLL) == 0) {
+               __ad->app_id_in = NULL;
+               app_control_get_extra_data(app_control, TC_UI_KEY_APP, &(__ad->app_id_in));
+
+               show_pin_ui_enroll();
+
+       } else if (strcmp(__ad->mode, TC_UI_VAL_MODE_PIN_VERIFY) == 0) {
+               __ad->app_id_in = NULL;
+               app_control_get_extra_data(app_control, TC_UI_KEY_APP, &(__ad->app_id_in));
+
+               __ad->token_in = NULL;
+               app_control_get_extra_data(app_control, TC_UI_KEY_TOK, &(__ad->token_in));
+
+               show_pin_ui_verify();
+       }
+}
+
+static void
+app_pause(void *data)
+{
+
+}
+
+static void
+app_resume(void *data)
+{
+       dlog_print(DLOG_INFO, "org.tizen.asmui", "fido asm ui app_resume");
+}
+
+static void
+app_terminate(void *data)
+{
+       dlog_print(DLOG_INFO, "org.tizen.asmui", "fido asm ui app_terminate");
+}
+
+static void
+ui_app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+       return;
+}
+
+static void
+ui_app_orient_changed(app_event_info_h event_info, void *user_data)
+{
+       return;
+}
+
+static void
+ui_app_region_changed(app_event_info_h event_info, void *user_data)
+{
+}
+
+static void
+ui_app_low_battery(app_event_info_h event_info, void *user_data)
+{
+}
+
+static void
+ui_app_low_memory(app_event_info_h event_info, void *user_data)
+{
+       dlog_print(DLOG_INFO, "org.tizen.asmui", "fido asm ui ui_app_low_memory");
+}
+
+static bool
+app_create(void *data)
+{
+       return true;
+}
+
+EXPORT_API int
+main(int argc, char *argv[])
+{
+       dlog_print(DLOG_INFO, "org.tizen.asmui", "fido asm ui start");
+
+       __ad = NALLOC(1, appdata_s);
+       int ret = 0;
+
+       ui_app_lifecycle_callback_s event_callback = {0,};
+       app_event_handler_h handlers[5] = {NULL, };
+
+       event_callback.create = app_create;
+       event_callback.terminate = app_terminate;
+       event_callback.pause = app_pause;
+       event_callback.resume = app_resume;
+       event_callback.app_control = app_control;
+
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, __ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, __ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, __ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, __ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, __ad);
+       ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);
+
+#if !GLIB_CHECK_VERSION(2,35,0)
+       g_type_init();
+#endif
+
+       dlog_print(DLOG_INFO, "org.tizen.asmui", "fido asm ui before ui_app_main");
+       ret = ui_app_main(argc, argv, &event_callback, __ad);
+       /*if (ret != APP_ERROR_NONE) {
+               _INFO("app_main() is failed. err = %d", ret);
+       }*/
+
+       dlog_print(DLOG_INFO, "org.tizen.asmui", "fido asm ui after ui_app_main [%d]", ret);
+       return ret;
+}
diff --git a/ui/src/asm_ui_ipc.c b/ui/src/asm_ui_ipc.c
new file mode 100644 (file)
index 0000000..93437df
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2014 - 2015 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 "asm_ui_ipc.h"
+#include "fido-client-ipc-stub.h"
+#include <dlog.h>
+
+static Fidoasm*
+__asm_ui_get_dbus_proxy(void)
+{
+#if !GLIB_CHECK_VERSION(2, 35, 0)
+       g_type_init();
+#endif
+
+       GDBusConnection *connection = NULL;
+       GError *error = NULL;
+
+       connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+
+       /* Create the object */
+       Fidoasm *dbus_proxy = fidoasm_proxy_new_sync(connection,
+                                               G_DBUS_PROXY_FLAGS_NONE,
+                                                                                                "org.tizen.fidoasm",
+                                                                                                "/org/tizen/fidoasm",
+                                               NULL,
+                                               &error);
+
+       if (error != NULL) {
+               dlog_print(DLOG_INFO, "org.tizen.asmui", "fido asm ui after fidoasm_proxy_new_sync %s", error->message);
+       }
+       return dbus_proxy;
+}
+
+int
+asm_ui_ipc_send_tc_result(const char *nonce, int result)
+{
+       dlog_print(DLOG_INFO, "org.tizen.asmui", "fido asm ui asm_ui_ipc_send_tc_result start");
+
+       Fidoasm *dbus_proxy = __asm_ui_get_dbus_proxy();
+       if (dbus_proxy == NULL)
+               return -1;
+
+       dlog_print(DLOG_INFO, "org.tizen.asmui", "fido asm ui after dbus_proxy");
+       GError *err = NULL;
+       fidoasm_call_asm_ui_confirm_tc_sync(dbus_proxy, nonce, result, NULL, &err);
+       dlog_print(DLOG_INFO, "org.tizen.asmui", "fido asm ui after fidoasm_call_asm_ui_confirm_tc_sync");
+       if (err != NULL) {
+               dlog_print(DLOG_INFO, "org.tizen.asmui", "fido asm ui fidoasm_call_asm_ui_confirm_tc_sync %s", err->message);
+       }
+
+       return 0;
+}
+
+int
+asm_ui_ipc_send_account_result(const char *nonce, int result, const char *account)
+{
+       Fidoasm *dbus_proxy = __asm_ui_get_dbus_proxy();
+       if (dbus_proxy == NULL)
+               return -1;
+
+       GError *err = NULL;
+       fidoasm_call_asm_ui_confirm_acc_sync(dbus_proxy, nonce, result, account,
+                                                                                NULL, &err);
+
+       return 0;
+}
+
+int
+asm_ui_ipc_send_auth_result(int type, const char *nonce, int result, const char *token)
+{
+       Fidoasm *dbus_proxy = __asm_ui_get_dbus_proxy();
+       if (dbus_proxy == NULL)
+               return -1;
+
+       GError *err = NULL;
+       fidoasm_call_auth_ui_result_sync(dbus_proxy, type, nonce, result, token,
+                                                                        NULL, &err);
+
+       return 0;
+}
diff --git a/ui/src/asm_ui_ipc.h b/ui/src/asm_ui_ipc.h
new file mode 100644 (file)
index 0000000..0972a1b
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2014 - 2015 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 ASM_UI_IPC_H
+#define ASM_UI_IPC_H
+
+#include <tizen.h>
+#include <glib.h>
+
+int asm_ui_ipc_send_tc_result(const char *nonce, int result);
+int asm_ui_ipc_send_account_result(const char *nonce, int result, const char *account);
+int asm_ui_ipc_send_auth_result(int type, const char *nonce, int result, const char *token);
+
+#endif // ASM_UI_IPC_H