fix(RSAExtensions): Falsche Methoden zur Schlüsselbenennung entfernt
This commit is contained in:
parent
1b00f9afa2
commit
3becb208ec
@ -13,34 +13,11 @@ namespace DigitalData.Core.Security.Extensions
|
|||||||
return rsa;
|
return rsa;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool TryGetEncryptor(this IDictionary<string, IRSAEncryptor> pairs, string issuer, string audience, out IRSAEncryptor? encryptor)
|
public static IRSADecryptor GetRSADecryptor(this ICryptFactory factory, string issuer, string audience, Version? version = null, string? seperator = null)
|
||||||
=> pairs.TryGetValue($"{issuer}:{audience}", out encryptor);
|
=> factory[factory.RSAKeyNameFormatter(issuer, audience, true, version, seperator)];
|
||||||
|
|
||||||
public static IRSAEncryptor? GetEncryptor(this IDictionary<string, IRSAEncryptor> pairs, string issuer, string audience)
|
public static bool TryGetRSADecryptor(this ICryptFactory factory, string issuer, string audience, out IRSADecryptor? decryptor, Version? version = null, string? seperator = null)
|
||||||
=> pairs.TryGetEncryptor(issuer: issuer, audience: audience, out var encryptor) ? encryptor : null;
|
=> factory.TryGetRSADecryptor(factory.RSAKeyNameFormatter(issuer, audience, true, version, seperator), out decryptor);
|
||||||
|
|
||||||
public static IRSADecryptor GetRSADecryptor(this ICryptFactory factory, string issuer, string audience)
|
|
||||||
=> factory[$"{issuer}:{audience}"];
|
|
||||||
|
|
||||||
public static bool TryGetRSADecryptor(this ICryptFactory factory, string issuer, string audience, out IRSADecryptor? decryptor)
|
|
||||||
=> factory.TryGetRSADecryptor($"{issuer}:{audience}", out decryptor);
|
|
||||||
|
|
||||||
public static IRSAEncryptor GetRSAEncryptor(this ICryptFactory factory, string issuer, string audience)
|
|
||||||
=> factory[$"{issuer}:{audience}"].Encryptor;
|
|
||||||
|
|
||||||
public static bool TryGetRSADecryptor(this ICryptFactory factory, string issuer, string audience, out IRSAEncryptor? encryptor)
|
|
||||||
{
|
|
||||||
if(factory.TryGetRSADecryptor($"{issuer}:{audience}", out var decryptor) && decryptor is not null)
|
|
||||||
{
|
|
||||||
encryptor = decryptor.Encryptor;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
encryptor = null;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string CreatePath(string key, string? directory = null)
|
private static string CreatePath(string key, string? directory = null)
|
||||||
{
|
{
|
||||||
@ -85,11 +62,5 @@ namespace DigitalData.Core.Security.Extensions
|
|||||||
fileLock.Release();
|
fileLock.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SavePem(this IRSACryptographer decryptor, string issuer, string audience, string? directory = null)
|
|
||||||
=> decryptor.SavePem($"{issuer}:{audience}", directory);
|
|
||||||
|
|
||||||
public static async Task SavePemAsync(this IRSACryptographer decryptor, string issuer, string audience, string? directory = null)
|
|
||||||
=> await decryptor.SavePemAsync($"{issuer}:{audience}", directory);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,6 +1,5 @@
|
|||||||
using DigitalData.Core.Abstractions.Security;
|
using DigitalData.Core.Abstractions.Security;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace DigitalData.Core.Security
|
namespace DigitalData.Core.Security
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user