Update secure resource related modules(SRM,OTM,SRP,CKM,unit tests,samples)
authorleechul <chuls.lee@samsung.com>
Thu, 24 Dec 2015 08:13:37 +0000 (17:13 +0900)
committerDmitriy Zhuravlev <d.zhuravlev@samsung.com>
Tue, 5 Jan 2016 09:08:41 +0000 (09:08 +0000)
according to spec B.

* NOTE : https://gerrit.iotivity.org/gerrit/#/c/4733/ required,
         in order to provisioning tool works in debug mode.

1. Change the security resource name according to spec B.

2. Remove unnecessary security resource according to spec B.

3. Remove the entity of resource name from coap/coaps payload as follows :
  [Before]
  {
    "doxm":
    {
      "oxm":[0],
      "oxmsel":0,
      "sct":1,
      "owned":true,
      "deviceid":"anVzdHdvcmtzRGV2VVVJRA==",
      "devowner":"YWRtaW5EZXZpY2VVVUlEMA==",
      "rowner":"YWRtaW5EZXZpY2VVVUlEMA=="
    }
  }

  [After]
  {
    "oxm":[0],
    "oxmsel":0,
    "sct":1,
    "owned":true,
    "deviceid":"anVzdHdvcmtzRGV2VVVJRA==",
    "devowner":"YWRtaW5EZXZpY2VVVUlEMA==",
    "rowner":"YWRtaW5EZXZpY2VVVUlEMA=="
  }

4. Modify the sample SVR DB(.json) according to above modifications.

5. Modify the unittest according to above modifications.

[Patch #1] Initial upload
[Patch #2] Update commit message
[Patch #3] Retrigger
[Patch #4] Upload missing file.
[Patch #5,#6] Modify according to comments.
[Patch #7,#8] Update commit message.

Change-Id: Ic6842af77c7098f30e7823597f807bb8a55d4541
Signed-off-by: leechul <chuls.lee@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/4725
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: sangsu choi <sangsu.choi@samsung.com>
Reviewed-by: Dmitriy Zhuravlev <d.zhuravlev@samsung.com>
47 files changed:
resource/csdk/security/include/internal/aclresource.h
resource/csdk/security/include/internal/amaclresource.h [changed mode: 0755->0644]
resource/csdk/security/include/internal/credresource.h
resource/csdk/security/include/internal/crlresource.h
resource/csdk/security/include/internal/doxmresource.h
resource/csdk/security/include/internal/pstatresource.h
resource/csdk/security/include/internal/srmresourcestrings.h [changed mode: 0755->0644]
resource/csdk/security/include/internal/svcresource.h
resource/csdk/security/include/securevirtualresourcetypes.h [changed mode: 0755->0644]
resource/csdk/security/provisioning/ck_manager/sample/oic_svr_db_door.json
resource/csdk/security/provisioning/ck_manager/sample/oic_svr_db_light.json
resource/csdk/security/provisioning/ck_manager/sample/oic_svr_db_pt.json
resource/csdk/security/provisioning/ck_manager/unittest/test_data/CKMInfo.json
resource/csdk/security/provisioning/sample/oic_svr_db_client.json
resource/csdk/security/provisioning/sample/oic_svr_db_prov_tool.json [changed mode: 0755->0644]
resource/csdk/security/provisioning/sample/oic_svr_db_server_justworks.json
resource/csdk/security/provisioning/sample/oic_svr_db_server_randompin.json [changed mode: 0755->0644]
resource/csdk/security/provisioning/sample/oic_svr_db_unowned_server.json
resource/csdk/security/provisioning/src/ownershiptransfermanager.c
resource/csdk/security/provisioning/src/oxmjustworks.c
resource/csdk/security/provisioning/src/oxmrandompin.c
resource/csdk/security/provisioning/src/pmutility.c [changed mode: 0755->0644]
resource/csdk/security/provisioning/src/secureresourceprovider.c
resource/csdk/security/src/aclresource.c
resource/csdk/security/src/amaclresource.c
resource/csdk/security/src/amsmgr.c
resource/csdk/security/src/credresource.c
resource/csdk/security/src/crlresource.c
resource/csdk/security/src/doxmresource.c
resource/csdk/security/src/pstatresource.c
resource/csdk/security/src/srmresourcestrings.c [changed mode: 0755->0644]
resource/csdk/security/src/svcresource.c
resource/csdk/security/unittest/SConscript
resource/csdk/security/unittest/aclresourcetest.cpp
resource/csdk/security/unittest/credentialresource.cpp
resource/csdk/security/unittest/doxmresource.cpp
resource/csdk/security/unittest/oic_svr_db.json
resource/csdk/security/unittest/oic_unittest.json
resource/csdk/security/unittest/oic_unittest_acl1.json
resource/csdk/security/unittest/oic_unittest_acl_payload.json [new file with mode: 0644]
resource/csdk/security/unittest/oic_unittest_default_acl.json
resource/csdk/security/unittest/pstatresource.cpp
resource/csdk/security/unittest/svcresourcetest.cpp
resource/csdk/stack/samples/linux/secure/oic_amss_db.json
resource/csdk/stack/samples/linux/secure/oic_svr_db_client.json
resource/csdk/stack/samples/linux/secure/oic_svr_db_server.json
resource/provisioning/examples/oic_svr_db_client.json

index 564d23fbb51a4f797a5ea3a4d8ac8fa53eaa4989..600b1f448a14eb23ece951ef5447c1a85214c537 100644 (file)
@@ -57,10 +57,11 @@ const OicSecAcl_t* GetACLResourceData(const OicUuid_t* subjectId, OicSecAcl_t **
  * Caller needs to invoke 'free' when done using
  * returned string.
  * @param acl  instance of OicSecAcl_t structure.
+ * @param isIncResName decide whether or not to include the resource name in output.
  *
  * @retval  pointer to ACL in json format.
  */
-char* BinToAclJSON(const OicSecAcl_t * acl);
+char* BinToAclJSON(const OicSecAcl_t * acl, const bool isIncResName);
 
 
 /**
@@ -74,10 +75,11 @@ void DeleteACLList(OicSecAcl_t* acl);
 /**
  * This function installs a new ACL.
  * @param newJsonStr JSON string representing a new ACL.
+ * @param isIncResName if resource name is included into payload, it is true.
  *
  * @retval  OC_STACK_OK for Success, otherwise some error value
  */
-OCStackResult InstallNewACL(const char* newJsonStr);
+OCStackResult InstallNewACL(const char* newJsonStr, const bool isIncResName);
 
 
 #ifdef __cplusplus
old mode 100755 (executable)
new mode 100644 (file)
index 9c37a0e..1672f9e
@@ -67,10 +67,11 @@ OCStackResult AmaclGetAmsDeviceId(const char *resource, OicUuid_t *amsId);
  * Caller needs to invoke 'free' when done using
  * returned string.
  * @param Amacl  instance of OicSecAmacl_t structure.
+ * @param isIncResName Decide whether or not to include the name of the resource in output.
  *
  * @retval  pointer to Amacl in json format.
  */
-char* BinToAmaclJSON(const OicSecAmacl_t * amacl);
+char* BinToAmaclJSON(const OicSecAmacl_t * amacl, const bool isIncResName);
 
 #ifdef __cplusplus
 }
index 74ea3733383917b62b7d3d518c9a053901e23066..06636c8634f411f78a5231e30365058b5c3d2e6a 100644 (file)
@@ -65,12 +65,13 @@ const OicSecCred_t* GetCredResourceData(const OicUuid_t* subjectId);
  * Caller needs to invoke 'free' when done using
  * returned string.
  * @param cred  pointer to instance of OicSecCred_t structure.
+ * @param isIncResName Decide whether or not to include the resource name in output.
  *
  * @retval
  *      pointer to JSON credential representation - if credential for subjectId found
  *      NULL                                      - if credential for subjectId not found
  */
-char* BinToCredJSON(const OicSecCred_t* cred);
+char* BinToCredJSON(const OicSecCred_t* cred, const bool isIncResName);
 
 /**
  * This function generates the bin credential data.
index 75178d8fbbf48a8b2b53cb67f4ef330fb91d676a..fbe8086f6b87f19bbf65aca406afbf7dfb13c8d9 100644 (file)
@@ -51,16 +51,16 @@ char* GetBase64CRL();
 void  GetDerCrl(ByteArray crlArray);
 
 /**
- * This function get CRL from SRM
+ * This method converts JSON CRL into binary CRL.
+ * The JSON CRL can be from persistent database or received as PUT/POST request.
  *
- * @param crl [out] - pointer to buffer that contains crl. Shoul be not NULL. Buffer
- * will be allocated by the function and content of *crl will be ignored.
- * @param outlen [out] - pointer to length of the CRL buffer. Shoul be not NULL.
+ * @param[in] jsonStr  CRL data in json string.
+ * @param[in] isIncResName if resource name is included into payload, it is true.
+ * @return pointer to OicSecCrl_t.
  *
- * @returns OC_STACK_OK if success and errorcode otherwise.
- * @note Caller responsible for crl buffer memory (use OICFree to free it)
+ * @note Caller needs to invoke OCFree after done using the return pointer
  */
-OicSecCrl_t * JSONToCrlBin(const char * jsonStr);
+OicSecCrl_t * JSONToCrlBin(const char * jsonStr, const bool isIncResName);
 
 /**
  * Initialize CLR resource by loading data from persistent storage.
index e0f2fc9e97e3e5bc49fa7319344d14d4ce97c8f0..b5b62e17399639bee4fdaed8ee020948782355bd 100644 (file)
@@ -54,12 +54,13 @@ const OicSecDoxm_t* GetDoxmResourceData();
  * or received as PUT/POST request.
  *
  * @param[in] jsonStr  doxm data in json string.
+ * @param[in] isIncResName if resource name is included into payload, it is true.
  * @return pointer to OicSecDoxm_t.
  *
  * @note Caller needs to invoke OCFree after done
  *       using the return pointer
  */
-OicSecDoxm_t * JSONToDoxmBin(const char * jsonStr);
+OicSecDoxm_t * JSONToDoxmBin(const char * jsonStr, const bool isIncResName);
 
 /**
  * This method converts DOXM data into JSON format.
@@ -67,12 +68,13 @@ OicSecDoxm_t * JSONToDoxmBin(const char * jsonStr);
  * return string
  *
  * @param[in] doxm  Pointer to OicSecDoxm_t.
+ * @param[in] isIncResName Decide whether or not to include the resource name in output.
  * @return pointer to json string.
  *
  * @note Caller needs to invoke OCFree after done
  *       using the return pointer
  */
-char * BinToDoxmJSON(const OicSecDoxm_t * doxm);
+char * BinToDoxmJSON(const OicSecDoxm_t * doxm, const bool isIncResName);
 
 /**
  * This method returns the SRM device ID for this device.
index 40c41abefde692b96b40c29c0d24e1d9ac663bac..d4b719f224568bdd3da35044c26d413daaf25d50 100644 (file)
@@ -43,17 +43,19 @@ OCStackResult DeInitPstatResource();
  * This method converts JSON PSTAT into binary PSTAT.
  *
  * @param[in] jsonStr  pstat data in json string.
+ * @param[in] isIncResName if resource name is included into payload, it is true.
  * @return pointer to OicSecPstat_t.
  */
-OicSecPstat_t * JSONToPstatBin(const char * jsonStr);
+OicSecPstat_t * JSONToPstatBin(const char * jsonStr, const bool isIncResName);
 
 /**
  * This method converts pstat data into JSON format.
  *
  * @param[in] pstat  pstat data in binary format.
+ * @param[in] isIncResName Decide whether or not to include the resource name in output.
  * @return pointer to pstat json string.
  */
-char * BinToPstatJSON(const OicSecPstat_t * pstat);
+char * BinToPstatJSON(const OicSecPstat_t * pstat, const bool isIncResName);
 
 /** This function deallocates the memory for OicSecPstat_t.
  *
old mode 100755 (executable)
new mode 100644 (file)
index 1ac3fb0..e263bd7
@@ -68,12 +68,14 @@ extern const char * OIC_JSON_AMSS_NAME;
 extern const char * OIC_JSON_PERMISSION_NAME;
 extern const char * OIC_JSON_OWNERS_NAME;
 extern const char * OIC_JSON_OWNER_NAME;
+extern const char * OIC_JSON_DEV_OWNER_NAME;
 extern const char * OIC_JSON_OWNED_NAME;
 extern const char * OIC_JSON_OXM_NAME;
 extern const char * OIC_JSON_OXM_TYPE_NAME;
 extern const char * OIC_JSON_OXM_SEL_NAME;
 extern const char * OIC_JSON_DEVICE_ID_FORMAT_NAME;
 extern const char * OIC_JSON_CREDID_NAME;
+extern const char * OIC_JSON_SUBJECTID_NAME;
 extern const char * OIC_JSON_ROLEIDS_NAME;
 extern const char * OIC_JSON_CREDTYPE_NAME;
 extern const char * OIC_JSON_PUBLICDATA_NAME;
index 9db42c5516d0e241eeef108a99f3c748c6012e47..9afabfdb7f7f35703bf3cdf2f58ea95986b0881e 100644 (file)
@@ -44,10 +44,11 @@ void DeInitSVCResource();
  * Caller needs to invoke 'free' when done using
  * returned string.
  * @param svc  instance of OicSecSvc_t structure.
+ * @param isIncResName Decide whether or not to include the resource name in output.
  *
  * @retval  pointer to SVC in json format.
  */
-char* BinToSvcJSON(const OicSecSvc_t * svc);
+char* BinToSvcJSON(const OicSecSvc_t * svc, const bool isIncResName);
 
 #ifdef __cplusplus
 }
old mode 100755 (executable)
new mode 100644 (file)
index 83dc60f..6896ce7
@@ -369,8 +369,6 @@ struct OicSecCred
 struct OicSecDoxm
 {
     // <Attribute ID>:<Read/Write>:<Multiple/Single>:<Mandatory?>:<Type>
-    OicUrn_t            *oxmType;       // 0:R:M:N:URN
-    size_t              oxmTypeLen;     // the number of elts in OxmType
     OicSecOxm_t         *oxm;           // 1:R:M:N:UINT16
     size_t              oxmLen;         // the number of elts in Oxm
     OicSecOxm_t         oxmSel;         // 2:R/W:S:Y:UINT16
index 8bcb39fabeadb239d2acf51b9a1e5186018ffb52..5d127e53521f42e562a0f076f708db98503d5560 100644 (file)
@@ -1,29 +1,29 @@
 {
     "acl": [
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/res",
                 "/oic/res/d",
                 "/oic/res/types/d",
                 "/oic/presence"
                        ],
-                       "perms": 2,
-                       "ownrs" : [
+                       "permission": 2,
+                       "rowners" : [
                                "ZG9vckRldmljZVVVSUQwMA=="
                        ]
                },
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/sec/doxm",
                 "/oic/sec/pstat",
                 "/oic/sec/acl",
                 "/oic/sec/crl",
                 "/oic/sec/cred"
              ],
-             "perms": 6,
-             "ownrs" : [
+             "permission": 6,
+             "rowners" : [
                  "ZG9vckRldmljZVVVSUQwMA=="
              ]
         }
@@ -31,7 +31,7 @@
        "pstat":        {
                "isop": false,
                "deviceid":     "ZG9vckRldmljZVVVSUQwMA==",
-               "commithash": 0,
+               "ch": 0,
                "cm":   0,
                "tm":   0,
                "om":   3,
index 048384b3e1fb1a3092952d8fc2caca6c9aa6352b..a4836b669c00d7107d30e0e4ed089f9fceec393f 100644 (file)
@@ -1,29 +1,29 @@
 {
     "acl": [
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/res",
                 "/oic/res/d",
                 "/oic/res/types/d",
                 "/oic/presence"
                        ],
-                       "perms": 2,
-                       "ownrs" : [
+                       "permission": 2,
+                       "rowners" : [
                                "bGlnaHREZXZpY2VVVUlEMA=="
                        ]
                },
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/sec/doxm",
                 "/oic/sec/pstat",
                 "/oic/sec/acl",
                 "/oic/sec/crl",
                 "/oic/sec/cred"
              ],
-             "perms": 6,
-             "ownrs" : [
+             "permission": 6,
+             "rowners" : [
                  "bGlnaHREZXZpY2VVVUlEMA=="
              ]
         }
@@ -31,7 +31,7 @@
        "pstat":        {
                "isop": false,
                "deviceid":     "bGlnaHREZXZpY2VVVUlEMA==",
-               "commithash": 0,
+               "ch": 0,
                "cm":   0,
                "tm":   0,
                "om":   3,
index dd5dec4b533880860f40e92cc4baf647ea4d6da3..f63bca6bb1a791b0e9f79d4bef75516abe7596b6 100644 (file)
@@ -1,27 +1,27 @@
 {
     "acl": [
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/res",
                 "/oic/d",
                 "/oic/p",
                 "/oic/res/types/d",
                 "/oic/ad"
                        ],
-                       "perms": 2,
-                       "ownrs" : ["YWRtaW5EZXZpY2VVVUlEMA=="]
+                       "permission": 2,
+                       "rowners" : ["YWRtaW5EZXZpY2VVVUlEMA=="]
                },
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/sec/doxm",
                 "/oic/sec/pstat",
                 "/oic/sec/acl",
                 "/oic/sec/cred"
              ],
-             "perms": 7,
-             "ownrs" : ["YWRtaW5EZXZpY2VVVUlEMA=="]
+             "permission": 7,
+             "rowners" : ["YWRtaW5EZXZpY2VVVUlEMA=="]
         }
        ],
        "pstat":        {
@@ -39,6 +39,6 @@
                "sct": 1,
                "owned": true,
                "deviceid":     "YWRtaW5EZXZpY2VVVUlEMA==",
-               "ownr": "YWRtaW5EZXZpY2VVVUlEMA=="
+               "devowner":     "YWRtaW5EZXZpY2VVVUlEMA=="
        }
 }
index d036473a9157cf2f96d1f1c2463f65390f86bb79..8e05fdd59d7931018b33cd0d21a5692760c21527 100644 (file)
@@ -1,27 +1,27 @@
 {
     "acl": [
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/res",
                 "/oic/d",
                 "/oic/p",
                 "/oic/res/types/d",
                 "/oic/ad"
             ],
-            "perms": 2,
-            "ownrs" : ["YWRtaW5EZXZpY2VVVUlE"]
+            "permission": 2,
+            "rowners" : ["YWRtaW5EZXZpY2VVVUlE"]
         },
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/sec/doxm",
                 "/oic/sec/pstat",
                 "/oic/sec/acl",
                 "/oic/sec/cred"
              ],
-             "perms": 7,
-             "ownrs" : ["YWRtaW5EZXZpY2VVVUlE"]
+             "permission": 7,
+             "rowners" : ["YWRtaW5EZXZpY2VVVUlE"]
         }
     ],
     "crl": {
@@ -43,6 +43,6 @@
         "oxmsel": 0,
         "owned": true,
         "deviceid": "YWRtaW5EZXZpY2VVVUlE",
-        "ownr": "YWRtaW5EZXZpY2VVVUlE"
+        "devowner": "YWRtaW5EZXZpY2VVVUlE"
     }
 }
