refactor(IRSADecryptor): Umbenennung in IAsymmetricPrivateKey
This commit is contained in:
@@ -4,7 +4,7 @@ using System.Security.Cryptography;
|
||||
|
||||
namespace DigitalData.Core.Security.Cryptographer
|
||||
{
|
||||
public class RSADecryptor : RSACryptographer, IRSADecryptor, IAsymmetricKey
|
||||
public class RSADecryptor : RSAKeyBase, IAsymmetricPrivateKey, IAsymmetricKey
|
||||
{
|
||||
private string? _pem;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace DigitalData.Core.Security.Cryptographer
|
||||
{
|
||||
public class RSAEncryptor : RSACryptographer, IRSAEncryptor, IAsymmetricKey
|
||||
public class RSAEncryptor : RSAKeyBase, IRSAEncryptor, IAsymmetricKey
|
||||
{
|
||||
public override string Pem
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace DigitalData.Core.Security.Cryptographer
|
||||
return new string(pemChars);
|
||||
}
|
||||
|
||||
public IRSADecryptor CreateDecryptor(string pem, string? issuer = null, string? audience = null, bool encrypt = false, RSAEncryptionPadding? padding = null) => new RSADecryptor()
|
||||
public IAsymmetricPrivateKey CreatePrivateKey(string pem, string? issuer = null, string? audience = null, bool encrypt = false, RSAEncryptionPadding? padding = null) => new RSADecryptor()
|
||||
{
|
||||
Pem = pem,
|
||||
Issuer = issuer ?? string.Empty,
|
||||
|
||||
@@ -5,8 +5,7 @@ using System.Security.Cryptography;
|
||||
|
||||
namespace DigitalData.Core.Security.Cryptographer
|
||||
{
|
||||
//TODO: Abstract RSA for future updates (using ECC, El Gamal or Lattice-based Cryptography)
|
||||
public class RSACryptographer : IAsymmetricKey
|
||||
public class RSAKeyBase : IAsymmetricKey
|
||||
{
|
||||
public virtual string Pem { get; init; }
|
||||
|
||||
@@ -30,7 +29,7 @@ namespace DigitalData.Core.Security.Cryptographer
|
||||
public RsaSecurityKey RsaSecurityKey => _lazyRsaSecurityKey.Value;
|
||||
|
||||
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||
internal RSACryptographer()
|
||||
internal RSAKeyBase()
|
||||
{
|
||||
_lazyRsaSecurityKey = new(() => new RsaSecurityKey(RSA));
|
||||
}
|
||||
Reference in New Issue
Block a user