public RijndaelEncryptionService(
string encryptionKeyIdentifier,
IDictionary<string, byte[]> keys,
IList<byte[]> decryptionKeys
)
{
this.encryptionKeyIdentifier = encryptionKeyIdentifier;
this.decryptionKeys = decryptionKeys;
this.keys = keys;
if (string.IsNullOrEmpty(encryptionKeyIdentifier))
{
Log.Error("No encryption key identifier configured. Messages with encrypted properties will fail to send. Add an encryption key identifier to the rijndael encryption service configuration.");
}
else if (!keys.TryGetValue(encryptionKeyIdentifier, out encryptionKey))
{
throw new ArgumentException("No encryption key for given encryption key identifier.", nameof(encryptionKeyIdentifier));
}
else
{
VerifyEncryptionKey(encryptionKey);
}
VerifyExpiredKeys(decryptionKeys);
}