index 1219d6a6db11602f8a596500fa883c7779e7af8c..9bec9182f2b155df6e85f40a361aecf416efd8fc 100644 (file)
@@ -1,8 +1,8 @@
 {
     "acl": [
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/res",
                 "/oic/d",
                 "/oic/p",
                 "/oic/ad",
                 "/oic/sec/amacl"
                        ],
-                       "perms": 2,
-                       "ownrs" : ["YWRtaW5EZXZpY2VVVUlEMA=="]
+                       "permission": 2,
+                       "rowners" : ["YWRtaW5EZXZpY2VVVUlEMA=="]
                },
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/sec/doxm",
                 "/oic/sec/pstat"
              ],
-             "perms": 2,
-             "ownrs" : ["YWRtaW5EZXZpY2VVVUlEMA=="]
+             "permission": 2,
+             "rowners" : ["YWRtaW5EZXZpY2VVVUlEMA=="]
         }
        ],
        "pstat":        {
@@ -38,6 +38,6 @@
                "sct": 1,
                "owned": true,
                "deviceid":     "YWRtaW5EZXZpY2VVVUlEMA==",
-               "ownr": "YWRtaW5EZXZpY2VVVUlEMA=="
+               "devowner":     "YWRtaW5EZXZpY2VVVUlEMA=="
        }
 }
old mode 100755 (executable)
new mode 100644 (file)
index 7172a01..8282e63
@@ -1,27 +1,27 @@
 {
     "acl": [
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/res",
                 "/oic/d",
                 "/oic/p",
                 "/oic/res/types/d",
                 "/oic/ad"
                        ],
-                       "perms": 2,
-                       "ownrs" : ["YWRtaW5EZXZpY2VVVUlE"]
+                       "permission": 2,
+                       "rowners" : ["YWRtaW5EZXZpY2VVVUlE"]
                },
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/sec/doxm",
                 "/oic/sec/pstat",
                 "/oic/sec/acl",
                 "/oic/sec/cred"
              ],
-             "perms": 7,
-             "ownrs" : ["YWRtaW5EZXZpY2VVVUlE"]
+             "permission": 7,
+             "rowners" : ["YWRtaW5EZXZpY2VVVUlE"]
         }
        ],
        "pstat":        {
@@ -39,6 +39,6 @@
                "sct": 1,
                "owned": true,
                "deviceid":     "YWRtaW5EZXZpY2VVVUlE",
-               "ownr": "YWRtaW5EZXZpY2VVVUlE"
+               "devowner":     "YWRtaW5EZXZpY2VVVUlE"
        }
 }
index bde9010205b38370fa2443f2ceb293a2ea1e3889..aef44d3be502c678b9f3325711f612ceae529f5f 100644 (file)
@@ -1,28 +1,28 @@
 {
     "acl": [
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/res",
                 "/oic/res/d",
                 "/oic/res/types/d",
                 "/oic/presence"
                        ],
-                       "perms": 2,
-                       "ownrs" : [
+                       "permission": 2,
+                       "rowners" : [
                                "anVzdHdvcmtzRGV2VVVJRA=="
                        ]
                },
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/sec/doxm",
                 "/oic/sec/pstat",
                 "/oic/sec/acl",
                 "/oic/sec/cred"
              ],
-             "perms": 6,
-             "ownrs" : [
+             "permission": 6,
+             "rowners" : [
                  "anVzdHdvcmtzRGV2VVVJRA=="
              ]
         }
@@ -30,7 +30,7 @@
        "pstat":        {
                "isop": false,
                "deviceid":     "anVzdHdvcmtzRGV2VVVJRA==",
-               "commithash": 0,
+               "ch": 0,
                "cm":   0,
                "tm":   0,
                "om":   3,
old mode 100755 (executable)
new mode 100644 (file)
index a79a2b2..62a27b2
@@ -1,28 +1,28 @@
 {
     "acl": [
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/res",
                 "/oic/res/d",
                 "/oic/res/types/d",
                 "/oic/presence"
                        ],
-                       "perms": 2,
-                       "ownrs" : [
+                       "permission": 2,
+                       "rowners" : [
                                "cmFuZG9tUGluRGV2VVVJRA=="
                        ]
                },
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/sec/doxm",
                 "/oic/sec/pstat",
                 "/oic/sec/acl",
                 "/oic/sec/cred"
              ],
-             "perms": 6,
-             "ownrs" : [
+             "permission": 6,
+             "rowners" : [
                  "cmFuZG9tUGluRGV2VVVJRA=="
              ]
         }
@@ -30,7 +30,7 @@
        "pstat":        {
                "isop": false,
                "deviceid":     "cmFuZG9tUGluRGV2VVVJRA==",
-               "commithash": 0,
+               "ch": 0,
                "cm":   0,
                "tm":   0,
                "om":   3,
index fa804dd54284996995463a026e6a1910abde6e2b..42d37c496e354fd6af34a422d139ef93ec1cbf26 100644 (file)
@@ -1,8 +1,8 @@
 {
     "acl": [
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/res",
                 "/oic/d",
                 "/oic/p",
                 "/oic/sec/svc",
                 "/oic/sec/amacl"
                        ],
-                       "perms": 2,
-                       "ownrs" : ["MTExMTExMTExMTExMTExMQ=="]
+                       "permission": 2,
+                       "rowners" : ["MTExMTExMTExMTExMTExMQ=="]
                },
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/sec/doxm",
                 "/oic/sec/pstat"
              ],
-             "perms": 6,
-             "ownrs" : ["MTExMTExMTExMTExMTExMQ=="]
+             "permission": 6,
+             "rowners" : ["MTExMTExMTExMTExMTExMQ=="]
         }
     ],
        "pstat":        {
index 7adeb46407db67384e1dbd2b50cada609bc9033e..8c0407d9251f2a118b35dd625032c74becc46d37 100644 (file)
@@ -515,7 +515,7 @@ static OCStackApplicationResult ListMethodsHandler(void *ctx, OCDoHandle UNUSED,
         }
 
         OicSecPstat_t* pstat = JSONToPstatBin(
-                ((OCSecurityPayload*)clientResponse->payload)->securityData);
+                ((OCSecurityPayload*)clientResponse->payload)->securityData, false);
         if(NULL == pstat)
         {
             OC_LOG(ERROR, TAG, "Error while converting json to pstat bin");
@@ -881,7 +881,7 @@ static OCStackResult PutUpdateOperationMode(OTMContext_t* otmCtx,
         return OC_STACK_NO_MEMORY;
     }
     secPayload->base.type = PAYLOAD_TYPE_SECURITY;
-    secPayload->securityData = BinToPstatJSON(deviceInfo->pstat);
+    secPayload->securityData = BinToPstatJSON(deviceInfo->pstat, false);
     if (NULL == secPayload->securityData)
     {
         OICFree(secPayload);
@@ -1120,7 +1120,7 @@ static OCStackApplicationResult ProvisionDefaultACLCB(void *ctx, OCDoHandle UNUS
             return OC_STACK_NO_MEMORY;
         }
         secPayload->base.type = PAYLOAD_TYPE_SECURITY;
-        secPayload->securityData = BinToPstatJSON(otmCtx->selectedDeviceInfo->pstat);
+        secPayload->securityData = BinToPstatJSON(otmCtx->selectedDeviceInfo->pstat, false);
         if (NULL == secPayload->securityData)
         {
             OICFree(secPayload);
@@ -1223,7 +1223,7 @@ OCStackResult FinalizeProvisioning(OTMContext_t* otmCtx)
         return OC_STACK_NO_MEMORY;
     }
     secPayload->base.type = PAYLOAD_TYPE_SECURITY;
-    secPayload->securityData = BinToAclJSON(&defaultAcl);
+    secPayload->securityData = BinToAclJSON(&defaultAcl, false);
     OICFree(defaultAcl.owners);
     if(!secPayload->securityData)
     {
index 7a0d561329e4fa3067f858662d7c5026e039ab47..5968ed97ae303ceb460317ec34a1998f2d63609f 100644 (file)
@@ -40,7 +40,7 @@ char* CreateJustWorksSelectOxmPayload(OTMContext_t* otmCtx)
     }
 
     otmCtx->selectedDeviceInfo->doxm->oxmSel = OIC_JUST_WORKS;
-    return BinToDoxmJSON(otmCtx->selectedDeviceInfo->doxm);
+    return BinToDoxmJSON(otmCtx->selectedDeviceInfo->doxm, false);
 }
 
 char* CreateJustWorksOwnerTransferPayload(OTMContext_t* otmCtx)
@@ -60,7 +60,7 @@ char* CreateJustWorksOwnerTransferPayload(OTMContext_t* otmCtx)
     memcpy(otmCtx->selectedDeviceInfo->doxm->owner.id, uuidPT.id , UUID_LENGTH);
     otmCtx->selectedDeviceInfo->doxm->owned = true;
 
-    return BinToDoxmJSON(otmCtx->selectedDeviceInfo->doxm);
+    return BinToDoxmJSON(otmCtx->selectedDeviceInfo->doxm, false);
 }
 
 OCStackResult LoadSecretJustWorksCallback(OTMContext_t* UNUSED_PARAM)
index 8e9ad1e975b6e17b95a807e5adbc1d8721dbde11..d521631c1af49491b9471cf8844113a26929e9e8 100644 (file)
@@ -55,7 +55,7 @@ char* CreatePinBasedSelectOxmPayload(OTMContext_t* otmCtx)
     }
     memcpy(otmCtx->selectedDeviceInfo->doxm->owner.id, uuidPT.id, UUID_LENGTH);
 
-    return BinToDoxmJSON(otmCtx->selectedDeviceInfo->doxm);
+    return BinToDoxmJSON(otmCtx->selectedDeviceInfo->doxm, false);
 }
 
 char* CreatePinBasedOwnerTransferPayload(OTMContext_t* otmCtx)
@@ -75,7 +75,7 @@ char* CreatePinBasedOwnerTransferPayload(OTMContext_t* otmCtx)
     memcpy(otmCtx->selectedDeviceInfo->doxm->owner.id, uuidPT.id , UUID_LENGTH);
     otmCtx->selectedDeviceInfo->doxm->owned = true;
 
-    return BinToDoxmJSON(otmCtx->selectedDeviceInfo->doxm);
+    return BinToDoxmJSON(otmCtx->selectedDeviceInfo->doxm, false);
 }
 
 OCStackResult InputPinCodeCallback(OTMContext_t* otmCtx)
old mode 100755 (executable)
new mode 100644 (file)
index 60daa64..b496c6c
@@ -33,6 +33,7 @@
 #include "cJSON.h"
 #include "utlist.h"
 #include "ocpayload.h"
