feat(RSACryptographer): Version hinzugefügt
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using DigitalData.Core.Abstractions.Security;
|
using DigitalData.Core.Abstractions.Security;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace DigitalData.Core.Security
|
namespace DigitalData.Core.Security
|
||||||
{
|
{
|
||||||
@@ -20,12 +21,26 @@ namespace DigitalData.Core.Security
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (value <= DateOnly.FromDateTime(DateTime.Now))
|
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;
|
_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() { }
|
internal RSACryptographer() { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user