diff --git a/DigitalData.Core.Abstractions/Security/IRSADecryptor.cs b/DigitalData.Core.Abstractions/Security/IRSADecryptor.cs index 376684e..4aa3ad9 100644 --- a/DigitalData.Core.Abstractions/Security/IRSADecryptor.cs +++ b/DigitalData.Core.Abstractions/Security/IRSADecryptor.cs @@ -2,11 +2,7 @@ { public interface IRSADecryptor : IRSACryptographer { - (string Value, Version Version)? VersionedPassword { init; } - - Version? PasswordVersion { get; } - - bool HasEncryptedPem { get; } + public bool Encrypt { get; init; } IRSAEncryptor Encryptor { get; } diff --git a/DigitalData.Core.Security/Cryptographer/RSADecryptor.cs b/DigitalData.Core.Security/Cryptographer/RSADecryptor.cs index c9a541e..eb4cbec 100644 --- a/DigitalData.Core.Security/Cryptographer/RSADecryptor.cs +++ b/DigitalData.Core.Security/Cryptographer/RSADecryptor.cs @@ -6,22 +6,7 @@ namespace DigitalData.Core.Security.Cryptographer { public class RSADecryptor : RSACryptographer, IRSADecryptor, IRSACryptographer { - public (string Value, Version Version)? VersionedPassword - { - init - { - _password = value?.Value; - PasswordVersion = value?.Version; - } - } - - private string? _password; - - public Version? PasswordVersion { get; private init; } = null; - - public bool HasEncryptedPem => _password is not null; - - public bool IsEncrypted => _password is not null; + public bool Encrypt { get; init; } private readonly Lazy _lazyEncryptor; @@ -43,10 +28,10 @@ namespace DigitalData.Core.Security.Cryptographer public override void Init() { base.Init(); - if (_password is null) - RSA.ImportFromPem(Pem); + if (Encrypt) + RSA.ImportFromEncryptedPem(Pem, Secrets.PBE_PASSWORD.AsSpan()); else - RSA.ImportFromEncryptedPem(Pem, _password.AsSpan()); + RSA.ImportFromPem(Pem); } } } \ No newline at end of file