Commit 6e0b5a8f authored by Jay Sharma's avatar Jay Sharma Committed by Madan Lanka

[Easy-setup] Fixed Security feature

 - Updated Mediator and enrollee sample applications [Android, Linux,Tizen]
 - Updated iotivity.spec file
 - Updated tizen-sdb README file

Change-Id: I95a8540ced6c9b5ac5036afb2763aeb02ec24a09
Signed-off-by: default avatarJay Sharma <jay.sharma@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/6303Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarMadan Lanka <lanka.madan@samsung.com>
parent 34df9a3c
......@@ -47,7 +47,7 @@ static char passwd[] = "EasySetup123";
* It contains Server's Identity and the PSK credentials
* of other devices which the server trusts
*/
static char CRED_FILE[] = "oic_svr_db_server.json";
static char CRED_FILE[] = "oic_svr_db_server.dat";
OCPersistentStorage ps ;
......@@ -180,7 +180,7 @@ int main()
printf("EasySetup Enrollee SAMPLE\n");
printf("#########################\n");
PrintMenu();
char option = 'T';
char option = 'T';
while(true)
{
......
......@@ -49,7 +49,7 @@ static char passwd[] = "EasySetup123";
* It contains Server's Identity and the PSK credentials
* of other devices which the server trusts
*/
static char CRED_FILE[] = "oic_svr_db_server.json";
static char CRED_FILE[] = "oic_svr_db_server.dat";
OCPersistentStorage ps ;
......
......@@ -32,7 +32,7 @@ scons -f service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/ti
ES_ROLE=enrollee ES_TARGET_ENROLLEE=android ES_SOFTAP_MODE=ENROLLEE_SOFTAP
4) If built for security mode:
After installing sample RPM on device, copy required json files and other applications to the same path where enrollee_wifi(executable) is available
After installing sample RPM on device, copy required .dat files and other applications to the same path where enrollee_wifi(executable) is available
(If needed, modify the parameters accordingly)
Note :- Upon successful execution of above command(s) RI library and sample console application(for tizen enrollee)
......@@ -59,7 +59,7 @@ Procedure to Execute Sample App:
Execute the sample app by below commands
i) cd /usr/apps/com.oic.es.sample/bin
If executing with secure mode enabled then do the below step (no. ii)
ii) cp /usr/lib/oic_svr_db_server.json .
ii) cp /usr/lib/oic_svr_db_server.dat .
Execute the application
./enrollee_wifi
{
"acl": [
{
"sub": "Kg==",
"rsrc": [
"/oic/res",
"/oic/d",
"/oic/p",
"/oic/res/types/d",
"/oic/ad",
"/oic/sec/amacl"
],
"perms": 2,
"ownrs" : ["YWRtaW5EZXZpY2VVVUlEMA=="]
},
{
"sub": "Kg==",
"rsrc": [
"/oic/sec/doxm",
"/oic/sec/pstat"
],
"perms": 2,
"ownrs" : ["YWRtaW5EZXZpY2VVVUlEMA=="]
}
],
"pstat": {
"isop": true,
"deviceid": "YWRtaW5EZXZpY2VVVUlEMA==",
"ch": 0,
"cm": 0,
"tm": 0,
"om": 3,
"sm": [3]
},
"doxm": {
"oxm": [0],
"oxmsel": 0,
"sct": 1,
"owned": true,
"deviceid": "YWRtaW5EZXZpY2VVVUlEMA==",
"ownr": "YWRtaW5EZXZpY2VVVUlEMA=="
}
}
......@@ -79,7 +79,7 @@ public class MainActivity extends Activity {
public static final int FAILED = 1;
public static final int STATE_CHANGED = 2;
public static final String OIC_CLIENT_JSON_DB_FILE = "oic_svr_db_client.json";
public static final String OIC_CLIENT_JSON_DB_FILE = "oic_svr_db_client.dat";
public static final String OIC_SQL_DB_FILE = "PDM.db";
private static final int BUFFER_SIZE = 1024;
......
......@@ -31,7 +31,7 @@
#define ES_SAMPLE_APP_TAG "ES_SAMPLE_APP_TAG"
#define DECLARE_MENU(FUNC, ...) { #FUNC, FUNC }
#define JSON_DB_PATH "./oic_svr_db_client.json"
#define JSON_DB_PATH "./oic_svr_db_client.dat"
using namespace OC;
using namespace OIC::Service;
......@@ -42,6 +42,7 @@ static WiFiOnboadingConnection onboardingConn;
static RemoteEnrollee::shared_ptr remoteEnrollee = nullptr;
static std::string ipaddress, ssid, pwd;
char security;
struct CloseApp
{
......@@ -95,29 +96,57 @@ void initEasySetup()
easySetupIntance = EasySetup::getInstance();
ipaddress = "192.168.1.104";
ssid = "hub2.4G";
pwd = "22221111";
cout<<"\n Enter the IP address : ";
cin>>ipaddress;
cout<<"\n Enter the Target Network SSID : ";
cin>>ssid;
cout<<"\n Enter the Target Network Password : ";
cin>>pwd;
cout<<"\n Enable Security: [Y/N] ";
cin>>security;
netInfo.connType = CT_ADAPTER_IP;
OICStrcpy(netInfo.provData.WIFI.ssid, NET_WIFI_SSID_SIZE - 1, ssid.c_str());
OICStrcpy(netInfo.provData.WIFI.pwd, NET_WIFI_PWD_SIZE - 1, pwd.c_str());
onboardingConn.isSecured = false;
OICStrcpy(onboardingConn.ipAddress, IPV4_ADDR_SIZE - 1, ipaddress.c_str());
try
if ( ipaddress.size() == 0 || ssid.size() == 0 || pwd.size()==0 )
{
remoteEnrollee = easySetupIntance->createEnrolleeDevice(netInfo,onboardingConn);
cout<<"\n Invalid information try again !!!";
}
catch (OCException &e)
{
std::cout << "Exception during createEnrolleeDevice call" << e.reason();
return;
else
{
cout <<"\n Entered details are : \n";
cout<<"\n IP address : "<<ipaddress;
cout<<"\n Target Network SSID : "<<ssid;
cout<<"\n Target Network Password : "<<pwd;
if (security == 'Y' || security == 'y' )
{
onboardingConn.isSecured = true;
cout<<"\n Security is Enabled\n\n\n";
}
else
{
onboardingConn.isSecured = false;
cout<<"\n Security is not Enabled\n\n\n";
}
netInfo.connType = CT_ADAPTER_IP;
OICStrcpy(netInfo.provData.WIFI.ssid, NET_WIFI_SSID_SIZE - 1, ssid.c_str());
OICStrcpy(netInfo.provData.WIFI.pwd, NET_WIFI_PWD_SIZE - 1, pwd.c_str());
OICStrcpy(onboardingConn.ipAddress, IPV4_ADDR_SIZE - 1, ipaddress.c_str());
try
{
remoteEnrollee = easySetupIntance->createEnrolleeDevice(netInfo,onboardingConn);
}
catch (OCException &e)
{
std::cout << "Exception during createEnrolleeDevice call" << e.reason();
return;
}
remoteEnrollee->registerEasySetupStatusHandler(&easySetupStatusCallback);
}
remoteEnrollee->registerEasySetupStatusHandler(&easySetupStatusCallback);
}
void runEasySetupMenu()
{
......
......@@ -163,7 +163,7 @@ cp ./resource/csdk/security/include/pinoxmcommon.h %{buildroot}%{_includedir}
cp ./resource/csdk/security/provisioning/include/oxm/*.h %{buildroot}%{_includedir}
cp ./resource/csdk/security/provisioning/include/internal/*.h %{buildroot}%{_includedir}
cp ./resource/csdk/security/provisioning/include/*.h %{buildroot}%{_includedir}
cp ./resource/csdk/security/provisioning/sample/oic_svr_db_server_justworks.json %{buildroot}%{_libdir}/oic_svr_db_server.json
cp ./resource/csdk/security/provisioning/sample/oic_svr_db_server_justworks.dat %{buildroot}%{_libdir}/oic_svr_db_server.dat
%endif
......@@ -216,7 +216,7 @@ cp service/easy-setup/enrollee/inc/*.h %{buildroot}%{_includedir}
%if 0%{?SECURED} == 1
%{_libdir}/libocpmapi.so
%{_libdir}/libocprovision.so
%{_libdir}/oic_svr_db_server.json
%{_libdir}/oic_svr_db_server.dat
%endif
%if 0%{?tizen_version_major} < 3
%{_datadir}/license/%{name}-service
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment