Commit 392f40ef authored by Oleksii Beketov's avatar Oleksii Beketov Committed by Aleksey

[IOT-3301] Change CSR CBOR encoding

Encode CSR as text string instead of byte string
in case of PEM encoded CSR

Change-Id: I849603f837103742156c4c157be44cce95b3a89b
Signed-off-by: default avatarOleksii Beketov <ol.beketov@samsung.com>
parent d315911c
...@@ -155,7 +155,14 @@ static OCStackResult CSRToCBORPayload(const uint8_t *csr, size_t csrLen, OicEnco ...@@ -155,7 +155,14 @@ static OCStackResult CSRToCBORPayload(const uint8_t *csr, size_t csrLen, OicEnco
// Create CSR string entry // Create CSR string entry
cborEncoderResult = cbor_encode_text_string(&csrRootMap, OIC_JSON_CSR_NAME, strlen(OIC_JSON_CSR_NAME)); cborEncoderResult = cbor_encode_text_string(&csrRootMap, OIC_JSON_CSR_NAME, strlen(OIC_JSON_CSR_NAME));
VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding CSR name."); VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding CSR name.");
if (OIC_ENCODING_PEM == encoding)
{
cborEncoderResult = cbor_encode_text_string(&csrRootMap, (const char *)csr, csrLen);
}
else
{
cborEncoderResult = cbor_encode_byte_string(&csrRootMap, csr, csrLen); cborEncoderResult = cbor_encode_byte_string(&csrRootMap, csr, csrLen);
}
VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding CSR value."); VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding CSR value.");
// Create encoding entry // Create encoding entry
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment