From 33916fc2beb2ff0b7058db9716f043a1ebb8b4ad Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Wed, 19 Oct 2022 16:13:41 +0200 Subject: [PATCH] [TraceDecoder] Add decrypted payload field (#23243) --- examples/common/tracing/TraceDecoder.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/common/tracing/TraceDecoder.cpp b/examples/common/tracing/TraceDecoder.cpp index e076a44f0497b2..eedfd73fb748fd 100644 --- a/examples/common/tracing/TraceDecoder.cpp +++ b/examples/common/tracing/TraceDecoder.cpp @@ -175,9 +175,9 @@ CHIP_ERROR TraceDecoder::MaybeLogAndConsumeEncryptedPayload(Json::Value & json) size_t size = static_cast(json[kPayloadEncryptedSizeKey].asLargestUInt()); if (size) { - auto payload = json[kPayloadEncryptedDataKey].asString(); - auto bufferPtr = json[kPayloadEncryptedBufferPtrKey].asString(); - auto scoppedIndent = ScopedLogIndentWithSize("Encrypted Payload", size); + auto payload = json[kPayloadEncryptedDataKey].asString(); + auto bufferPtr = json[kPayloadEncryptedBufferPtrKey].asString(); + auto scopedIndent = ScopedLogIndentWithSize("Encrypted Payload", size); Log("data", payload.c_str()); Log("buffer_ptr", bufferPtr.c_str()); } @@ -272,6 +272,12 @@ CHIP_ERROR TraceDecoder::MaybeLogAndConsumePayload(Json::Value & json, bool isRe auto size = static_cast(json[kPayloadSizeKey].asLargestUInt()); if (size) { + { + auto payload = json[kPayloadDataKey].asString(); + auto scopedIndent = ScopedLogIndentWithSize("Decrypted Payload", size); + Log("data", payload.c_str()); + } + bool shouldDecode = !isResponse || mOptions.mEnableProtocolInteractionModelResponse; auto payload = json[kPayloadDataKey].asString(); auto protocolId = json[kProtocolIdKey].asLargestUInt();