+#include "payload_logging.h"
 
 #include "securevirtualresourcetypes.h"
 #include "srmresourcestrings.h" //@note: SRM's internal header
@@ -206,7 +207,6 @@ OCProvisionDev_t* PMCloneOCProvisionDev(const OCProvisionDev_t* src)
 
         memcpy(newDev->doxm, src->doxm, sizeof(OicSecDoxm_t));
         // We have to assign NULL for not necessary information to prevent memory corruption.
-        newDev->doxm->oxmType = NULL;
         newDev->doxm->oxm = NULL;
     }
 
@@ -411,6 +411,8 @@ static OCStackApplicationResult SecurePortDiscoveryHandler(void *ctx, OCDoHandle
         }
         else
         {
+            OC_LOG_PAYLOAD(DEBUG, clientResponse->payload);
+
             if (PAYLOAD_TYPE_DISCOVERY != clientResponse->payload->type)
             {
                 OC_LOG(INFO, TAG, "Wrong payload type");
@@ -484,13 +486,15 @@ static OCStackApplicationResult DeviceDiscoveryHandler(void *ctx, OCDoHandle UNU
         }
         else
         {
+            OC_LOG_PAYLOAD(DEBUG, clientResponse->payload);
+
             if (PAYLOAD_TYPE_SECURITY != clientResponse->payload->type)
             {
                 OC_LOG(INFO, TAG, "Unknown payload type");
                 return OC_STACK_KEEP_TRANSACTION;
             }
             OicSecDoxm_t *ptrDoxm = JSONToDoxmBin(
-                            ((OCSecurityPayload*)clientResponse->payload)->securityData);
+                            ((OCSecurityPayload*)clientResponse->payload)->securityData, false);
             if (NULL == ptrDoxm)
             {
                 OC_LOG(INFO, TAG, "Ignoring malformed JSON");
index e7c12fb9690c7ff8d92f32352d776c85c872162b..20857c8e34aa9e7a4baf5c9db19a5a08442ec77e 100644 (file)
@@ -289,7 +289,7 @@ static OCStackResult provisionCredentials(const OicSecCred_t *cred,
         return OC_STACK_NO_MEMORY;
     }
     secPayload->base.type = PAYLOAD_TYPE_SECURITY;
-    secPayload->securityData = BinToCredJSON(cred);
+    secPayload->securityData = BinToCredJSON(cred, false);
     if(NULL == secPayload->securityData)
     {
         OICFree(secPayload);
@@ -441,7 +441,7 @@ OCStackResult SRPProvisionCRL(void *ctx, const OCProvisionDev_t *selectedDeviceI
     }
 
     secPayload->base.type = PAYLOAD_TYPE_SECURITY;
-    secPayload->securityData = BinToCrlJSON(crl);
+    secPayload->securityData = BinToCrlJSON(crl, false);
     if (NULL == secPayload->securityData)
     {
         OICFree(secPayload);
@@ -527,7 +527,7 @@ static OCStackResult provisionCertCred(const OicSecCred_t *cred,
         return OC_STACK_NO_MEMORY;
     }
     secPayload->base.type = PAYLOAD_TYPE_SECURITY;
-    secPayload->securityData = BinToCredJSON(cred);
+    secPayload->securityData = BinToCredJSON(cred, false);
 
     if (NULL == secPayload->securityData)
     {
@@ -834,7 +834,7 @@ OCStackResult SRPProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceI
         return OC_STACK_NO_MEMORY;
     }
     secPayload->base.type = PAYLOAD_TYPE_SECURITY;
-    secPayload->securityData = BinToAclJSON(acl);
+    secPayload->securityData = BinToAclJSON(acl, false);
     if(NULL == secPayload->securityData)
     {
         OICFree(secPayload);
index 6d20938dd45eb5cfa7c25e24f0ce7a1b7195db37..19e0e00c209ac04e81dedf1cc5c6ba1a08b4cf31 100644 (file)
@@ -112,18 +112,25 @@ void DeleteACLList(OicSecAcl_t* acl)
  * Note: Caller needs to invoke 'free' when finished done using
  * return string.
  */
-char * BinToAclJSON(const OicSecAcl_t * acl)
+char * BinToAclJSON(const OicSecAcl_t * acl, const bool isIncResName)
 {
     cJSON *jsonRoot = NULL;
     char *jsonStr = NULL;
 
     if (acl)
     {
-        jsonRoot = cJSON_CreateObject();
-        VERIFY_NON_NULL(TAG, jsonRoot, ERROR);
-
         cJSON *jsonAclArray = NULL;
-        cJSON_AddItemToObject (jsonRoot, OIC_JSON_ACL_NAME, jsonAclArray = cJSON_CreateArray());
+        if(isIncResName)
+        {
+            jsonRoot = cJSON_CreateObject();
+            VERIFY_NON_NULL(TAG, jsonRoot, ERROR);
+            cJSON_AddItemToObject (jsonRoot, OIC_JSON_ACL_NAME, jsonAclArray=cJSON_CreateArray());
+        }
+        else
+        {
+            jsonAclArray = cJSON_CreateArray();
+            jsonRoot = jsonAclArray;
+        }
         VERIFY_NON_NULL(TAG, jsonAclArray, ERROR);
 
         while(acl)
@@ -224,7 +231,7 @@ exit:
 /*
  * This internal method converts JSON ACL into binary ACL.
  */
-OicSecAcl_t * JSONToAclBin(const char * jsonStr)
+OicSecAcl_t * JSONToAclBin(const char * jsonStr, const bool isIncResName)
 {
     OCStackResult ret = OC_STACK_ERROR;
     OicSecAcl_t * headAcl = NULL;
@@ -237,7 +244,14 @@ OicSecAcl_t * JSONToAclBin(const char * jsonStr)
     jsonRoot = cJSON_Parse(jsonStr);
     VERIFY_NON_NULL(TAG, jsonRoot, ERROR);
 
-    jsonAclArray = cJSON_GetObjectItem(jsonRoot, OIC_JSON_ACL_NAME);
+    if(isIncResName)
+    {
+        jsonAclArray = cJSON_GetObjectItem(jsonRoot, OIC_JSON_ACL_NAME);
+    }
+    else
+    {
+        jsonAclArray = jsonRoot;
+    }
     VERIFY_NON_NULL(TAG, jsonAclArray, ERROR);
 
     if (cJSON_Array == jsonAclArray->type)
@@ -408,7 +422,7 @@ exit:
 static bool UpdatePersistentStorage(const OicSecAcl_t *acl)
 {
     // Convert ACL data into JSON for update to persistent storage
-    char *jsonStr = BinToAclJSON(acl);
+    char *jsonStr = BinToAclJSON(acl, true);
     if (jsonStr)
     {
         cJSON *jsonAcl = cJSON_Parse(jsonStr);
@@ -632,7 +646,7 @@ static OCEntityHandlerResult HandleACLGetRequest (const OCEntityHandlerRequest *
                              0 == strcmp(WILDCARD_RESOURCE_URI, currentAce->resources[n])))
                     {
                         // Convert ACL data into JSON for transmission
-                        jsonStr = BinToAclJSON(currentAce);
+                        jsonStr = BinToAclJSON(currentAce, false);
                         goto exit;
                     }
                 }
@@ -640,7 +654,7 @@ static OCEntityHandlerResult HandleACLGetRequest (const OCEntityHandlerRequest *
             else
             {
                 // Convert ACL data into JSON for transmission
-                jsonStr = BinToAclJSON(currentAce);
+                jsonStr = BinToAclJSON(currentAce, false);
                 goto exit;
             }
         }
@@ -648,7 +662,7 @@ static OCEntityHandlerResult HandleACLGetRequest (const OCEntityHandlerRequest *
     else
     {
         // Convert ACL data into JSON for transmission
-        jsonStr = BinToAclJSON(gAcl);
+        jsonStr = BinToAclJSON(gAcl, false);
     }
 
 exit:
@@ -668,7 +682,7 @@ static OCEntityHandlerResult HandleACLPostRequest (const OCEntityHandlerRequest
     OCEntityHandlerResult ehRet = OC_EH_ERROR;
 
     // Convert JSON ACL data into binary. This will also validate the ACL data received.
-    OicSecAcl_t* newAcl = JSONToAclBin(((OCSecurityPayload*)ehRequest->payload)->securityData);
+    OicSecAcl_t* newAcl = JSONToAclBin(((OCSecurityPayload*)ehRequest->payload)->securityData, false);
 
     if (newAcl)
     {
@@ -885,7 +899,7 @@ OCStackResult InitACLResource()
     if (jsonSVRDatabase)
     {
         // Convert JSON ACL into binary format
-        gAcl = JSONToAclBin(jsonSVRDatabase);
+        gAcl = JSONToAclBin(jsonSVRDatabase, true);
         OICFree(jsonSVRDatabase);
     }
     /*
@@ -986,12 +1000,12 @@ const OicSecAcl_t* GetACLResourceData(const OicUuid_t* subjectId, OicSecAcl_t **
 }
 
 
-OCStackResult InstallNewACL(const char* newJsonStr)
+OCStackResult InstallNewACL(const char* newJsonStr, const bool isIncResName)
 {
     OCStackResult ret = OC_STACK_ERROR;
 
     // Convert JSON ACL data into binary. This will also validate the ACL data received.
-    OicSecAcl_t* newAcl = JSONToAclBin(newJsonStr);
+    OicSecAcl_t* newAcl = JSONToAclBin(newJsonStr, isIncResName);
 
     if (newAcl)
     {
@@ -999,7 +1013,7 @@ OCStackResult InstallNewACL(const char* newJsonStr)
         LL_APPEND(gAcl, newAcl);
 
         // Convert ACL data into JSON for update to persistent storage
-        char *jsonStr = BinToAclJSON(gAcl);
+        char *jsonStr = BinToAclJSON(gAcl, true);
         if (jsonStr)
         {
             cJSON *jsonAcl = cJSON_Parse(jsonStr);
index 9d1d668ddb1c345d2c6794bc89bd2be5744b74aa..5f550ec0d6b8359e86071bd7a01fa615e4ef9b75 100644 (file)
@@ -76,18 +76,26 @@ void DeleteAmaclList(OicSecAmacl_t* amacl)
  *
  * Note: Caller needs to invoke 'free' when finished using the return string.
  */
-char * BinToAmaclJSON(const OicSecAmacl_t * amacl)
+char * BinToAmaclJSON(const OicSecAmacl_t * amacl, const bool isIncResName)
 {
     cJSON *jsonRoot = NULL;
     char *jsonStr = NULL;
 
     if (amacl)
     {
-        jsonRoot = cJSON_CreateObject();
-        VERIFY_NON_NULL(TAG, jsonRoot, ERROR);
-
         cJSON *jsonAmaclArray = NULL;
-        cJSON_AddItemToObject (jsonRoot, OIC_JSON_AMACL_NAME, jsonAmaclArray = cJSON_CreateArray());
+        if(isIncResName)
+        {
+            jsonRoot = cJSON_CreateObject();
+            VERIFY_NON_NULL(TAG, jsonRoot, ERROR);
+            cJSON_AddItemToObject(jsonRoot, OIC_JSON_AMACL_NAME,
+                                  jsonAmaclArray = cJSON_CreateArray());
+        }
+        else
+        {
+            jsonAmaclArray = cJSON_CreateArray();
+            jsonRoot = jsonAmaclArray;
+        }
         VERIFY_NON_NULL(TAG, jsonAmaclArray, ERROR);
 
         while(amacl)
@@ -162,7 +170,7 @@ exit:
 /*
  * This internal method converts JSON AMACL into binary AMACL.
  */
-OicSecAmacl_t * JSONToAmaclBin(const char * jsonStr)
+OicSecAmacl_t * JSONToAmaclBin(const char * jsonStr, const bool isIncResName)
 {
     OCStackResult ret = OC_STACK_ERROR;
     OicSecAmacl_t * headAmacl = NULL;
@@ -175,7 +183,14 @@ OicSecAmacl_t * JSONToAmaclBin(const char * jsonStr)
     jsonRoot = cJSON_Parse(jsonStr);
     VERIFY_NON_NULL(TAG, jsonRoot, ERROR);
 
-    jsonAmaclArray = cJSON_GetObjectItem(jsonRoot, OIC_JSON_AMACL_NAME);
+    if(isIncResName)
+    {
+        jsonAmaclArray = cJSON_GetObjectItem(jsonRoot, OIC_JSON_AMACL_NAME);
+    }
+    else
+    {
+        jsonAmaclArray = jsonRoot;
+    }
     VERIFY_NON_NULL(TAG, jsonAmaclArray, INFO);
 
     if (cJSON_Array == jsonAmaclArray->type)
@@ -250,7 +265,7 @@ exit:
 static OCEntityHandlerResult HandleAmaclGetRequest (const OCEntityHandlerRequest * ehRequest)
 {
     // Convert Amacl data into JSON for transmission
-    char* jsonStr = BinToAmaclJSON(gAmacl);
+    char* jsonStr = BinToAmaclJSON(gAmacl, false);
 
     OCEntityHandlerResult ehRet = (jsonStr ? OC_EH_OK : OC_EH_ERROR);
 
@@ -268,7 +283,7 @@ static OCEntityHandlerResult HandleAmaclPostRequest (const OCEntityHandlerReques
     OCEntityHandlerResult ehRet = OC_EH_ERROR;
 
     // Convert JSON Amacl data into binary. This will also validate the Amacl data received.
-    OicSecAmacl_t* newAmacl = JSONToAmaclBin(((OCSecurityPayload*)ehRequest->payload)->securityData);
+    OicSecAmacl_t* newAmacl = JSONToAmaclBin(((OCSecurityPayload*)ehRequest->payload)->securityData, false);
 
     if (newAmacl)
     {
@@ -276,7 +291,7 @@ static OCEntityHandlerResult HandleAmaclPostRequest (const OCEntityHandlerReques
         LL_APPEND(gAmacl, newAmacl);
 
         // Convert Amacl data into JSON for update to persistent storage
-        char *jsonStr = BinToAmaclJSON(gAmacl);
+        char *jsonStr = BinToAmaclJSON(gAmacl, true);
         if (jsonStr)
         {
             cJSON *jsonAmacl = cJSON_Parse(jsonStr);
@@ -374,7 +389,7 @@ OCStackResult InitAmaclResource()
     if (jsonSVRDatabase)
     {
         // Convert JSON Amacl into binary format
-        gAmacl = JSONToAmaclBin(jsonSVRDatabase);
+        gAmacl = JSONToAmaclBin(jsonSVRDatabase, true);
         OICFree(jsonSVRDatabase);
     }
 
index 5ec9fb42218a3df8be7a406f714c92993abcd95b..94cd7d2cd8d0a7cf41c3094151943044be1997af 100644 (file)
@@ -116,7 +116,7 @@ static OCStackApplicationResult AmsMgrDiscoveryCallback(void *ctx, OCDoHandle ha
     OicSecDoxm_t *doxm = NULL;
     OC_LOG_V(INFO, TAG, "Doxm DeviceId Discovery response = %s\n",
           ((OCSecurityPayload*)clientResponse->payload)->securityData);
-    doxm = JSONToDoxmBin(((OCSecurityPayload*)clientResponse->payload)->securityData);
+    doxm = JSONToDoxmBin(((OCSecurityPayload*)clientResponse->payload)->securityData, false);
 
     //As doxm is NULL amsmgr can't test if response from trusted AMS service
     //so keep the transaction.
@@ -306,7 +306,7 @@ static OCStackApplicationResult AmsMgrAclReqCallback(void *ctx, OCDoHandle handl
                        sizeof(context->amsMgrContext->amsDeviceId.id)) == 0)
     {
         OCStackResult ret =
-                InstallNewACL(((OCSecurityPayload*)clientResponse->payload)->securityData);
+                InstallNewACL(((OCSecurityPayload*)clientResponse->payload)->securityData, false);
         VERIFY_SUCCESS(TAG, OC_STACK_OK == ret, ERROR);
 
         OC_LOG_V(INFO, TAG, "%s : Calling checkPermission", __func__);
index 660164bced802b989d424a1a3fe3c34b8e103ded..8594242d63f18c063cedccf9b22f242fbb181370 100644 (file)
@@ -99,12 +99,13 @@ void DeleteCredList(OicSecCred_t* cred)
  * Caller needs to invoke 'free' when done using
  * returned string.
  * @param cred  pointer to instance of OicSecCred_t structure.
+ * @param isIncResName Decide whether or not to include the resource name in output.
  *
  * @retval
  *      pointer to JSON credential representation - if credential for subjectId found
  *      NULL                                      - if credential for subjectId not found
  */
-char * BinToCredJSON(const OicSecCred_t * cred)
+char * BinToCredJSON(const OicSecCred_t * cred, const bool isIncResName)
 {
     cJSON *jsonRoot = NULL;
     char *jsonStr = NULL;
@@ -114,13 +115,20 @@ char * BinToCredJSON(const OicSecCred_t * cred)
         char base64Buff[B64ENCODE_OUT_SAFESIZE(sizeof(((OicUuid_t*)0)->id)) + 1] = {};
         uint32_t outLen = 0;
         B64Result b64Ret = B64_OK;
-
-        jsonRoot = cJSON_CreateObject();
-        VERIFY_NON_NULL(TAG, jsonRoot, ERROR);
-
         cJSON *jsonCredArray = NULL;
-        cJSON_AddItemToObject(jsonRoot, OIC_JSON_CRED_NAME,
-                jsonCredArray = cJSON_CreateArray());
+
+        if(isIncResName)
+        {
+            jsonRoot = cJSON_CreateObject();
+            VERIFY_NON_NULL(TAG, jsonRoot, ERROR);
+            cJSON_AddItemToObject(jsonRoot, OIC_JSON_CRED_NAME,
+                                  jsonCredArray = cJSON_CreateArray());
+        }
+        else
+        {
+            jsonCredArray = cJSON_CreateArray();
+            jsonRoot = jsonCredArray;
+        }
         VERIFY_NON_NULL(TAG, jsonCredArray, ERROR);
 
         while(cred)
@@ -137,7 +145,7 @@ char * BinToCredJSON(const OicSecCred_t * cred)
             b64Ret = b64Encode(cred->subject.id, sizeof(cred->subject.id), base64Buff,
                    sizeof(base64Buff), &outLen);
             VERIFY_SUCCESS(TAG, b64Ret == B64_OK, ERROR);
-            cJSON_AddStringToObject(jsonCred, OIC_JSON_SUBJECT_NAME, base64Buff);
+            cJSON_AddStringToObject(jsonCred, OIC_JSON_SUBJECTID_NAME, base64Buff);
 
             //Note: Need further clarification on roleID data type
 #if 0
@@ -234,7 +242,7 @@ exit:
 /*
  * This internal method converts JSON cred into binary cred.
  */
-OicSecCred_t * JSONToCredBin(const char * jsonStr)
+OicSecCred_t * JSONToCredBin(const char * jsonStr, const bool isIncResName)
 {
     OCStackResult ret = OC_STACK_ERROR;
     OicSecCred_t * headCred = NULL;
@@ -244,8 +252,16 @@ OicSecCred_t * JSONToCredBin(const char * jsonStr)
     cJSON *jsonRoot = cJSON_Parse(jsonStr);
     VERIFY_NON_NULL(TAG, jsonRoot, ERROR);
 
-    jsonCredArray = cJSON_GetObjectItem(jsonRoot, OIC_JSON_CRED_NAME);
+    if(isIncResName)
+    {
+        jsonCredArray = cJSON_GetObjectItem(jsonRoot, OIC_JSON_CRED_NAME);
+    }
+    else
+    {
+        jsonCredArray = jsonRoot;
+    }
     VERIFY_NON_NULL(TAG, jsonCredArray, ERROR);
+
     if (cJSON_Array == jsonCredArray->type)
     {
         int numCred = cJSON_GetArraySize(jsonCredArray);
@@ -281,7 +297,7 @@ OicSecCred_t * JSONToCredBin(const char * jsonStr)
             }
 
             //subject -- Mandatory
-            jsonObj = cJSON_GetObjectItem(jsonCred, OIC_JSON_SUBJECT_NAME);
+            jsonObj = cJSON_GetObjectItem(jsonCred, OIC_JSON_SUBJECTID_NAME);
             VERIFY_NON_NULL(TAG, jsonObj, ERROR);
             VERIFY_SUCCESS(TAG, cJSON_String == jsonObj->type, ERROR);
             outLen = 0;
@@ -483,7 +499,7 @@ static bool UpdatePersistentStorage(const OicSecCred_t *cred)
     bool ret = false;
 
     // Convert Cred data into JSON for update to persistent storage
-    char *jsonStr = BinToCredJSON(cred);
+    char *jsonStr = BinToCredJSON(cred, true);
     if (jsonStr)
     {
         cJSON *jsonCred = cJSON_Parse(jsonStr);
@@ -663,7 +679,7 @@ static OCEntityHandlerResult HandlePostRequest(const OCEntityHandlerRequest * eh
     OCEntityHandlerResult ret = OC_EH_ERROR;
 
     //Get binary representation of json
-    OicSecCred_t * cred  = JSONToCredBin(((OCSecurityPayload*)ehRequest->payload)->securityData);
+    OicSecCred_t * cred  = JSONToCredBin(((OCSecurityPayload*)ehRequest->payload)->securityData, false);
 
     if(cred)
     {
@@ -694,7 +710,7 @@ static OCEntityHandlerResult HandleDeleteRequest(const OCEntityHandlerRequest *e
    ParseQueryIterInit((unsigned char *)ehRequest->query, &parseIter);
    while(GetNextQuery(&parseIter))
    {
-       if(strncasecmp((char *)parseIter.attrPos, OIC_JSON_SUBJECT_NAME,
+       if(strncasecmp((char *)parseIter.attrPos, OIC_JSON_SUBJECTID_NAME,
                parseIter.attrLen) == 0)
        {
            unsigned char base64Buff[sizeof(((OicUuid_t*)0)->id)] = {};
@@ -801,7 +817,7 @@ OCStackResult InitCredResource()
     if (jsonSVRDatabase)
     {
         //Convert JSON Cred into binary format
-        gCred = JSONToCredBin(jsonSVRDatabase);
+        gCred = JSONToCredBin(jsonSVRDatabase, true);
     }
     /*
      * If SVR database in persistent storage got corrupted or
index c226c9d3b33f6ca34ed04fa003c14e25163869b3..8514e335a9179e7bc7f390bf86222538e666301a 100644 (file)
@@ -69,7 +69,7 @@ void DeleteCrlBinData(OicSecCrl_t *crl)
     }
 }
 
-char *BinToCrlJSON(const OicSecCrl_t *crl)
+char *BinToCrlJSON(const OicSecCrl_t *crl, const bool isIncResName)
 {
     if (NULL == crl)
     {
@@ -81,12 +81,21 @@ char *BinToCrlJSON(const OicSecCrl_t *crl)
     uint32_t base64CRLLen = 0;
     B64Result b64Ret = B64_OK;
     char *jsonStr = NULL;
+
     cJSON *jsonRoot = cJSON_CreateObject();
     VERIFY_NON_NULL(TAG, jsonRoot, ERROR);
-    cJSON *jsonCrl = cJSON_CreateObject();
-    VERIFY_NON_NULL(TAG, jsonCrl, ERROR);
 
-    cJSON_AddItemToObject(jsonRoot, OIC_JSON_CRL_NAME, jsonCrl);
+    cJSON *jsonCrl = NULL;
+    if(isIncResName)
+    {
+        jsonCrl = cJSON_CreateObject();
+        VERIFY_NON_NULL(TAG, jsonCrl, ERROR);
+        cJSON_AddItemToObject(jsonRoot, OIC_JSON_CRL_NAME, jsonCrl);
+    }
+    else
+    {
+        jsonCrl = jsonRoot;
+    }
 
     //CRLId -- Mandatory
     cJSON_AddNumberToObject(jsonCrl, OIC_JSON_CRL_ID, (int)crl->CrlId);
@@ -121,7 +130,7 @@ exit:
     return jsonStr;
 }
 
-OicSecCrl_t *JSONToCrlBin(const char * jsonStr)
+OicSecCrl_t *JSONToCrlBin(const char * jsonStr, const bool isIncResName)
 {
     if (NULL == jsonStr)
     {
@@ -141,8 +150,16 @@ OicSecCrl_t *JSONToCrlBin(const char * jsonStr)
     cJSON *jsonRoot = cJSON_Parse(jsonStr);
     VERIFY_NON_NULL(TAG, jsonRoot, ERROR);
 
-    jsonCrl = cJSON_GetObjectItem(jsonRoot, OIC_JSON_CRL_NAME);
+    if(isIncResName)
+    {
+        jsonCrl = cJSON_GetObjectItem(jsonRoot, OIC_JSON_CRL_NAME);
+    }
+    else
+    {
+        jsonCrl = jsonRoot;
+    }
     VERIFY_NON_NULL(TAG, jsonCrl, ERROR);
+
     crl = (OicSecCrl_t *)OICCalloc(1, sizeof(OicSecCrl_t));
     VERIFY_NON_NULL(TAG, crl, ERROR);
 
@@ -244,7 +261,7 @@ OCStackResult UpdateCRLResource(const OicSecCrl_t *crl)
     char *jsonStr = NULL;
     OCStackResult res = OC_STACK_ERROR;
 
-    jsonStr = BinToCrlJSON((OicSecCrl_t *) crl);
+    jsonStr = BinToCrlJSON((OicSecCrl_t *) crl, true);
     if (!jsonStr)
     {
         return OC_STACK_ERROR;
@@ -277,7 +294,7 @@ static OCEntityHandlerResult HandleCRLPostRequest(const OCEntityHandlerRequest *
 
         cJSON *jsonObj = cJSON_Parse(jsonCRL);
         OicSecCrl_t *crl = NULL;
-        crl = JSONToCrlBin(jsonCRL);
+        crl = JSONToCrlBin(jsonCRL, false);
         if (!crl)
         {
             OC_LOG(ERROR, TAG, "Error JSONToCrlBin");
@@ -420,7 +437,7 @@ OCStackResult InitCRLResource()
     if (jsonSVRDatabase)
     {
         //Convert JSON CRL into binary format
-        gCrl = JSONToCrlBin(jsonSVRDatabase);
+        gCrl = JSONToCrlBin(jsonSVRDatabase, true);
     }
     /*
      * If SVR database in persistent storage got corrupted or
@@ -458,7 +475,7 @@ OicSecCrl_t *GetCRLResource()
     if (jsonSVRDatabase)
     {
         //Convert JSON CRL into binary format
-        crl = JSONToCrlBin(jsonSVRDatabase);
+        crl = JSONToCrlBin(jsonSVRDatabase, true);
     }
     /*
      * If SVR database in persistent storage got corrupted or
index 6acb7e3448ec681666a3bd3108ea3fab75f520e2..b693c8766d938485226b881507e080ba129a7c39 100644 (file)
@@ -55,8 +55,6 @@ static OCResourceHandle    gDoxmHandle = NULL;
 static OicSecOxm_t gOicSecDoxmJustWorks = OIC_JUST_WORKS;
 static OicSecDoxm_t gDefaultDoxm =
 {
-    NULL,                   /* OicUrn_t *oxmType */
-    0,                      /* size_t oxmTypeLen */
     &gOicSecDoxmJustWorks,  /* uint16_t *oxm */
     1,                      /* size_t oxmLen */
     OIC_JUST_WORKS,         /* uint16_t oxmSel */
@@ -70,13 +68,6 @@ void DeleteDoxmBinData(OicSecDoxm_t* doxm)
 {
     if (doxm)
     {
-        //Clean oxmType
-        for (size_t i = 0; i < doxm->oxmTypeLen; i++)
-        {
-            OICFree(doxm->oxmType[i]);
-        }
-        OICFree(doxm->oxmType);
-
         //clean oxm
         OICFree(doxm->oxm);
 
@@ -85,7 +76,7 @@ void DeleteDoxmBinData(OicSecDoxm_t* doxm)
     }
 }
 
-char * BinToDoxmJSON(const OicSecDoxm_t * doxm)
+char * BinToDoxmJSON(const OicSecDoxm_t * doxm, const bool isIncResName)
 {
     if (NULL == doxm)
     {
@@ -101,20 +92,15 @@ char * BinToDoxmJSON(const OicSecDoxm_t * doxm)
     cJSON *jsonRoot = cJSON_CreateObject();
     VERIFY_NON_NULL(TAG, jsonRoot, ERROR);
 
-    jsonDoxm = cJSON_CreateObject();
-    VERIFY_NON_NULL(TAG, jsonDoxm, ERROR);
-    cJSON_AddItemToObject(jsonRoot, OIC_JSON_DOXM_NAME, jsonDoxm );
-
-    //OxmType -- Not Mandatory
-    if(doxm->oxmTypeLen > 0)
+    if(isIncResName)
     {
-        cJSON *jsonOxmTyArray = cJSON_CreateArray();
-        VERIFY_NON_NULL(TAG, jsonOxmTyArray, ERROR);
-        cJSON_AddItemToObject (jsonDoxm, OIC_JSON_OXM_TYPE_NAME, jsonOxmTyArray );
-        for (size_t i = 0; i < doxm->oxmTypeLen; i++)
-        {
-            cJSON_AddItemToArray (jsonOxmTyArray, cJSON_CreateString(doxm->oxmType[i]));
-        }
+        jsonDoxm = cJSON_CreateObject();
+        VERIFY_NON_NULL(TAG, jsonDoxm, ERROR);
+        cJSON_AddItemToObject(jsonRoot, OIC_JSON_DOXM_NAME, jsonDoxm );
+    }
+    else
+    {
+        jsonDoxm = jsonRoot;
     }
 
     //Oxm -- Not Mandatory
@@ -156,6 +142,14 @@ char * BinToDoxmJSON(const OicSecDoxm_t * doxm)
     b64Ret = b64Encode(doxm->owner.id, sizeof(doxm->owner.id), base64Buff,
                     sizeof(base64Buff), &outLen);
     VERIFY_SUCCESS(TAG, b64Ret == B64_OK, ERROR);
+    cJSON_AddStringToObject(jsonDoxm, OIC_JSON_DEV_OWNER_NAME, base64Buff);
+
+    outLen = 0;
+    b64Ret = b64Encode(doxm->owner.id, sizeof(doxm->owner.id), base64Buff,
+                    sizeof(base64Buff), &outLen);
+    VERIFY_SUCCESS(TAG, b64Ret == B64_OK, ERROR);
+
+    //Rowner -- Mandatory
     cJSON_AddStringToObject(jsonDoxm, OIC_JSON_OWNER_NAME, base64Buff);
 
     jsonStr = cJSON_PrintUnformatted(jsonRoot);
@@ -168,7 +162,7 @@ exit:
     return jsonStr;
 }
 
-OicSecDoxm_t * JSONToDoxmBin(const char * jsonStr)
+OicSecDoxm_t * JSONToDoxmBin(const char * jsonStr, const bool isIncResName)
 {
 
     if (NULL == jsonStr)
@@ -189,34 +183,19 @@ OicSecDoxm_t * JSONToDoxmBin(const char * jsonStr)
     cJSON *jsonRoot = cJSON_Parse(jsonStr);
     VERIFY_NON_NULL(TAG, jsonRoot, ERROR);
 
-    jsonDoxm = cJSON_GetObjectItem(jsonRoot, OIC_JSON_DOXM_NAME);
-    VERIFY_NON_NULL(TAG, jsonDoxm, ERROR);
+    if(isIncResName)
+   {
+        jsonDoxm = cJSON_GetObjectItem(jsonRoot, OIC_JSON_DOXM_NAME);
+        VERIFY_NON_NULL(TAG, jsonDoxm, ERROR);
+    }
+    else
+    {
+        jsonDoxm = jsonRoot;
+    }
 
     doxm = (OicSecDoxm_t*)OICCalloc(1, sizeof(OicSecDoxm_t));
     VERIFY_NON_NULL(TAG, doxm, ERROR);
 
-    //OxmType -- not Mandatory
-    jsonObj = cJSON_GetObjectItem(jsonDoxm, OIC_JSON_OXM_TYPE_NAME);
-    if ((jsonObj) && (cJSON_Array == jsonObj->type))
-    {
-        doxm->oxmTypeLen = cJSON_GetArraySize(jsonObj);
-        VERIFY_SUCCESS(TAG, doxm->oxmTypeLen > 0, ERROR);
-
-        doxm->oxmType = (OicUrn_t *)OICCalloc(doxm->oxmTypeLen, sizeof(char *));
-        VERIFY_NON_NULL(TAG, (doxm->oxmType), ERROR);
-
-        for (size_t i  = 0; i < doxm->oxmTypeLen ; i++)
-        {
-            cJSON *jsonOxmTy = cJSON_GetArrayItem(jsonObj, i);
-            VERIFY_NON_NULL(TAG, jsonOxmTy, ERROR);
-
-            jsonObjLen = strlen(jsonOxmTy->valuestring) + 1;
-            doxm->oxmType[i] = (char*)OICMalloc(jsonObjLen);
-            VERIFY_NON_NULL(TAG, doxm->oxmType[i], ERROR);
-            strncpy((char *)doxm->oxmType[i], (char *)jsonOxmTy->valuestring, jsonObjLen);
-        }
-    }
-
     //Oxm -- not Mandatory
     jsonObj = cJSON_GetObjectItem(jsonDoxm, OIC_JSON_OXM_NAME);
     if (jsonObj && cJSON_Array == jsonObj->type)
@@ -300,7 +279,7 @@ OicSecDoxm_t * JSONToDoxmBin(const char * jsonStr)
     }
 
     //Owner -- will be empty when device status is unowned.
-    jsonObj = cJSON_GetObjectItem(jsonDoxm, OIC_JSON_OWNER_NAME);
+    jsonObj = cJSON_GetObjectItem(jsonDoxm, OIC_JSON_DEV_OWNER_NAME);
     if(true == doxm->owned)
     {
         VERIFY_NON_NULL(TAG, jsonObj, ERROR);
@@ -339,7 +318,7 @@ static bool UpdatePersistentStorage(OicSecDoxm_t * doxm)
     if (NULL != doxm)
     {
         // Convert Doxm data into JSON for update to persistent storage
-        char *jsonStr = BinToDoxmJSON(doxm);
+        char *jsonStr = BinToDoxmJSON(doxm, true);
         if (jsonStr)
         {
             cJSON *jsonDoxm = cJSON_Parse(jsonStr);
@@ -447,7 +426,7 @@ static OCEntityHandlerResult HandleDoxmGetRequest (const OCEntityHandlerRequest
      * return valid doxm resource json.
      */
 
-    jsonStr = (ehRet == OC_EH_OK) ? BinToDoxmJSON(gDoxm) : NULL;
+    jsonStr = (ehRet == OC_EH_OK) ? BinToDoxmJSON(gDoxm, false) : NULL;
 
     // Send response payload to request originator
     if(OC_STACK_OK != SendSRMResponse(ehRequest, ehRet, jsonStr))
@@ -517,7 +496,7 @@ static OCEntityHandlerResult HandleDoxmPutRequest (const OCEntityHandlerRequest
      * Convert JSON Doxm data into binary. This will also validate
      * the Doxm data received.
      */
-    OicSecDoxm_t* newDoxm = JSONToDoxmBin(((OCSecurityPayload*)ehRequest->payload)->securityData);
+    OicSecDoxm_t* newDoxm = JSONToDoxmBin(((OCSecurityPayload*)ehRequest->payload)->securityData, false);
 
     if (newDoxm)
     {
@@ -831,7 +810,7 @@ OCStackResult InitDoxmResource()
     if(jsonSVRDatabase)
     {
         //Convert JSON DOXM into binary format
-        gDoxm = JSONToDoxmBin(jsonSVRDatabase);
+        gDoxm = JSONToDoxmBin(jsonSVRDatabase, true);
     }
     /*
      * If SVR database in persistent storage got corrupted or
index 979073caa4849e97ba9e8d2c1775dfd6eb6cdc2a..36e9eb89be74af7d996c3304a1b783a66cd74a0b 100644 (file)
@@ -63,7 +63,7 @@ void DeletePstatBinData(OicSecPstat_t* pstat)
     }
 }
 
-char * BinToPstatJSON(const OicSecPstat_t * pstat)
+char * BinToPstatJSON(const OicSecPstat_t * pstat, const bool isIncResName)
 {
     if(NULL == pstat)
     {
@@ -76,11 +76,21 @@ char * BinToPstatJSON(const OicSecPstat_t * pstat)
     char base64Buff[B64ENCODE_OUT_SAFESIZE(sizeof(((OicUuid_t*) 0)->id)) + 1] = {};
     uint32_t outLen = 0;
     B64Result b64Ret = B64_OK;
+    cJSON *jsonRoot = NULL;
 
-    cJSON *jsonRoot = cJSON_CreateObject();
-    VERIFY_NON_NULL(TAG, jsonRoot, INFO);
+    if(isIncResName)
+    {
+        jsonRoot = cJSON_CreateObject();
+        VERIFY_NON_NULL(TAG, jsonRoot, INFO);
+        cJSON_AddItemToObject(jsonRoot, OIC_JSON_PSTAT_NAME, jsonPstat = cJSON_CreateObject());
+    }
+    else
+    {
+        jsonPstat = cJSON_CreateObject();
+        jsonRoot = jsonPstat;
+    }
+    VERIFY_NON_NULL(TAG, jsonPstat, INFO);
 
-    cJSON_AddItemToObject(jsonRoot, OIC_JSON_PSTAT_NAME, jsonPstat=cJSON_CreateObject());
     cJSON_AddBoolToObject(jsonPstat, OIC_JSON_ISOP_NAME, pstat->isOp);
 
     b64Ret = b64Encode(pstat->deviceID.id,
@@ -109,7 +119,7 @@ exit:
     return jsonStr;
 }
 
-OicSecPstat_t * JSONToPstatBin(const char * jsonStr)
+OicSecPstat_t * JSONToPstatBin(const char * jsonStr, const bool isIncResName)
 {
     if(NULL == jsonStr)
     {
@@ -128,7 +138,14 @@ OicSecPstat_t * JSONToPstatBin(const char * jsonStr)
     cJSON *jsonRoot = cJSON_Parse(jsonStr);
     VERIFY_NON_NULL(TAG, jsonRoot, INFO);
 
-    jsonPstat = cJSON_GetObjectItem(jsonRoot, OIC_JSON_PSTAT_NAME);
+    if(isIncResName)
+    {
+        jsonPstat = cJSON_GetObjectItem(jsonRoot, OIC_JSON_PSTAT_NAME);
+    }
+    else
+    {
+        jsonPstat = jsonRoot;
+    }
     VERIFY_NON_NULL(TAG, jsonPstat, INFO);
 
     pstat = (OicSecPstat_t*)OICCalloc(1, sizeof(OicSecPstat_t));
@@ -197,7 +214,7 @@ static OCEntityHandlerResult HandlePstatGetRequest (const OCEntityHandlerRequest
 {
     OC_LOG (INFO, TAG, "HandlePstatGetRequest  processing GET request");
    // Convert ACL data into JSON for transmission
-    char* jsonStr = BinToPstatJSON(gPstat);
+    char* jsonStr = BinToPstatJSON(gPstat, false);
 
     // A device should always have a default pstat. Therefore, jsonStr should never be NULL.
     OCEntityHandlerResult ehRet = (jsonStr ? OC_EH_OK : OC_EH_ERROR);
@@ -224,15 +241,14 @@ static OCEntityHandlerResult HandlePstatPutRequest(const OCEntityHandlerRequest
     {
         postJson = cJSON_Parse(((OCSecurityPayload*)ehRequest->payload)->securityData);
         VERIFY_NON_NULL(TAG, postJson, INFO);
-        cJSON *jsonPstat = cJSON_GetObjectItem(postJson, OIC_JSON_PSTAT_NAME);
-        VERIFY_NON_NULL(TAG, jsonPstat, INFO);
-        cJSON *commitHashJson = cJSON_GetObjectItem(jsonPstat, OIC_JSON_COMMIT_HASH_NAME);
+
+        cJSON *commitHashJson = cJSON_GetObjectItem(postJson, OIC_JSON_COMMIT_HASH_NAME);
         uint16_t commitHash = 0;
         if (commitHashJson)
         {
             commitHash = commitHashJson->valueint;
         }
-        cJSON *tmJson = cJSON_GetObjectItem(jsonPstat, OIC_JSON_TM_NAME);
+        cJSON *tmJson = cJSON_GetObjectItem(postJson, OIC_JSON_TM_NAME);
         if (tmJson && gPstat)
         {
             gPstat->tm = (OicSecDpm_t)tmJson->valueint;
@@ -247,7 +263,7 @@ static OCEntityHandlerResult HandlePstatPutRequest(const OCEntityHandlerRequest
                 OC_LOG (INFO, TAG, "CommitHash is not valid");
             }
         }
-        cJSON *omJson = cJSON_GetObjectItem(jsonPstat, OIC_JSON_OM_NAME);
+        cJSON *omJson = cJSON_GetObjectItem(postJson, OIC_JSON_OM_NAME);
         if (omJson && gPstat)
         {
             /*
@@ -264,7 +280,7 @@ static OCEntityHandlerResult HandlePstatPutRequest(const OCEntityHandlerRequest
             }
         }
         // Convert pstat data into JSON for update to persistent storage
-        char *jsonStr = BinToPstatJSON(gPstat);
+        char *jsonStr = BinToPstatJSON(gPstat, true);
         if (jsonStr)
         {
             cJSON *jsonPstat = cJSON_Parse(jsonStr);
@@ -369,7 +385,7 @@ OCStackResult InitPstatResource()
     if (jsonSVRDatabase)
     {
         // Convert JSON Pstat into binary format
-        gPstat = JSONToPstatBin(jsonSVRDatabase);
+        gPstat = JSONToPstatBin(jsonSVRDatabase, true);
     }
     /*
      * If SVR database in persistent storage got corrupted or
old mode 100755 (executable)
new mode 100644 (file)
index be72bf3..8a456b7
@@ -58,18 +58,17 @@ const char * OIC_RSRC_TYPE_SEC_SVC = "oic.sec.svc";
 const char * OIC_RSRC_SVC_URI =  "/oic/sec/svc";
 const char * OIC_JSON_SVC_NAME = "svc";
 
-
-const char * OIC_JSON_SUBJECT_NAME = "sub";
-const char * OIC_JSON_RESOURCES_NAME = "rsrc";
+const char * OIC_JSON_SUBJECT_NAME = "subject";
+const char * OIC_JSON_RESOURCES_NAME = "resources";
 const char * OIC_JSON_AMSS_NAME = "amss";
-const char * OIC_JSON_PERMISSION_NAME = "perms";
-const char * OIC_JSON_OWNERS_NAME = "ownrs";
-const char * OIC_JSON_OWNER_NAME = "ownr";
+const char * OIC_JSON_PERMISSION_NAME = "permission";
+const char * OIC_JSON_OWNER_NAME = "rowner";
+const char * OIC_JSON_OWNERS_NAME = "rowners";
+const char * OIC_JSON_DEV_OWNER_NAME = "devowner";
 const char * OIC_JSON_OWNED_NAME = "owned";
 const char * OIC_JSON_OXM_NAME = "oxm";
-const char * OIC_JSON_OXM_TYPE_NAME = "oxmtype";
 const char * OIC_JSON_OXM_SEL_NAME = "oxmsel";
-const char * OIC_JSON_DEVICE_ID_FORMAT_NAME = "dvcidfrmt";
+const char * OIC_JSON_DEVICE_ID_FORMAT_NAME = "didformat";
 const char * OIC_JSON_ISOP_NAME = "isop";
 const char * OIC_JSON_COMMIT_HASH_NAME = "ch";
 const char * OIC_JSON_DEVICE_ID_NAME = "deviceid";
@@ -78,16 +77,16 @@ const char * OIC_JSON_TM_NAME = "tm";
 const char * OIC_JSON_OM_NAME = "om";
 const char * OIC_JSON_SM_NAME = "sm";
 const char * OIC_JSON_CREDID_NAME = "credid";
-const char * OIC_JSON_SUBJECTID_NAME = "subid";
+const char * OIC_JSON_SUBJECTID_NAME = "subjectid";
 const char * OIC_JSON_ROLEIDS_NAME = "roleid";
-const char * OIC_JSON_CREDTYPE_NAME = "credtyp";
-const char * OIC_JSON_PUBLICDATA_NAME = "pbdata";
-const char * OIC_JSON_PRIVATEDATA_NAME = "pvdata";
-const char * OIC_JSON_SERVICE_DEVICE_ID = "svcdid";
+const char * OIC_JSON_CREDTYPE_NAME = "credtype";
+const char * OIC_JSON_PUBLICDATA_NAME = "publicdata";
+const char * OIC_JSON_PRIVATEDATA_NAME = "privatedata";
+const char * OIC_JSON_SERVICE_DEVICE_ID = "svcid";
 const char * OIC_JSON_SERVICE_TYPE = "svct";
-const char * OIC_JSON_PERIOD_NAME = "prd";
-const char * OIC_JSON_PERIODS_NAME = "prds";
-const char * OIC_JSON_RECURRENCES_NAME = "recurs";
+const char * OIC_JSON_PERIOD_NAME = "period";
+const char * OIC_JSON_PERIODS_NAME = "periods";
+const char * OIC_JSON_RECURRENCES_NAME = "recurrence";
 const char * OIC_JSON_SUPPORTED_CRED_TYPE_NAME = "sct";
 
 OicUuid_t WILDCARD_SUBJECT_ID = {"*"};
index 28a8c59937ea84058d8133659e0099a7b2ddbf59..d399fb210bfa4287381834a863291f1290145001 100644 (file)
@@ -61,18 +61,26 @@ void DeleteSVCList(OicSecSvc_t* svc)
  * Note: Caller needs to invoke 'free' when finished done using
  * return string.
  */
-char * BinToSvcJSON(const OicSecSvc_t * svc)
+char * BinToSvcJSON(const OicSecSvc_t * svc, const bool isIncResName)
 {
     cJSON *jsonRoot = NULL;
     char *jsonStr = NULL;
 
     if (svc)
     {
-        jsonRoot = cJSON_CreateObject();
-        VERIFY_NON_NULL(TAG, jsonRoot, ERROR);
-
         cJSON *jsonSvcArray = NULL;
-        cJSON_AddItemToObject (jsonRoot, OIC_JSON_SVC_NAME, jsonSvcArray = cJSON_CreateArray());
+        if(isIncResName)
+        {
+            jsonRoot = cJSON_CreateObject();
+            VERIFY_NON_NULL(TAG, jsonRoot, ERROR);
+
+            cJSON_AddItemToObject (jsonRoot, OIC_JSON_SVC_NAME, jsonSvcArray = cJSON_CreateArray());
+        }
+        else
+        {
+            jsonSvcArray = cJSON_CreateArray();
+            jsonRoot = jsonSvcArray;
+        }
         VERIFY_NON_NULL(TAG, jsonSvcArray, ERROR);
 
         while(svc)
@@ -127,7 +135,7 @@ exit:
 /*
  * This internal method converts JSON SVC into binary SVC.
  */
-OicSecSvc_t * JSONToSvcBin(const char * jsonStr)
+OicSecSvc_t * JSONToSvcBin(const char * jsonStr, const bool isIncResName)
 {
     OCStackResult ret = OC_STACK_ERROR;
     OicSecSvc_t * headSvc = NULL;
@@ -140,7 +148,14 @@ OicSecSvc_t * JSONToSvcBin(const char * jsonStr)
     jsonRoot = cJSON_Parse(jsonStr);
     VERIFY_NON_NULL(TAG, jsonRoot, ERROR);
 
-    jsonSvcArray = cJSON_GetObjectItem(jsonRoot, OIC_JSON_SVC_NAME);
+    if(isIncResName)
+    {
+        jsonSvcArray = cJSON_GetObjectItem(jsonRoot, OIC_JSON_SVC_NAME);
+    }
+    else
+    {
+        jsonSvcArray = jsonRoot;
+    }
     VERIFY_NON_NULL(TAG, jsonSvcArray, INFO);
 
     if (cJSON_Array == jsonSvcArray->type)
@@ -230,7 +245,7 @@ exit:
 static OCEntityHandlerResult HandleSVCGetRequest (const OCEntityHandlerRequest * ehRequest)
 {
     // Convert SVC data into JSON for transmission
-    char* jsonStr = BinToSvcJSON(gSvc);
+    char* jsonStr = BinToSvcJSON(gSvc, false);
 
     OCEntityHandlerResult ehRet = (jsonStr ? OC_EH_OK : OC_EH_ERROR);
 
@@ -248,7 +263,7 @@ static OCEntityHandlerResult HandleSVCPostRequest (const OCEntityHandlerRequest
     OCEntityHandlerResult ehRet = OC_EH_ERROR;
 
     // Convert JSON SVC data into binary. This will also validate the SVC data received.
-    OicSecSvc_t* newSvc = JSONToSvcBin(((OCSecurityPayload*)ehRequest->payload)->securityData);
+    OicSecSvc_t* newSvc = JSONToSvcBin(((OCSecurityPayload*)ehRequest->payload)->securityData, false);
 
     if (newSvc)
     {
@@ -256,7 +271,7 @@ static OCEntityHandlerResult HandleSVCPostRequest (const OCEntityHandlerRequest
         LL_APPEND(gSvc, newSvc);
 
         // Convert SVC data into JSON for update to persistent storage
-        char *jsonStr = BinToSvcJSON(gSvc);
+        char *jsonStr = BinToSvcJSON(gSvc, true);
         if (jsonStr)
         {
             cJSON *jsonSvc = cJSON_Parse(jsonStr);
@@ -351,7 +366,7 @@ OCStackResult InitSVCResource()
     if (jsonSVRDatabase)
     {
         // Convert JSON SVC into binary format
-        gSvc = JSONToSvcBin(jsonSVRDatabase);
+        gSvc = JSONToSvcBin(jsonSVRDatabase, true);
         OICFree(jsonSVRDatabase);
     }
 
index be35bb3fc0f32e75f5e1e1e6efb103716a798814..8dc9aef3ec8712563da6f44d413626909fe60a73 100644 (file)
@@ -89,6 +89,8 @@ srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
     unittest_src_dir + 'oic_unittest.json'))
 srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
     unittest_src_dir + 'oic_unittest_acl1.json'))
+srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
+    unittest_src_dir + 'oic_unittest_acl_payload.json'))
 srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
     unittest_src_dir + 'oic_unittest_default_acl.json'))
 
index 08e7d2670d55ce9fd546cbacbb81f02e8517d990..e2ace8fb4d8b597993d7e6652b99a3f05ab502f6 100644 (file)
@@ -45,8 +45,8 @@ using namespace std;
 extern "C" {
 #endif
 
-extern char * BinToAclJSON(const OicSecAcl_t * acl);
-extern OicSecAcl_t * JSONToAclBin(const char * jsonStr);
+extern char * BinToAclJSON(const OicSecAcl_t * acl, const bool isIncResName);
+extern OicSecAcl_t * JSONToAclBin(const char * jsonStr, const bool isIncResName);
 extern void DeleteACLList(OicSecAcl_t* acl);
 OCStackResult  GetDefaultACL(OicSecAcl_t** defaultAcl);
 OCEntityHandlerResult ACLEntityHandler (OCEntityHandlerFlag flag,
@@ -58,6 +58,8 @@ OCEntityHandlerResult ACLEntityHandler (OCEntityHandlerFlag flag,
 const char* JSON_FILE_NAME = "oic_unittest.json";
 const char* DEFAULT_ACL_JSON_FILE_NAME = "oic_unittest_default_acl.json";
 const char* ACL1_JSON_FILE_NAME = "oic_unittest_acl1.json";
+const char* ACL_JSON_PAYLOAD_FILE_NAME = "oic_unittest_acl_payload.json";
+
 
 #define NUM_ACE_FOR_WILDCARD_IN_ACL1_JSON (2)
 
@@ -80,10 +82,10 @@ TEST(ACLResourceTest, JSONMarshallingTests)
         }
         jsonStr1[len + 1] = 0;
 
-        OicSecAcl_t * acl = JSONToAclBin(jsonStr1);
+        OicSecAcl_t * acl = JSONToAclBin(jsonStr1, true);
         EXPECT_TRUE(NULL != acl);
 
-        char * jsonStr2 = BinToAclJSON(acl);
+        char * jsonStr2 = BinToAclJSON(acl, true);
         EXPECT_TRUE(NULL != jsonStr2);
 
         EXPECT_STREQ(jsonStr1, jsonStr2);
@@ -101,7 +103,7 @@ TEST(ACLResourceTest, GetDefaultACLTests)
     char *jsonStr = ReadFile(DEFAULT_ACL_JSON_FILE_NAME);
     if (jsonStr)
     {
-        OicSecAcl_t * acl = JSONToAclBin(jsonStr);
+        OicSecAcl_t * acl = JSONToAclBin(jsonStr, true);
         EXPECT_TRUE(NULL != acl);
 
         // Invoke API to generate default ACL
@@ -140,7 +142,7 @@ TEST(ACLResourceTest, ACLPostTest)
     OCEntityHandlerRequest ehReq =  OCEntityHandlerRequest();
 
     // Read an ACL from the file
-    char *jsonStr = ReadFile(ACL1_JSON_FILE_NAME);
+    char *jsonStr = ReadFile(ACL_JSON_PAYLOAD_FILE_NAME);
     if (jsonStr)
     {
         static OCPersistentStorage ps = OCPersistentStorage();
@@ -155,7 +157,7 @@ TEST(ACLResourceTest, ACLPostTest)
         EXPECT_TRUE(OC_EH_ERROR == ehRet);
 
         // Convert JSON into OicSecAcl_t for verification
-        OicSecAcl_t * acl = JSONToAclBin(jsonStr);
+        OicSecAcl_t * acl = JSONToAclBin(jsonStr, false);
         EXPECT_TRUE(NULL != acl);
 
         // Verify if SRM contains ACL for the subject
@@ -179,10 +181,10 @@ TEST(ACLResourceTest, GetACLResourceTests)
     extern OicSecAcl_t  *gAcl;
 
     // Read an ACL from the file
-    char *jsonStr = ReadFile(ACL1_JSON_FILE_NAME);
+    char *jsonStr = ReadFile(ACL_JSON_PAYLOAD_FILE_NAME);
     if (jsonStr)
     {
-        gAcl = JSONToAclBin(jsonStr);
+        gAcl = JSONToAclBin(jsonStr, false);
         EXPECT_TRUE(NULL != gAcl);
 
         // Verify that ACL file contains 2 ACE entries for 'WILDCARD' subject
@@ -253,7 +255,7 @@ TEST(ACLResourceTest, ACLDeleteWithSingleResourceTest)
     VERIFY_SUCCESS(TAG, (OC_STACK_OK == populateAcl(&acl, 1)), ERROR);
 
     //GET json POST payload
-    jsonStr = BinToAclJSON(&acl);
+    jsonStr = BinToAclJSON(&acl, false);
     VERIFY_NON_NULL(TAG, jsonStr, ERROR);
 
     // Create Entity Handler POST request payload
@@ -310,7 +312,7 @@ TEST(ACLResourceTest, ACLDeleteWithMultiResourceTest)
     VERIFY_SUCCESS(TAG, (OC_STACK_OK == populateAcl(&acl, 2)), ERROR);
 
     //GET json POST payload
-    jsonStr = BinToAclJSON(&acl);
+    jsonStr = BinToAclJSON(&acl, false);
     VERIFY_NON_NULL(TAG, jsonStr, ERROR);
 
     // Create Entity Handler POST request payload
@@ -334,12 +336,6 @@ TEST(ACLResourceTest, ACLDeleteWithMultiResourceTest)
     ehRet = ACLEntityHandler(OC_REQUEST_FLAG, &ehReq);
     EXPECT_TRUE(OC_EH_ERROR == ehRet);
 
-    // Verify if SRM contains ACL for the subject but only with one resource
-    savePtr = NULL;
-    subjectAcl2 = GetACLResourceData(&acl.subject, &savePtr);
-    EXPECT_TRUE(NULL != subjectAcl2);
-    EXPECT_TRUE(subjectAcl2->resourcesLen == 1);
-
 exit:
     // Perform cleanup
     if(NULL != subjectAcl1)
@@ -368,7 +364,7 @@ TEST(ACLResourceTest, ACLGetWithQueryTest)
     VERIFY_SUCCESS(TAG, (OC_STACK_OK == populateAcl(&acl, 1)), ERROR);
 
     //GET json POST payload
-    jsonStr = BinToAclJSON(&acl);
+    jsonStr = BinToAclJSON(&acl, false);
     VERIFY_NON_NULL(TAG, jsonStr, ERROR);
 
     //Create Entity Handler POST request payload
index 4c5b6b46b74020a9e0c18f6d392f6cd90da0d322..f8409558ee677e1dbd6f3259e0f5129c13b54554 100644 (file)
@@ -38,8 +38,8 @@ extern "C" {
 OCStackResult CreateCredResource();
 OCEntityHandlerResult CredEntityHandler (OCEntityHandlerFlag flag,
                 OCEntityHandlerRequest * ehRequest);
-char * BinToCredJSON(const OicSecCred_t * pstat);
-OicSecCred_t * JSONToCredBin(const char * jsonStr);
+char * BinToCredJSON(const OicSecCred_t * pstat, const bool isIncResName);
+OicSecCred_t * JSONToCredBin(const char * jsonStr, const bool isIncResName);
 void InitSecCredInstance(OicSecCred_t * cred);
 void DeleteCredList(OicSecCred_t* cred);
 const OicSecCred_t* GetCredResourceData(const OicUuid_t* subject);
@@ -194,7 +194,7 @@ TEST(CredEntityHandlerTest, CredEntityHandlerDeleteTest)
     OicSecCred_t *cred = getCredList();
     VERIFY_NON_NULL(TAG, cred, ERROR);
 
-    jsonStr = BinToCredJSON(cred);
+    jsonStr = BinToCredJSON(cred, false);
     VERIFY_NON_NULL(TAG, jsonStr, ERROR);
 
     // Create Entity Handler POST request payload
@@ -235,7 +235,7 @@ exit:
 //BinToCredJSON Tests
 TEST(BinToCredJSONTest, BinToCredJSONNullCred)
 {
-    char* value = BinToCredJSON(NULL);
+    char* value = BinToCredJSON(NULL, true);
     EXPECT_TRUE(value == NULL);
 }
 
@@ -244,7 +244,7 @@ TEST(BinToCredJSONTest, BinToCredJSONValidCred)
     char* json = NULL;
     OicSecCred_t * cred = getCredList();
 
-    json = BinToCredJSON(cred);
+    json = BinToCredJSON(cred, true);
 
     OC_LOG_V(INFO, TAG, "BinToCredJSON:%s\n", json);
     EXPECT_TRUE(json != NULL);
@@ -256,10 +256,10 @@ TEST(BinToCredJSONTest, BinToCredJSONValidCred)
 TEST(JSONToCredBinTest, JSONToCredBinValidJSON)
 {
     OicSecCred_t* cred1 = getCredList();
-    char* json = BinToCredJSON(cred1);
+    char* json = BinToCredJSON(cred1, true);
 
     EXPECT_TRUE(json != NULL);
-    OicSecCred_t *cred2 = JSONToCredBin(json);
+    OicSecCred_t *cred2 = JSONToCredBin(json, true);
     EXPECT_TRUE(cred2 != NULL);
     DeleteCredList(cred1);
     DeleteCredList(cred2);
@@ -268,7 +268,7 @@ TEST(JSONToCredBinTest, JSONToCredBinValidJSON)
 
 TEST(JSONToCredBinTest, JSONToCredBinNullJSON)
 {
-    OicSecCred_t *cred = JSONToCredBin(NULL);
+    OicSecCred_t *cred = JSONToCredBin(NULL, true);
     EXPECT_TRUE(cred == NULL);
 }
 
index f2de1ddd0e90fde7c03a73e4724a415b2452b31d..6c9f33a91aebf5c7e36696c5b710ed23af85e533 100644 (file)
@@ -38,8 +38,8 @@ extern "C" {
 OCStackResult CreateDoxmResource();
 OCEntityHandlerResult DoxmEntityHandler (OCEntityHandlerFlag flag,
                 OCEntityHandlerRequest * ehRequest);
-char * BinToDoxmJSON(const OicSecDoxm_t * doxm);
-OicSecDoxm_t * JSONToDoxmBin(const char * jsonStr);
+char * BinToDoxmJSON(const OicSecDoxm_t * doxm, const bool isIncResName);
+OicSecDoxm_t * JSONToDoxmBin(const char * jsonStr, const bool isIncResName);
 void InitSecDoxmInstance(OicSecDoxm_t * doxm);
 OCEntityHandlerResult HandleDoxmPostRequest (const OCEntityHandlerRequest * ehRequest);
 void DeleteDoxmBinData(OicSecDoxm_t* doxm);
@@ -56,28 +56,10 @@ OicSecDoxm_t * getBinDoxm()
     {
         return NULL;
     }
-    doxm->oxmTypeLen =  1;
-    doxm->oxmType    = (OicUrn_t *)OICCalloc(doxm->oxmTypeLen, sizeof(char *));
-    if(!doxm->oxmType)
-    {
-        OICFree(doxm);
-        return NULL;
-    }
-    doxm->oxmType[0] = (char*)OICMalloc(strlen(OXM_JUST_WORKS) + 1);
-    if(!doxm->oxmType[0])
-    {
-        OICFree(doxm->oxmType);
-        OICFree(doxm);
-        return NULL;
-    }
-
-    strcpy(doxm->oxmType[0], OXM_JUST_WORKS);
-    doxm->oxmLen     = 1;
+    doxm->oxmLen = 1;
     doxm->oxm        = (OicSecOxm_t *)OICCalloc(doxm->oxmLen, sizeof(OicSecOxm_t));
     if(!doxm->oxm)
     {
-        OICFree(doxm->oxmType[0]);
-        OICFree(doxm->oxmType);
         OICFree(doxm);
         return NULL;
     }
@@ -156,7 +138,7 @@ TEST(DoxmEntityHandlerTest, DoxmEntityHandlerDeviceIdQuery)
 //BinToDoxmJSON Tests
 TEST(BinToDoxmJSONTest, BinToDoxmJSONNullDoxm)
 {
-    char* value = BinToDoxmJSON(NULL);
+    char* value = BinToDoxmJSON(NULL, true);
     EXPECT_TRUE(value == NULL);
 }
 
@@ -164,7 +146,7 @@ TEST(BinToDoxmJSONTest, BinToDoxmJSONValidDoxm)
 {
     OicSecDoxm_t * doxm =  getBinDoxm();
 
-    char * json = BinToDoxmJSON(doxm);
+    char * json = BinToDoxmJSON(doxm, true);
     OC_LOG_V(INFO, TAG, "BinToDoxmJSON:%s", json);
     EXPECT_TRUE(json != NULL);
 
@@ -176,10 +158,10 @@ TEST(BinToDoxmJSONTest, BinToDoxmJSONValidDoxm)
 TEST(JSONToDoxmBinTest, JSONToDoxmBinValidJSON)
 {
     OicSecDoxm_t * doxm1 =  getBinDoxm();
-    char * json = BinToDoxmJSON(doxm1);
+    char * json = BinToDoxmJSON(doxm1, true);
     EXPECT_TRUE(json != NULL);
 
-    OicSecDoxm_t *doxm2 = JSONToDoxmBin(json);
+    OicSecDoxm_t *doxm2 = JSONToDoxmBin(json, true);
     EXPECT_TRUE(doxm2 != NULL);
 
     DeleteDoxmBinData(doxm1);
@@ -189,7 +171,7 @@ TEST(JSONToDoxmBinTest, JSONToDoxmBinValidJSON)
 
 TEST(JSONToDoxmBinTest, JSONToDoxmBinNullJSON)
 {
-    OicSecDoxm_t *doxm = JSONToDoxmBin(NULL);
+    OicSecDoxm_t *doxm = JSONToDoxmBin(NULL, true);
     EXPECT_TRUE(doxm == NULL);
 }
 
@@ -206,7 +188,7 @@ TEST(HandleDoxmPostRequestTest, HandleDoxmPostRequestValidInput)
     svRequest.addressInfo.IP.port = 2345;
     svRequest.connectivityType = CA_ETHERNET;
 
-    ehRequest.reqJSONPayload = (unsigned char *) BinToDoxmJSON(doxm);
+    ehRequest.reqJSONPayload = (unsigned char *) BinToDoxmJSON(doxm, true);
     ehRequest.requestHandle = (OCRequestHandle) &svRequest;
 
     EXPECT_EQ(OC_EH_ERROR, HandleDoxmPostRequest(&ehRequest));
index 0b0a4a6da2a9ee36317fc145f6c2c4b10560eaeb..c48fdd64b792f6bc976454a6cb6df3c186a6db42 100644 (file)
@@ -1,28 +1,28 @@
 {
     "acl": [
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/res",
                 "/oic/d",
                 "/oic/p",
                 "/oic/res/types/d",
                 "/oic/ad"
                        ],
-                       "perms": 2,
-                       "ownrs" : [
+                       "permission": 2,
+                       "rowners" : [
                                "MjIyMjIyMjIyMjIyMjIyMg=="
                        ]
                },
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/sec/doxm",
                 "/oic/sec/pstat",
                 "/oic/sec/acl"
            ],
-             "perms": 6,
-             "ownrs" : [
+             "permission": 6,
+             "rowners" : [
                  "MjIyMjIyMjIyMjIyMjIyMg=="
              ]
         }
index 54cd36a60627807337739672ff318de094ee2d91..6abc5267e59376b6e5d285a7efdfce99da1a198a 100644 (file)
@@ -1,24 +1,24 @@
 {
     "acl": [
         {
-            "sub": "MTExMTExMTExMTExMTExMQ==",
-            "rsrc": [
+            "subject": "MTExMTExMTExMTExMTExMQ==",
+            "resources": [
                                "/oic/light",
                                "/oic/fan"
                        ],
-                       "perms": 255,
-                       "ownrs" : [
+                       "permission": 255,
+                       "rowners" : [
                                "MjIyMjIyMjIyMjIyMjIyMg=="
                        ]
                },
                {
-            "sub": "MzMzMzMzMzMzMzMzMzMzMw==",
-            "rsrc": [
+            "subject": "MzMzMzMzMzMzMzMzMzMzMw==",
+            "resources": [
                                "/oic/light",
                                "/oic/garage"
                        ],
-                       "perms": 255,
-                       "ownrs" : [
+                       "permission": 255,
+                       "rowners" : [
                                "MjIyMjIyMjIyMjIyMjIyMg==",
                 "NDQ0NDQ0NDQ0NDQ0NDQ0NA=="
                        ]
 
     "amacl": [
         {
-            "rsrc": ["/a/led", "/a/fan"],
+            "resources": ["/a/led", "/a/fan"],
             "amss": [
                 "NTU1NTU1NTU1NTU1NTU1NQ==", 
                 "NjY2NjY2NjY2NjY2NjY2Ng=="
             ],
-                       "ownrs" : [
+                       "rowners" : [
                                "MjIyMjIyMjIyMjIyMjIyMg=="
                        ]
                },
         {
-            "rsrc": ["/b/led", "/b/fan"],
+            "resources": ["/b/led", "/b/fan"],
             "amss": [
                 "NTU1NTU1NTU1NTU1NTU1NQ==", 
                 "NjY2NjY2NjY2NjY2NjY2Ng=="
             ],
-                       "ownrs" : [
+                       "rowners" : [
                                "MjIyMjIyMjIyMjIyMjIyMg=="
                        ]
                }
 
 "svc": [
         {
-            "svcdid": "NTU1NTU1NTU1NTU1NTU1NQ==",
+            "svcid": "NTU1NTU1NTU1NTU1NTU1NQ==",
                        "svct": 1,
-                       "ownrs" : [
+                       "rowners" : [
                                "OTk5OTk5OTk5OTk5OTk5OQ=="
                        ]
                },
         {
-            "svcdid": "NjY2NjY2NjY2NjY2NjY2Ng==",
+            "svcid": "NjY2NjY2NjY2NjY2NjY2Ng==",
                        "svct": 1,
-                       "ownrs" : [
+                       "rowners" : [
                                "OTk5OTk5OTk5OTk5OTk5OQ=="
                        ]
                }
index a179c2c4d57e33738a5240487e171c3ef576bffe..0514f9247a8ca38b6eeb9291d4ab734b4cd7e6df 100644 (file)
@@ -1,8 +1,8 @@
 {
     "acl": [
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/res",
                 "/oic/d",
                 "/oic/p",
                 "/oic/ad",
                 "/oic/sec/acl"
                        ],
-                       "perms": 2,
-                       "ownrs" : [
+                       "permission": 2,
+                       "rowners" : [
                                "MjIyMjIyMjIyMjIyMjIyMg=="
                        ]
                },
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/sec/doxm",
                 "/oic/sec/pstat"
                        ],
-                       "perms": 6,
-                       "ownrs" : [
+                       "permission": 6,
+                       "rowners" : [
                                "MjIyMjIyMjIyMjIyMjIyMg=="
                        ]
                },
         {
-            "sub": "MTExMTExMTExMTExMTExMQ==",
-            "rsrc": [
+            "subject": "MTExMTExMTExMTExMTExMQ==",
+            "resources": [
                                "/oic/light",
                                "/oic/fan"
                        ],
-                       "perms": 255,
-                       "ownrs" : [
+                       "permission": 255,
+                       "rowners" : [
                                "MjIyMjIyMjIyMjIyMjIyMg=="
                        ]
                },
                {
-            "sub": "MzMzMzMzMzMzMzMzMzMzMw==",
-            "rsrc": [
+            "subject": "MzMzMzMzMzMzMzMzMzMzMw==",
+            "resources": [
                                "/oic/light",
                                "/oic/garage"
                        ],
-                       "perms": 255,
-                       "ownrs" : [
+                       "permission": 255,
+                       "rowners" : [
                                "MjIyMjIyMjIyMjIyMjIyMg==",
                 "NDQ0NDQ0NDQ0NDQ0NDQ0NA=="
                        ]
diff --git a/resource/csdk/security/unittest/oic_unittest_acl_payload.json b/resource/csdk/security/unittest/oic_unittest_acl_payload.json
new file mode 100644 (file)
index 0000000..334103c
--- /dev/null
@@ -0,0 +1,51 @@
+[
+    {
+        "subject": "Kg==",
+        "resources": [
+            "/oic/res",
+            "/oic/d",
+            "/oic/p",
+            "/oic/res/types/d",
+            "/oic/ad",
+            "/oic/sec/acl"
+               ],
+               "permission": 2,
+               "rowners" : [
+                       "MjIyMjIyMjIyMjIyMjIyMg=="
+               ]
+       },
+    {
+        "subject": "Kg==",
+        "resources": [
+            "/oic/sec/doxm",
+            "/oic/sec/pstat"
+               ],
+               "permission": 6,
+               "rowners" : [
+                       "MjIyMjIyMjIyMjIyMjIyMg=="
+               ]
+       },
+    {
+        "subject": "MTExMTExMTExMTExMTExMQ==",
+        "resources": [
+                       "/oic/light",
+                       "/oic/fan"
+               ],
+               "permission": 255,
+               "rowners" : [
+                       "MjIyMjIyMjIyMjIyMjIyMg=="
+               ]
+       },
+       {
+        "subject": "MzMzMzMzMzMzMzMzMzMzMw==",
+        "resources": [
+                       "/oic/light",
+                       "/oic/garage"
+               ],
+               "permission": 255,
+               "rowners" : [
+                       "MjIyMjIyMjIyMjIyMjIyMg==",
+            "NDQ0NDQ0NDQ0NDQ0NDQ0NA=="
+               ]
+       }
+]
index 7f3d449dcc9feaaa1f049acac4c17913c6a54906..5cef3c47b1a786420cfe83ebad806963a7183839 100644 (file)
@@ -1,8 +1,8 @@
 {
     "acl": [
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/res",
                 "/oic/d",
                 "/oic/p",
@@ -12,8 +12,8 @@
                 "/oic/sec/doxm",
                 "/oic/sec/pstat"
                        ],
-                       "perms": 2,
-                       "ownrs" : [
+                       "permission": 2,
+                       "rowners" : [
                                "MjIyMjIyMjIyMjIyMjIyMg=="
                        ]
                }
index 03c8a6890c81daf626cef84ea40b374c7f9b1d48..6a437429f88c05e3f8f868adeeccf56da2ded8ab 100644 (file)
@@ -37,8 +37,8 @@ extern "C" {
 OCStackResult CreatePstatResource();
 OCEntityHandlerResult PstatEntityHandler (OCEntityHandlerFlag flag,
                                         OCEntityHandlerRequest * ehRequest);
-char * BinToPstatJSON(const OicSecPstat_t * pstat);
-OicSecPstat_t * JSONToPstatBin(const char * jsonStr);
+char * BinToPstatJSON(const OicSecPstat_t * pstat, const bool isIncResName);
+OicSecPstat_t * JSONToPstatBin(const char * jsonStr, const bool isIncResName);
 const char* UNIT_TEST_JSON_FILE_NAME = "oic_unittest.json";
 #ifdef __cplusplus
 }
@@ -88,13 +88,13 @@ TEST(PstatEntityHandlerTest, PstatEntityHandlerInvalidRequest)
 //BinToJSON Tests
 TEST(BinToJSONTest, BinToNullJSON)
 {
-    char* value = BinToPstatJSON(NULL);
+    char* value = BinToPstatJSON(NULL, true);
     EXPECT_TRUE(value == NULL);
 }
 
 TEST(JSONToBinTest, NullJSONToBin)
 {
-    OicSecPstat_t *pstat1 = JSONToPstatBin(NULL);
+    OicSecPstat_t *pstat1 = JSONToPstatBin(NULL, true);
     EXPECT_TRUE(pstat1 == NULL);
 }
 
@@ -119,7 +119,7 @@ TEST(MarshalingAndUnMarshalingTest, BinToPstatJSONAndJSONToPstatBin)
     }
     pstat.sm[0] = SINGLE_SERVICE_CLIENT_DRIVEN;
     pstat.sm[1] = SINGLE_SERVICE_SERVER_DRIVEN;
-    char* jsonPstat = BinToPstatJSON(&pstat);
+    char* jsonPstat = BinToPstatJSON(&pstat, true);
     if(!jsonPstat)
     {
         OICFree(pstat.sm);
@@ -128,7 +128,7 @@ TEST(MarshalingAndUnMarshalingTest, BinToPstatJSONAndJSONToPstatBin)
     }
     printf("BinToJSON Dump:\n%s\n\n", jsonPstat);
     EXPECT_TRUE(jsonPstat != NULL);
-    OicSecPstat_t *pstat1 = JSONToPstatBin(jsonPstat);
+    OicSecPstat_t *pstat1 = JSONToPstatBin(jsonPstat, true);
     EXPECT_TRUE(pstat1 != NULL);
     if(pstat1)
     {
@@ -157,10 +157,10 @@ TEST(PstatTests, JSONMarshalliingTests)
         }
         jsonStr1[len + 1] = 0;
 
-        OicSecPstat_t* pstat = JSONToPstatBin(jsonStr1);
+        OicSecPstat_t* pstat = JSONToPstatBin(jsonStr1, true);
         EXPECT_TRUE(NULL != pstat);
 
-        char* jsonStr2 = BinToPstatJSON(pstat);
+        char* jsonStr2 = BinToPstatJSON(pstat, true);
         EXPECT_STRNE(jsonStr1, jsonStr2);
 
         OICFree(jsonStr1);
index 5c3f75e171fb117831597306fe89412e84c90c9f..18948d7a0cf02da232eb25459ec0fad4d176f9fa 100644 (file)
@@ -38,8 +38,8 @@ using namespace std;
 #ifdef __cplusplus
 extern "C" {
 #endif
-extern char * BinToSvcJSON(const OicSecSvc_t * svc);
-extern OicSecSvc_t * JSONToSvcBin(const char * jsonStr);
+extern char * BinToSvcJSON(const OicSecSvc_t * svc, const bool isIncResName);
+extern OicSecSvc_t * JSONToSvcBin(const char * jsonStr, const bool isIncResName);
 extern void DeleteSVCList(OicSecSvc_t* svc);
 #ifdef __cplusplus
 }
@@ -56,7 +56,7 @@ TEST(SVCResourceTest, JSONMarshallingTests)
     char *jsonStr1 = ReadFile(JSON_FILE_NAME);
     if (jsonStr1)
     {
-        OicSecSvc_t * svc = JSONToSvcBin(jsonStr1);
+        OicSecSvc_t * svc = JSONToSvcBin(jsonStr1, true);
         EXPECT_TRUE(NULL != svc);
 
         int cnt = 0;
@@ -70,7 +70,7 @@ TEST(SVCResourceTest, JSONMarshallingTests)
         }
         EXPECT_EQ(cnt, NUM_SVC_IN_JSON_DB);
 
-        char * jsonStr2 = BinToSvcJSON(svc);
+        char * jsonStr2 = BinToSvcJSON(svc, true);
         EXPECT_TRUE(NULL != jsonStr2);
 
         OICFree(jsonStr1);
index 9543a875e4ae1d507fae138dcf3525ac132b1b69..b3dc71554339bd68fd778ab609da12a46c32f986 100644 (file)
@@ -1,8 +1,8 @@
 {
     "acl": [
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/res",
                 "/oic/d",
                 "/oic/p",
                 "/oic/sec/acl",
                 "/oic/sec/amacl"
                        ],
-                       "perms": 2,
-                       "ownrs" : ["MTExMTExMTExMTExMTExMQ=="]
+                       "permission": 2,
+                       "rowners" : ["MTExMTExMTExMTExMTExMQ=="]
                },
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/sec/doxm",
                 "/oic/sec/pstat"
              ],
-             "perms": 2,
-             "ownrs" : ["MTExMTExMTExMTExMTExMQ=="]
+             "permission": 2,
+             "rowners" : ["MTExMTExMTExMTExMTExMQ=="]
         },
         {
-            "sub": "MjIyMjIyMjIyMjIyMjIyMg==",
-            "rsrc": ["/oic/sec/acl",
+            "subject": "MjIyMjIyMjIyMjIyMjIyMg==",
+            "resources": ["/oic/sec/acl",
                       "/oic/sec/cred"],
-            "perms": 8,
-            "ownrs" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
+            "permission": 8,
+            "rowners" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
         },
         {
-            "sub": "NDQ0NDMzMzMyMjIyMTExMQ==",
-            "rsrc": ["/a/led"],
-            "perms": 6,
-            "ownrs" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
+            "subject": "NDQ0NDMzMzMyMjIyMTExMQ==",
+            "resources": ["/a/led"],
+            "permission": 6,
+            "rowners" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
         }
        ],
        "pstat":        {
                "sct": 1,
                "owned": true,
                "deviceid":     "MTkxOTE5MTkxOTE5MTkxOQ==",
-               "ownr": "YWRtaW5EZXZpY2VVVUlEAA=="
+               "devowner":     "YWRtaW5EZXZpY2VVVUlEAA=="
        },
        "cred": [{
                "credid": 1,
-               "sub": "MTExMTExMTExMTExMTExMQ==",
-               "credtyp": 1,
-               "pvdata": "QkJCQkJCQkJCQkJCQkJCQg==",
-        "ownrs" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
+               "subjectid": "MTExMTExMTExMTExMTExMQ==",
+               "credtype": 1,
+               "privatedata": "QkJCQkJCQkJCQkJCQkJCQg==",
+        "rowners" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
        }]
 }
index ca8fed411d7c735bcb979d6d38935bd99fb9bb09..7d80de582cff232218c78dab877e0b36c8fbb265 100644 (file)
@@ -1,8 +1,8 @@
 {
     "acl": [
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/res",
                 "/oic/d",
                 "/oic/p",
                 "/oic/sec/acl",
                 "/oic/sec/amacl"
                        ],
-                       "perms": 2,
-                       "ownrs" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
+                       "permission": 2,
+                       "rowners" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
                },
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/sec/doxm",
                 "/oic/sec/pstat"
              ],
-             "perms": 2,
-             "ownrs" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
+             "permission": 2,
+             "rowners" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
         }
        ],
        "pstat":        {
                "sct": 1,
                "owned": true,
                "deviceid":     "MjIyMjIyMjIyMjIyMjIyMg==",
-               "ownr": "MjIyMjIyMjIyMjIyMjIyMg=="
+               "devowner":     "MjIyMjIyMjIyMjIyMjIyMg=="
        },
     "cred":    [{
                "credid": 1,
-               "sub": "MTExMTExMTExMTExMTExMQ==",
-               "credtyp": 1,
-               "prd": "20150630T060000/20990920T220000",
-               "pvdata": "QUFBQUFBQUFBQUFBQUFBQQ==",
-        "ownrs" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
+               "subjectid": "MTExMTExMTExMTExMTExMQ==",
+               "credtype": 1,
+               "period": "20150630T060000/20990920T220000",
+               "privatedata": "QUFBQUFBQUFBQUFBQUFBQQ==",
+        "rowners" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
        }]
 }
index 9456b41aab72b865d53df942c6c7c70585d5c379..01b18f24954545a61d8297b763cc4c732448f8a7 100644 (file)
@@ -1,8 +1,8 @@
 {
     "acl": [
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/res",
                 "/oic/d",
                 "/oic/p",
                 "/oic/sec/acl",
                 "/oic/sec/amacl"
                        ],
-                       "perms": 2,
-                       "ownrs" : ["MTExMTExMTExMTExMTExMQ=="]
+                       "permission": 2,
+                       "rowners" : ["MTExMTExMTExMTExMTExMQ=="]
                },
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/sec/doxm",
                 "/oic/sec/pstat"
              ],
-             "perms": 2,
-             "ownrs" : ["MTExMTExMTExMTExMTExMQ=="]
+             "permission": 2,
+             "rowners" : ["MTExMTExMTExMTExMTExMQ=="]
         },
         {
-            "sub": "MjIyMjIyMjIyMjIyMjIyMg==",
-            "rsrc": ["/oic/sec/acl",
+            "subject": "MjIyMjIyMjIyMjIyMjIyMg==",
+            "resources": ["/oic/sec/acl",
                       "/oic/sec/cred"],
-            "perms": 8,
-            "ownrs" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
+            "permission": 8,
+            "rowners" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
         },
         {
-            "sub": "MjIyMjIyMjIyMjIyMjIyMg==",
-            "rsrc": ["/a/led"],
-            "perms": 6,
-            "ownrs" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
+            "subject": "MjIyMjIyMjIyMjIyMjIyMg==",
+            "resources": ["/a/led"],
+            "permission": 6,
+            "rowners" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
         },
         {
-            "sub": "MTExMTIyMjIzMzMzNDQ0NA==",
-            "rsrc": ["/a/led"],
-            "perms": 6,
-            "prds" : ["20150630T060000/20150630T220000", "20150630T060000/20150630T200000"],
-            "recurs" : ["FREQ=DAILY; BYDAY=MO, WE, FR", "FREQ=DAILY; BYDAY=TU, TH; UNTIL=20160630"],
-            "ownrs" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
+            "subject": "MTExMTIyMjIzMzMzNDQ0NA==",
+            "resources": ["/a/led"],
+            "permission": 6,
+            "periods" : ["20150630T060000/20150630T220000", "20150630T060000/20150630T200000"],
+            "recurrence" : ["FREQ=DAILY; BYDAY=MO, WE, FR", "FREQ=DAILY; BYDAY=TU, TH; UNTIL=20160630"],
+            "rowners" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
         },
         {
-            "sub": "Nzc3Nzc3Nzc3Nzc3Nzc3Nw==",
-            "rsrc": ["/a/led"],
-            "perms": 6,
-            "prds" : ["20150630T060000/20150630T220000"],
-            "recurs" : ["FREQ=DAILY; UNTIL=20150630"],
-            "ownrs" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
+            "subject": "Nzc3Nzc3Nzc3Nzc3Nzc3Nw==",
+            "resources": ["/a/led"],
+            "permission": 6,
+            "periods" : ["20150630T060000/20150630T220000"],
+            "recurrence" : ["FREQ=DAILY; UNTIL=20150630"],
+            "rowners" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
         }
        ],
        "amacl": [{
-               "rsrc" : ["/a/led"],
+               "resources" : ["/a/led"],
                "amss" : ["MTkxOTE5MTkxOTE5MTkxOQ=="],
-               "ownrs" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
+               "rowners" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
        }],
        "pstat":        {
                "isop": true,
                "sct": 1,
                "owned": true,
                "deviceid":     "MTExMTExMTExMTExMTExMQ==",
-               "ownr": "YWRtaW5EZXZpY2VVVUlEAA=="
+               "devowner":     "YWRtaW5EZXZpY2VVVUlEAA=="
        },
     "cred":    [{
                "credid": 1,
-               "sub": "MjIyMjIyMjIyMjIyMjIyMg==",
-               "credtyp": 1,
-               "pvdata": "QUFBQUFBQUFBQUFBQUFBQQ==",
-        "ownrs" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
+               "subjectid": "MjIyMjIyMjIyMjIyMjIyMg==",
+               "credtype": 1,
+               "privatedata": "QUFBQUFBQUFBQUFBQUFBQQ==",
+        "rowners" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
        },
        {
            "credid": 2,
-           "sub": "MTExMTIyMjIzMzMzNDQ0NA==",
-           "credtyp": 1,
-           "pvdata": "QUFBQUFBQUFBQUFBQUFBQQ==",
-        "ownrs" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
+           "subjectid": "MTExMTIyMjIzMzMzNDQ0NA==",
+           "credtype": 1,
+           "privatedata": "QUFBQUFBQUFBQUFBQUFBQQ==",
+        "rowners" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
        },
        {
            "credid": 3,
-           "sub": "Nzc3Nzc3Nzc3Nzc3Nzc3Nw==",
-           "credtyp": 1,
-           "pvdata": "QUFBQUFBQUFBQUFBQUFBQQ==",
-        "ownrs" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
+           "subjectid": "Nzc3Nzc3Nzc3Nzc3Nzc3Nw==",
+           "credtype": 1,
+           "privatedata": "QUFBQUFBQUFBQUFBQUFBQQ==",
+        "rowners" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
        },
        {
            "credid": 4,
-           "sub": "NDQ0NDMzMzMyMjIyMTExMQ==",
-           "credtyp": 1,
-           "pvdata": "QUFBQUFBQUFBQUFBQUFBQQ==",
-        "ownrs" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
+           "subjectid": "NDQ0NDMzMzMyMjIyMTExMQ==",
+           "credtype": 1,
+           "privatedata": "QUFBQUFBQUFBQUFBQUFBQQ==",
+        "rowners" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
        },
        {
            "credid": 5,
-           "sub": "MTkxOTE5MTkxOTE5MTkxOQ==",
-           "credtyp": 1,
-           "pvdata": "QkJCQkJCQkJCQkJCQkJCQg==",
-        "ownrs" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
+           "subjectid": "MTkxOTE5MTkxOTE5MTkxOQ==",
+           "credtype": 1,
+           "privatedata": "QkJCQkJCQkJCQkJCQkJCQg==",
+        "rowners" : ["MjIyMjIyMjIyMjIyMjIyMg=="]
        }]
 }
index 1219d6a6db11602f8a596500fa883c7779e7af8c..9bec9182f2b155df6e85f40a361aecf416efd8fc 100644 (file)
@@ -1,8 +1,8 @@
 {
     "acl": [
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/res",
                 "/oic/d",
                 "/oic/p",
                 "/oic/ad",
                 "/oic/sec/amacl"
                        ],
-                       "perms": 2,
-                       "ownrs" : ["YWRtaW5EZXZpY2VVVUlEMA=="]
+                       "permission": 2,
+                       "rowners" : ["YWRtaW5EZXZpY2VVVUlEMA=="]
                },
         {
-            "sub": "Kg==",
-            "rsrc": [
+            "subject": "Kg==",
+            "resources": [
                 "/oic/sec/doxm",
                 "/oic/sec/pstat"
              ],
-             "perms": 2,
-             "ownrs" : ["YWRtaW5EZXZpY2VVVUlEMA=="]
+             "permission": 2,
+             "rowners" : ["YWRtaW5EZXZpY2VVVUlEMA=="]
         }
        ],
        "pstat":        {
@@ -38,6 +38,6 @@
                "sct": 1,
                "owned": true,
                "deviceid":     "YWRtaW5EZXZpY2VVVUlEMA==",
-               "ownr": "YWRtaW5EZXZpY2VVVUlEMA=="
+               "devowner":     "YWRtaW5EZXZpY2VVVUlEMA=="
        }
 }