feat(IAsymmetricTokenDescriptor): Methode Validator.get mit Lazy Loading hinzugefügt.

This commit is contained in:
Developer 02
2025-01-10 23:32:53 +01:00
parent 39091ff5cf
commit b90a52412c
5 changed files with 27 additions and 6 deletions

View File

@@ -1,5 +1,4 @@
using DigitalData.Core.Abstractions.Security;
using Microsoft.IdentityModel.Tokens;
using System.Security.Cryptography;
namespace DigitalData.Core.Security.RSAKey
@@ -24,16 +23,16 @@ namespace DigitalData.Core.Security.RSAKey
public bool IsEncrypted { get; init; }
private readonly Lazy<IAsymmetricPublicKey> _lazyPublicKey;
protected TPublicKey CreatePublicKey<TPublicKey>() where TPublicKey : RSAPublicKey, new()
=> new() { Content = RSA.ExportRSAPublicKeyPem() };
private readonly Lazy<RSAPublicKey> _lazyPublicKey;
public IAsymmetricPublicKey PublicKey => _lazyPublicKey.Value;
public RSAPrivateKey()
{
_lazyPublicKey = new(() => new RSAPublicKey()
{
Content = RSA.ExportRSAPublicKeyPem()
});
_lazyPublicKey = new(CreatePublicKey<RSAPublicKey>);
}
internal void SetPem(string pem)