MCPcopy Create free account
hub / github.com/ComodoSecurity/openedr / decryptJsonValue

Function decryptJsonValue

edrav2/iprj/libcore/src/jsonrpc.cpp:204–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202//
203//
204Variant decryptJsonValue(const Json::Value& data)
205{
206 if (data.isNull())
207 return {};
208 if (!data.isObject() || !data.isMember(c_sEncryptedFieldName))
209 error::InvalidFormat(SL, "Data is not encrypted").throwException();
210
211 auto encryptedData = data[c_sEncryptedFieldName];
212 if (encryptedData.empty())
213 return {};
214
215 auto sData = encryptedData.asCString();
216 auto pDataStream = io::createMemoryStream(sData, strlen(sData));
217 auto pBase64Stream = queryInterface<io::IRawReadableStream>(createObject(CLSID_Base64Decoder,
218 Dictionary({ {"stream", pDataStream} })));
219 return variant::deserialize(pBase64Stream);
220}
221
222} // namespace ipc
223} // namespace cmd

Callers 3

executeMethod · 0.85
jsonrpcclient.cppFile · 0.85
HandleMethodCallMethod · 0.85

Calls 10

createMemoryStreamFunction · 0.85
strlenFunction · 0.85
isMemberMethod · 0.80
throwExceptionMethod · 0.80
asCStringMethod · 0.80
deserializeFunction · 0.70
DictionaryClass · 0.50
isNullMethod · 0.45
isObjectMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected