From b32f0df1255d10b25ba98e1afc344c828e619635 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Mon, 16 Dec 2024 10:54:48 +0100 Subject: [PATCH] =?UTF-8?q?refactor(AsymCryptService):=20Methode=20Default?= =?UTF-8?q?.get=20hinzugef=C3=BCgt,=20um=20den=20ersten=20Decryptor=20zu?= =?UTF-8?q?=20erhalten.=20=20-=20Wirft=20InvalidOperationException,=20wenn?= =?UTF-8?q?=20kein=20Decryptor=20verf=C3=BCgbar=20ist.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalData.Core.Security/AsymCryptService.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/DigitalData.Core.Security/AsymCryptService.cs b/DigitalData.Core.Security/AsymCryptService.cs index 82cf984..e5d24a4 100644 --- a/DigitalData.Core.Security/AsymCryptService.cs +++ b/DigitalData.Core.Security/AsymCryptService.cs @@ -12,6 +12,13 @@ namespace DigitalData.Core.Security { public IEnumerable Decryptors => _params.Decryptors; + public IRSADecryptor Default => Decryptors.FirstOrDefault() + ?? throw new InvalidOperationException( + "No default decryptor is available. Ensure that at least one decryptor is configured in the provided parameters. " + + "This issue typically arises if the configuration for decryptors is incomplete or missing. " + + "Check the 'Decryptors' collection in the configuration and verify that it contains valid entries." + ); + public IRSADecryptor this[string key] { get