*cborSize = 0;
*cborPayload = NULL;
const OicSecCred_t *cred = credS;
- CborEncoder encoder = { {.ptr = NULL }, .end = 0 };
- CborEncoder credArray = { {.ptr = NULL }, .end = 0 };
- CborEncoder credRootMap = { {.ptr = NULL }, .end = 0 };
+ CborEncoder encoder;
+ CborEncoder credArray;
+ CborEncoder credRootMap;
if (0 == cborLen)
{
while (cred)
{
- CborEncoder credMap = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 };
+ CborEncoder credMap;
size_t mapSize = CRED_MAP_SIZE;
char *subject = NULL;
if (cred->period)
//PublicData -- Not Mandatory
if (SIGNED_ASYMMETRIC_KEY == cred->credType && cred->publicData.data)
{
- CborEncoder publicMap = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 };
+ CborEncoder publicMap;
const size_t publicMapSize = 2;
cborEncoderResult = cbor_encode_text_string(&credMap, OIC_JSON_PUBLICDATA_NAME,
//PrivateData -- Not Mandatory
if(cred->privateData.data)
{
- CborEncoder privateMap = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 };
+ CborEncoder privateMap;
const size_t privateMapSize = 2;
cborEncoderResult = cbor_encode_text_string(&credMap, OIC_JSON_PRIVATEDATA_NAME,
OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
OicSecCred_t **secCred)
{
- if (NULL == cborPayload || NULL == secCred || NULL != *secCred)
+ if (NULL == cborPayload || NULL == secCred || NULL != *secCred || 0 == size)
{
return OC_STACK_INVALID_PARAM;
}
//Get binary representation of cbor
OicSecCred_t *cred = NULL;
- uint8_t *payload = (((OCSecurityPayload*)ehRequest->payload)->securityData1);
+ uint8_t *payload = (((OCSecurityPayload*)ehRequest->payload)->securityData);
size_t size = (((OCSecurityPayload*)ehRequest->payload)->payloadSize);
OCStackResult res = CBORPayloadToCred(payload, size, &cred);
if (res == OC_STACK_OK)
//Get binary representation of CBOR
OicSecCred_t *cred = NULL;
- uint8_t *payload = ((OCSecurityPayload*)ehRequest->payload)->securityData1;
+ uint8_t *payload = ((OCSecurityPayload*)ehRequest->payload)->securityData;
size_t size = ((OCSecurityPayload*)ehRequest->payload)->payloadSize;
OCStackResult res = CBORPayloadToCred(payload, size, &cred);
if ((OC_STACK_OK == res) && cred)
}
//Send payload to request originator
- ret = (SendSRMCBORResponse(ehRequest, ret, NULL, 0) == OC_STACK_OK) ?
+ ret = (SendSRMResponse(ehRequest, ret, NULL, 0) == OC_STACK_OK) ?
ret : OC_EH_ERROR;
return ret;
return ret;
}
+OCStackResult GetCredRownerId(OicUuid_t *rowneruuid)
+{
+ OCStackResult retVal = OC_STACK_ERROR;
+ if (gCred)
+ {
+ *rowneruuid = gCred->rownerID;
+ retVal = OC_STACK_OK;
+ }
+ return retVal;
+}