From 5009fec675c16f860a1f253f18a5495d448548cb Mon Sep 17 00:00:00 2001 From: Ramon Smits Date: Thu, 19 Nov 2015 17:51:09 +0100 Subject: [PATCH] Fix for #3091 Now using indexer which overwrites the current value if already present. Not moved to constructor due to documentation OutgoingHeaders property "This value will be cleared when a thread receives a message. --- .../Encryption/Rijndael/EncryptionService.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/NServiceBus.Core/Encryption/Rijndael/EncryptionService.cs b/src/NServiceBus.Core/Encryption/Rijndael/EncryptionService.cs index fd17bf92077..7506f6f17bf 100644 --- a/src/NServiceBus.Core/Encryption/Rijndael/EncryptionService.cs +++ b/src/NServiceBus.Core/Encryption/Rijndael/EncryptionService.cs @@ -168,11 +168,7 @@ private string DecryptUsingKeyIdentifier(EncryptedValue encryptedValue, string k protected virtual void AddKeyIdentifierHeader() { - var headers = Bus.OutgoingHeaders; - if (!headers.ContainsKey(Headers.RijndaelKeyIdentifier)) - { - headers.Add(Headers.RijndaelKeyIdentifier, EncryptionKeyIdentifier); - } + Bus.OutgoingHeaders[Headers.RijndaelKeyIdentifier] = EncryptionKeyIdentifier; } protected virtual bool TryGetKeyIdentifierHeader(out string keyIdentifier)