Sorry that I misread your question about cbor to json conversion. I am not sure if it is possible to be fully convertible from cbor to json. Nathan, please help comment on this. On the other hand, just wondering: do you really need it to be fully convertible from cbor to json? AS we always keep a pair of json and dat files to be able to make manual updates for SVR.
/Shujuan From: iotivity-dev-bounces at lists.iotivity.org [mailto:[email protected]] On Behalf Of Chen, Shujuan Sent: Friday, May 6, 2016 2:05 PM To: Schulhof, Gabriel <gabriel.schulhof at intel.com>; Heldt-Sheller, Nathan <nathan.heldt-sheller at intel.com> Cc: iotivity-dev <iotivity-dev at lists.iotivity.org> Subject: Re: [dev] Step-by-step guide for creating a secure client/server pair Hi Gabriel, 1. Please try to also exit the client and server apps before you recompile the code. If you still get stuck to perform a GET/PUT, please share the full logs for both server and client and I can help to take a look. And it would be good if you can build with debug logs by adding RELEASE=0 with the scons command. 2. For the json2cbor conversion: In the wiki link, you can follow this part to do the json2cbor conversion: (Note that the json2cbor tool is under out folder) ------------------------------------------------------------------------- SVRs Database Format Conversion ? So a JSON-to-CBOR conversion tool is provided here (to create the target DAT file): ? <iotivity-base>/out/<?>/release/resource/csdk/security/tool/json2cbor Run the command like: ? ./json2cbor <jsonFileName> <datFileName> ------------------------------------------------------------------------- Please NOTE that if you recompile, make sure the updated SVB files are also copied from the source location to the output destination (where you execute the apps). If you want to test denied access and grant access automatically, you can also add new SVB test files into the client app source code and add new option for it. Let me know if there are still any problems. Regards, Shujuan From: iotivity-dev-bounces at lists.iotivity.org<mailto:iotivity-dev-bounces at lists.iotivity.org> [mailto:[email protected]] On Behalf Of Schulhof, Gabriel Sent: Friday, May 6, 2016 12:44 PM To: Heldt-Sheller, Nathan <nathan.heldt-sheller at intel.com<mailto:nathan.heldt-sheller at intel.com>> Cc: iotivity-dev <iotivity-dev at lists.iotivity.org<mailto:iotivity-dev at lists.iotivity.org>> Subject: Re: [dev] Step-by-step guide for creating a secure client/server pair Hey! On Fri, May 6, 2016 at 6:34 AM, Heldt-Sheller, Nathan <nathan.heldt-sheller at intel.com<mailto:nathan.heldt-sheller at intel.com>> wrote: https://wiki.iotivity.org/security_resource_manager If reading through this doesn?t get you going, please circle back to the dev list, and we can try to help you get un-stuck. I've started reading that and I've gotten ahead - somewhat. I've discovered two problems: 1. The secure occlientbasicops indeed manages to discover the secure resource presented by the secure ocserverbasicops, but it hangs while attempting to perform a GET/PUT (the step "occlientbasicops -t 2" in the wiki). 2. I don't yet have a reliable workflow for converting back and forth between cbor and JSON. I've put cJSON.{c,h} under extlibs/tinycbor/tinycbor/src/cjson and thus managed to build both cbordump and json2cbor, but they do not form a closed circle. For example, if I run the secure server and then run ./extlibs/tinycbor/tinycbor/bin/cbordump -j -O ./oic_svr_db_server.dat > ./tmp.json followed by ./extlibs/tinycbor/tinycbor/bin/json2cbor ./tmp.json > tmp.dat then tmp.dat does not have the same contents as ./oic_svr_db_server.dat I believe this is because cbordump creates a JSON object with a single property: "doxm", the value of which is a uuencoded string. If, OTOH, I cat -v oic_svr_db_server.dat, I see that it contains much more information about deviceuuid and owneruuid than the resulting JSON. My ultimate goal here is to produce the cbor files necessary for automatically testing secure resources as part of the test suite for iotivity-node. For example, I would like to test the security end-to-end by performing the following steps automatically: 1. Launch a server that registers a single secure resource 2. Launch a client that performs the discovery and successfully discovers the resource 3. Have the client attempt a GET request against the resource and assert that it fails 4. Terminate the server 5. Convert its oic_svr_db_server.dat file to JSON and insert the information required to allow the client to access the resource 6. Convert the file back to CBOR and overwrite it in its original location 7. Restart the server 8. Re-attempt the GET request and assert that it succeeds. Basically, the output would be similar to this: https://travis-ci.org/otcshare/iotivity-node/jobs/127517351#L1536 So, coming up with a workflow for converting back and forth between JSON and CBOR would be really nice, because it would help me experiment with manually manipulating the persisted data before I take the step of automating it for CI. TIA for your help, Gabriel ---------------------------------------------------------------------- Intel Sweden AB Registered Office: Isafjordsgatan 30B, 164 40 Kista, Stockholm, Sweden Registration Number: 556189-6027 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. ---------------------------------------------------------------------- Intel Sweden AB Registered Office: Isafjordsgatan 30B, 164 40 Kista, Stockholm, Sweden Registration Number: 556189-6027 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20160506/928eb0e3/attachment.html>
