refactor(RSADecryptor): Umbenennung der Eigenschaft Encrypt in IsEncrypted
This commit is contained in:
parent
53e6f37a09
commit
fe2ee78d14
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
public interface IRSADecryptor : IRSACryptographer
|
public interface IRSADecryptor : IRSACryptographer
|
||||||
{
|
{
|
||||||
public bool Encrypt { get; init; }
|
public bool IsEncrypted { get; init; }
|
||||||
|
|
||||||
IRSAEncryptor Encryptor { get; }
|
IRSAEncryptor Encryptor { get; }
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ namespace DigitalData.Core.Security.Config
|
|||||||
if (decryptor.IsPemNull)
|
if (decryptor.IsPemNull)
|
||||||
{
|
{
|
||||||
var file_name_params = new List<object> { decryptor.Issuer, decryptor.Audience };
|
var file_name_params = new List<object> { decryptor.Issuer, decryptor.Audience };
|
||||||
if (decryptor.Encrypt)
|
if (decryptor.IsEncrypted)
|
||||||
file_name_params.Add(Secrets.Version);
|
file_name_params.Add(Secrets.Version);
|
||||||
|
|
||||||
var path = Path.Combine(PemDirectory, string.Join(Separator, file_name_params));
|
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));
|
decryptor.SetPem(File.ReadAllText(path));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var pem = decryptor.Encrypt
|
var pem = decryptor.IsEncrypted
|
||||||
? Instance.RSAFactory.CreateEncryptedPrivateKeyPem(pbeParameters: PbeParameters, keySizeInBits: KeySizeInBits, password: Secrets.PBE_PASSWORD)
|
? Instance.RSAFactory.CreateEncryptedPrivateKeyPem(pbeParameters: PbeParameters, keySizeInBits: KeySizeInBits, password: Secrets.PBE_PASSWORD)
|
||||||
: Instance.RSAFactory.CreatePrivateKeyPem(keySizeInBits: KeySizeInBits);
|
: Instance.RSAFactory.CreatePrivateKeyPem(keySizeInBits: KeySizeInBits);
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ namespace DigitalData.Core.Security.Cryptographer
|
|||||||
{
|
{
|
||||||
public class RSADecryptor : RSACryptographer, IRSADecryptor, IRSACryptographer
|
public class RSADecryptor : RSACryptographer, IRSADecryptor, IRSACryptographer
|
||||||
{
|
{
|
||||||
public bool Encrypt { get; init; }
|
public bool IsEncrypted { get; init; }
|
||||||
|
|
||||||
private readonly Lazy<IRSAEncryptor> _lazyEncryptor;
|
private readonly Lazy<IRSAEncryptor> _lazyEncryptor;
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ namespace DigitalData.Core.Security.Cryptographer
|
|||||||
public override void Init()
|
public override void Init()
|
||||||
{
|
{
|
||||||
base.Init();
|
base.Init();
|
||||||
if (Encrypt)
|
if (IsEncrypted)
|
||||||
RSA.ImportFromEncryptedPem(Pem, Secrets.PBE_PASSWORD.AsSpan());
|
RSA.ImportFromEncryptedPem(Pem, Secrets.PBE_PASSWORD.AsSpan());
|
||||||
else
|
else
|
||||||
RSA.ImportFromPem(Pem);
|
RSA.ImportFromPem(Pem);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user