refactor(IAsymmetricKey): Id nullbar gemacht.
- Benennung der perm-Datei aktualisiert.
This commit is contained in:
parent
22040cf1e7
commit
39091ff5cf
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
public interface IAsymmetricKey
|
public interface IAsymmetricKey
|
||||||
{
|
{
|
||||||
string Id { get; }
|
string? Id { get; }
|
||||||
|
|
||||||
string Content { get; }
|
string Content { get; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,14 +50,6 @@ namespace DigitalData.Core.Security.Config
|
|||||||
// init decryptors
|
// init decryptors
|
||||||
AfterCreate += () =>
|
AfterCreate += () =>
|
||||||
{
|
{
|
||||||
// set default parameters
|
|
||||||
var vaultDecryptor = VaultDecryptor is null ? Decryptors.FirstOrDefault() : VaultDecryptor;
|
|
||||||
if (vaultDecryptor is not null)
|
|
||||||
vaultDecryptor.Id = "Vault";
|
|
||||||
|
|
||||||
foreach (var descriptor in TokenDescriptors)
|
|
||||||
descriptor.IdSeparator = FileNameSeparator;
|
|
||||||
|
|
||||||
// Create root folder if it does not exist
|
// Create root folder if it does not exist
|
||||||
if (!Directory.Exists(PemDirectory))
|
if (!Directory.Exists(PemDirectory))
|
||||||
Directory.CreateDirectory(PemDirectory);
|
Directory.CreateDirectory(PemDirectory);
|
||||||
@ -73,7 +65,17 @@ namespace DigitalData.Core.Security.Config
|
|||||||
// set default path
|
// set default path
|
||||||
if (privateKey.IsPemNull)
|
if (privateKey.IsPemNull)
|
||||||
{
|
{
|
||||||
var file_name_params = new List<object> { privateKey.Id, KeySizeInBits, DateTime.Now.ToTag(DateTagFormat) };
|
// file name
|
||||||
|
var file_name_params = new List<object>();
|
||||||
|
|
||||||
|
if (privateKey.Id is not null)
|
||||||
|
file_name_params.Add(privateKey.Id);
|
||||||
|
else if (privateKey is RSATokenDescriptor descriptor)
|
||||||
|
file_name_params.Add(descriptor.Issuer);
|
||||||
|
|
||||||
|
file_name_params.Add(KeySizeInBits);
|
||||||
|
file_name_params.Add(DateTime.Now.ToTag(DateTagFormat));
|
||||||
|
|
||||||
if (privateKey.IsEncrypted)
|
if (privateKey.IsEncrypted)
|
||||||
file_name_params.Add(Secrets.Version);
|
file_name_params.Add(Secrets.Version);
|
||||||
|
|
||||||
|
|||||||
@ -7,10 +7,10 @@ namespace DigitalData.Core.Security.RSAKey
|
|||||||
{
|
{
|
||||||
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
public virtual string Content { get; init; }
|
public virtual string Content { get; init; }
|
||||||
|
|
||||||
public virtual string Id { get; internal set; }
|
|
||||||
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
|
|
||||||
|
public string? Id { get; init; }
|
||||||
|
|
||||||
protected virtual RSA RSA { get; } = RSA.Create();
|
protected virtual RSA RSA { get; } = RSA.Create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8,12 +8,6 @@ namespace DigitalData.Core.Security.RSAKey
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class RSATokenDescriptor : RSAPrivateKey, IAsymmetricTokenDescriptor
|
public class RSATokenDescriptor : RSAPrivateKey, IAsymmetricTokenDescriptor
|
||||||
{
|
{
|
||||||
internal string IdSeparator { get; set; } = "_-_";
|
|
||||||
|
|
||||||
private string? _id;
|
|
||||||
|
|
||||||
public override string Id { get => _id ?? $"{Issuer}{IdSeparator}{Audience}"; internal set => _id = value; }
|
|
||||||
|
|
||||||
public string? ApiRoute { get; init; }
|
public string? ApiRoute { get; init; }
|
||||||
|
|
||||||
#region SecurityTokenDescriptor Map
|
#region SecurityTokenDescriptor Map
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user