feat(RSACryptographer): Version hinzugefügt

This commit is contained in:
Developer 02 2024-12-05 01:21:49 +01:00
parent c03f39c1a9
commit cc3d1f58d3

View File

@ -1,5 +1,6 @@
using DigitalData.Core.Abstractions.Security;
using System.Security.Cryptography;
using System.Text.Json;
namespace DigitalData.Core.Security
{
@ -20,12 +21,26 @@ namespace DigitalData.Core.Security
{
if (value <= DateOnly.FromDateTime(DateTime.Now))
throw new InvalidOperationException("The expiration date has already passed.");
throw new InvalidOperationException($"Cryptographer expiration date has already passed. Cryptographer: {JsonSerializer.Serialize(this)}");
_expiration = value;
}
}
private Version? _version;
public Version? Version
{
get => _version;
init
{
if (value != Secrets.Version)
throw new InvalidOperationException($"Cryptographer version ({value}) does not match the expected version ({Secrets.Version}). Cryptographer: {JsonSerializer.Serialize(this)}");
_version = value;
}
}
internal RSACryptographer() { }
}
}