fix: Behandlung von leeren PEM-Inhalten in der ClientPublicKey-Klasse
- Die UpdateContent-Methode wurde aktualisiert, um den SecurityKey zurückzusetzen, wenn der PEM-Inhalt leer oder mit Leerzeichen versehen ist. - Es wurde sichergestellt, dass ein neuer RSA-Schlüssel erstellt wird, wenn der Inhalt ungültig oder nicht vorhanden ist.
This commit is contained in:
@@ -32,9 +32,14 @@ public class ClientPublicKey : RSAKeyBase, IAsymmetricTokenValidator, IUniqueSec
|
|||||||
internal void UpdateContent(string content)
|
internal void UpdateContent(string content)
|
||||||
{
|
{
|
||||||
_content = content;
|
_content = content;
|
||||||
|
if (string.IsNullOrWhiteSpace(content))
|
||||||
|
SecurityKey = new RsaSecurityKey(RSA.Create());
|
||||||
|
else
|
||||||
|
{
|
||||||
RSA.ImportFromPem(content);
|
RSA.ImportFromPem(content);
|
||||||
SecurityKey = new RsaSecurityKey(RSA);
|
SecurityKey = new RsaSecurityKey(RSA);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public SecurityKey SecurityKey { get; private set; } = new RsaSecurityKey(RSA.Create());
|
public SecurityKey SecurityKey { get; private set; } = new RsaSecurityKey(RSA.Create());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user