From c03f39c1a9202ee01dc1afd67cef95c8edd10189 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 5 Dec 2024 01:15:59 +0100 Subject: [PATCH] =?UTF-8?q?feat(RSACryptographer):=20Verfall=20hinzugef?= =?UTF-8?q?=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalData.Core.Security/RSACryptographer.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/DigitalData.Core.Security/RSACryptographer.cs b/DigitalData.Core.Security/RSACryptographer.cs index 55161cc..ed6c72d 100644 --- a/DigitalData.Core.Security/RSACryptographer.cs +++ b/DigitalData.Core.Security/RSACryptographer.cs @@ -11,6 +11,21 @@ namespace DigitalData.Core.Security protected virtual RSA RSA { get; } = RSA.Create(); + private DateOnly? _expiration; + + public DateOnly? Expiration + { + get => _expiration; + init + { + + if (value <= DateOnly.FromDateTime(DateTime.Now)) + throw new InvalidOperationException("The expiration date has already passed."); + + _expiration = value; + } + } + internal RSACryptographer() { } } } \ No newline at end of file