The files high-level-client.coaps.js
and high-level-server.coaps.js
are for
a client/server pair illustrating DTLS access to a resource. To run the example,
please follow the steps below:
-
In addition to
iotivity-node
, buildiotivity
withSECURED=1
andRD_MODE=all
. Let the root of theiotivity
repository be$iotivityRoot
. -
Calculate the sha256 sum of the server. The example below assumes the server is located in
/home/user/iotivity-node/js/high-level-server.coaps.js
. Replace the path in the example below with the actual absolute path to the filehigh-level-server.coaps.js
.echo -n '/home/user/iotivity-node/js/high-level-server.coaps.js' | sha256sum
Copy the resulting value to the clipboard. Let the value be
$serverHash
. -
Create the directory
${HOME}/.iotivity-node/$serverHash
.mkdir -p ~/.iotivity-node/$serverHash
-
Copy the file
$iotivityRoot/resource/csdk/security/provisioning/sample/oic_svr_db_server_justworks.dat
to${HOME}/.iotivity-node/$serverHash/oic_svr_db.dat
-
Start the server
node high-level-server.coaps.js
-
Switch to the directory where iotivity built the provisioning client, and run it from there. Let
$platform
be the platform for which you build iotivity,$architecture
be the architecture for which you built iotivity, and$buildType
be the build type - i.e.,release
for a production build, anddebug
for a development build.cd $iotivityRoot/out/$platform/$architecture/$buildType/resource/csdk/security/provisioning/sample ./provisioningclient
-
Choose 11 from the menu by typing
11
and pressingEnter
to discover unowned devices. The server should be listed under "Discovered Unowned Devices" with uuid12345678-1234-1234-1234-123456789012
. -
Choose 20 from the menu by typing
20
and pressingEnter
to assume ownership of the devices discovered in the previous step. -
Choose 99 to exit the client.
-
Calculate the sha256 sum of the client. The example below assumes the client is located in
/home/user/iotivity-node/js/high-level-client.coaps.js
. Replace the path in the example below with the actual absolute path to the filehigh-level-client.coaps.js
.echo -n '/home/user/iotivity-node/js/high-level-client.coaps.js' | sha256sum
Copy the resulting value to the clipboard. Let the value be
$clientHash
. -
Create the directory
${HOME}/.iotivity-node/$clientHash
.mkdir -p ~/.iotivity-node/$clientHash
-
Copy the file
oic_svr_db_client.dat
from the current directory (in which theprovisioningclient
program was built) to the newly created directory and rename it tooic_svr_db.dat
.cp ./oic_svr_db_client.dat ${HOME}/.iotivity-node/$clientHash/oic_svr_db.dat
-
Launch the client.
node high-level-client.coaps.js