diff --git a/DigitalData.Core.Security/AsymCryptService.cs b/DigitalData.Core.Security/AsymCryptService.cs index 3eafa0a..41539a2 100644 --- a/DigitalData.Core.Security/AsymCryptService.cs +++ b/DigitalData.Core.Security/AsymCryptService.cs @@ -31,6 +31,13 @@ namespace DigitalData.Core.Security } } + public IRSADecryptor this[int index] => index < 0 || index >= Decryptors.Count() + ? Decryptors.ElementAt(index) + : throw new ArgumentOutOfRangeException( + nameof(index), + index, + $"The index {index} is out of range. The valid indices for {GetType()} are between 0 and {Decryptors.Count() - 1} (inclusive). Please ensure the index is within this range."); + public AsymCryptService(IOptions options, ILogger>? logger = null) : base(options) { logger?.LogInformation("Core.Secrets version: {Version}, Created on: {CreationDate}.", Secrets.Version, Secrets.CreationDate.ToString("dd.MM.yyyy"));