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)