+
+ // Add padding
+ int paddingLength = (4 - (encodedString.length() % 4)) % 4;
+ if(paddingLength > 0)
+ {
+ while(paddingLength--)
+ {
+ oss << '=';
+ }
+ encodedString = oss.str();
+ }
+
+ if(encodedString.length() > MAX_PROPERTY_STRING_LENGTH)
+ {
+ // cut string up into blocks of MAX_PROPERTY_STRING_LENGTH and store to an array
+ auto numStrings = (encodedString.length() + MAX_PROPERTY_STRING_LENGTH - 1) / MAX_PROPERTY_STRING_LENGTH;
+
+ Property::Array array;
+ for(auto i = 0u; i < numStrings; ++i)
+ {
+ array.PushBack(encodedString.substr(i * MAX_PROPERTY_STRING_LENGTH, MAX_PROPERTY_STRING_LENGTH));
+ }
+ value = array;
+ }
+ else
+ {
+ value = encodedString;
+ }
+}
+
+void EncodeBase64PropertyData(Property::Value& value, const std::vector<uint8_t>& inputData)
+{
+ std::ostringstream oss;
+
+ bn::encode_b64(reinterpret_cast<const uint8_t*>(&inputData[0]),
+ reinterpret_cast<const uint8_t*>(&inputData[0] + inputData.size()),
+ std::ostream_iterator<char>(oss, ""));
+
+ std::string encodedString = oss.str();
+
+ // Add padding
+ int paddingLength = (4 - (encodedString.length() % 4)) % 4;
+ if(paddingLength > 0)
+ {
+ while(paddingLength--)
+ {
+ oss << '=';
+ }
+ encodedString = oss.str();
+ }
+