特定 ServiceInsight 通过 MessageMutator 处理加密消息
Particular ServiceInsight Handling Encrypted Messages via MessageMutator
因此,由于各种内部原因,我无法使用 NService Bus 的内置命令属性加密,而是不得不将其实现为 MessageMutator。我的代码如下所示:
public class TransportMessageEncryptionMutator : IMutateTransportMessages
{
// Encryption helper is intialized with key stored in Key Vault.
private readonly EncryptionHelper encryptionHelper;
public void MutateOutgoing(LogicalMessage logicalMessage, TransportMessage transportMessage)
{
var encryptedBody = this.encryptionHelper.EncryptBytes(transportMessage.Body);
// Set the body of the message to be the encrypted copy of the data.
transportMessage.Body = encryptedBody;
}
public void MutateIncoming(TransportMessage transportMessage)
{
// Decrypt the body of the message.
var clearBody = this.encryptionHelper.DecryptBytes(transportMessage.Body);
// Set the body of the message to be the decrypted copy of the data and clear flag.
transportMessage.Body = clearBody;
}
}
这一切都运行良好,并且在将它们放入总线时进行了加密。我想要做的是能够在 Particular 的 ServiceInsight 应用程序中查看消息时对其进行解密。我觉得他们提供了 IMutateTransportMessages 接口并在他们的网站上,特别提到了这是如何实现完整消息加密的事实;将有一种机制可以为 ServiceInsight 创建一个插件来解密它。
目前没有适用于 ServiceInsight 的插件模型。
您可以做的是从 ServiceInsight 复制加密值并编写一个工具来为您解密。
因此,由于各种内部原因,我无法使用 NService Bus 的内置命令属性加密,而是不得不将其实现为 MessageMutator。我的代码如下所示:
public class TransportMessageEncryptionMutator : IMutateTransportMessages
{
// Encryption helper is intialized with key stored in Key Vault.
private readonly EncryptionHelper encryptionHelper;
public void MutateOutgoing(LogicalMessage logicalMessage, TransportMessage transportMessage)
{
var encryptedBody = this.encryptionHelper.EncryptBytes(transportMessage.Body);
// Set the body of the message to be the encrypted copy of the data.
transportMessage.Body = encryptedBody;
}
public void MutateIncoming(TransportMessage transportMessage)
{
// Decrypt the body of the message.
var clearBody = this.encryptionHelper.DecryptBytes(transportMessage.Body);
// Set the body of the message to be the decrypted copy of the data and clear flag.
transportMessage.Body = clearBody;
}
}
这一切都运行良好,并且在将它们放入总线时进行了加密。我想要做的是能够在 Particular 的 ServiceInsight 应用程序中查看消息时对其进行解密。我觉得他们提供了 IMutateTransportMessages 接口并在他们的网站上,特别提到了这是如何实现完整消息加密的事实;将有一种机制可以为 ServiceInsight 创建一个插件来解密它。
目前没有适用于 ServiceInsight 的插件模型。
您可以做的是从 ServiceInsight 复制加密值并编写一个工具来为您解密。