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:
parent
cf375a587e
commit
358cfdb707
@ -32,8 +32,13 @@ public class ClientPublicKey : RSAKeyBase, IAsymmetricTokenValidator, IUniqueSec
|
||||
internal void UpdateContent(string content)
|
||||
{
|
||||
_content = content;
|
||||
RSA.ImportFromPem(content);
|
||||
SecurityKey = new RsaSecurityKey(RSA);
|
||||
if (string.IsNullOrWhiteSpace(content))
|
||||
SecurityKey = new RsaSecurityKey(RSA.Create());
|
||||
else
|
||||
{
|
||||
RSA.ImportFromPem(content);
|
||||
SecurityKey = new RsaSecurityKey(RSA);
|
||||
}
|
||||
}
|
||||
|
||||
public SecurityKey SecurityKey { get; private set; } = new RsaSecurityKey(RSA.Create());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user