+/**
+ * Check RFC4122 based UUID
+ *
+ * @param uuidString string representation of UUID
+ * @return true for success, otherwise false
+ */
+static bool CheckUuidFormat(const char uuidString[UUID_STR_SIZE])
+{
+ // Indexes of '-' symbols in string representation of UUID
+ static const int dash_idxs[4] = {8,13,18,23};
+
+ VERIFY_NON_NULL_RET(uuidString, NET_SSL_TAG, "uuidString is NULL" , false);
+
+ // Check for '-' symbols
+ for (int i = 0; i < 4; i++)
+ {
+ if (uuidString[dash_idxs[i]] != '-')
+ {
+ return false;
+ }
+ }
+
+ for (int i = 0; i < UUID_STR_SIZE; i++)
+ {
+ // Skip '-' symbols
+ if (i == dash_idxs[0] || i == dash_idxs[1] || i == dash_idxs[2] || i == dash_idxs[3])
+ {
+ continue;
+ }
+
+ if ((uuidString[i] >= 'a' && uuidString[i] <= 'f')
+ || (uuidString[i] >= 'A' && uuidString[i] <= 'F')
+ || (uuidString[i] >= '0' && uuidString[i] <= '9') )
+ {
+ continue;
+ }
+
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * FindUuid function finds the first entry of RFC4122 based UUID
+ *
+ * @param data pointer to unformatted data
+ * @param size data size
+ *
+ * @return pointer to string representation of the found UUID if success, otherwise NULL
+ */
+static const char* FindUuid(const char* data, size_t size)
+{
+ const char* result = NULL;
+
+ VERIFY_NON_NULL_RET(data, NET_SSL_TAG, "data is NULL" , NULL);
+ if (size < UUID_STR_SIZE)
+ {
+ OIC_LOG(ERROR, NET_SSL_TAG, "Buffer size is too small");
+ return NULL;
+ }
+
+ const char* currentPtr = data;
+ int currentSize = size;
+ while (!result
+ && (currentPtr = (const char*)memchr((const void*)++currentPtr, '-', currentSize - 1))
+ && ((currentSize = (size - (currentPtr - data))) >= (UUID_STR_SIZE - 8)))
+ {
+ if (currentPtr - data >= 8 && CheckUuidFormat(currentPtr - 8))
+ {
+ result = currentPtr - 8;
+ }
+ }
+
+ return result;
+}
+