The .dat files are cbor but the cbor2json tool does some things that are 
unusual that makes them a little less convenient.

For example:

If you pass

{
    "acl": {
        "aclist2": [
            {
                "aceid": 1,
                "subject": { "conntype": "anon-clear" },
                "resources": [
                    { "href": "/oic/res" },
                    { "href": "/oic/d" },
                    { "href": "/oic/p" },
                    { "href": "/oic/sec/doxm" }
                ],
                "permission": 2
            }
        ],
        "rowneruuid" : "31313131-3131-3131-3131-313131313131"
    }
}

Json2cbor tool will encode everything after “acl”: into cbor then insert that 
into the final cbor output as a byte array as the value contained in acl

If you pass this value to a cbor2json decoder you will not get the json shown 
above you will get:

{
    "acl": <an array of bytes depending on the decoder this could be in a 
format like base64>
}

You must then take the array of bytes to the right of acl and decode them using 
a cbor2json decoder to find out the actual value.

See https://jira.iotivity.org/browse/IOT-2849 for a more in depth description. 
Using the “doxm” tag instead of the “acl” tag.


The unusual way json2cbor has actually made learning and understanding 
iotivity’s security much harder for me since it has made inspecting the *.dat 
files more difficult.

George Nash
From: iotivity-dev-boun...@lists.iotivity.org 
[mailto:iotivity-dev-boun...@lists.iotivity.org] On Behalf Of Gregg Reynolds
Sent: Monday, March 5, 2018 10:43 AM
To: Mats Wichmann <m...@wichmann.us>
Cc: iotivity-dev <iotivity-dev@lists.iotivity.org>
Subject: Re: [dev] .dat files not being .gitignored?



On Mar 5, 2018 12:13 PM, "Mats Wichmann" 
<m...@wichmann.us<mailto:m...@wichmann.us>> wrote:

Really, we should get to a point where they don't need to be checked-in
in git at all, and just always generated during the build, but as noted
that can't be the case right now because of cross-building.

I gather from all this that the .dat files are not cbor? I was under the 
impression that cbor is platform-independent. No?

Gregg
_______________________________________________
iotivity-dev mailing list
iotivity-dev@lists.iotivity.org
https://lists.iotivity.org/mailman/listinfo/iotivity-dev

Reply via email to