diff --git a/DigitalData.Core.Abstractions/Security/IRSADecryptor.cs b/DigitalData.Core.Abstractions/Security/IRSADecryptor.cs index 4aa3ad9..9e7ded4 100644 --- a/DigitalData.Core.Abstractions/Security/IRSADecryptor.cs +++ b/DigitalData.Core.Abstractions/Security/IRSADecryptor.cs @@ -2,7 +2,7 @@ { public interface IRSADecryptor : IRSACryptographer { - public bool Encrypt { get; init; } + public bool IsEncrypted { get; init; } IRSAEncryptor Encryptor { get; } diff --git a/DigitalData.Core.Security/Config/AsymCryptParams.cs b/DigitalData.Core.Security/Config/AsymCryptParams.cs index 950d15b..c845580 100644 --- a/DigitalData.Core.Security/Config/AsymCryptParams.cs +++ b/DigitalData.Core.Security/Config/AsymCryptParams.cs @@ -36,7 +36,7 @@ namespace DigitalData.Core.Security.Config if (decryptor.IsPemNull) { var file_name_params = new List { decryptor.Issuer, decryptor.Audience }; - if (decryptor.Encrypt) + if (decryptor.IsEncrypted) file_name_params.Add(Secrets.Version); var path = Path.Combine(PemDirectory, string.Join(Separator, file_name_params)); @@ -45,7 +45,7 @@ namespace DigitalData.Core.Security.Config decryptor.SetPem(File.ReadAllText(path)); else { - var pem = decryptor.Encrypt + var pem = decryptor.IsEncrypted ? Instance.RSAFactory.CreateEncryptedPrivateKeyPem(pbeParameters: PbeParameters, keySizeInBits: KeySizeInBits, password: Secrets.PBE_PASSWORD) : Instance.RSAFactory.CreatePrivateKeyPem(keySizeInBits: KeySizeInBits); diff --git a/DigitalData.Core.Security/Cryptographer/RSADecryptor.cs b/DigitalData.Core.Security/Cryptographer/RSADecryptor.cs index eb4cbec..566ac44 100644 --- a/DigitalData.Core.Security/Cryptographer/RSADecryptor.cs +++ b/DigitalData.Core.Security/Cryptographer/RSADecryptor.cs @@ -6,7 +6,7 @@ namespace DigitalData.Core.Security.Cryptographer { public class RSADecryptor : RSACryptographer, IRSADecryptor, IRSACryptographer { - public bool Encrypt { get; init; } + public bool IsEncrypted { get; init; } private readonly Lazy _lazyEncryptor; @@ -28,7 +28,7 @@ namespace DigitalData.Core.Security.Cryptographer public override void Init() { base.Init(); - if (Encrypt) + if (IsEncrypted) RSA.ImportFromEncryptedPem(Pem, Secrets.PBE_PASSWORD.AsSpan()); else RSA.ImportFromPem(Pem);