Refactor(RSACryptographer): Entfernte Pem initter Methode.

- PrivateKeyPem initter Methode zu RSADecryptor hinzugefügt.
 - PublicKeyPem getter und initter Methoden zu RSAEncryptor hinzugefügt.
This commit is contained in:
Developer 02
2024-11-18 10:33:38 +01:00
parent 0804ea1418
commit 489ca67203
3 changed files with 16 additions and 15 deletions

View File

@@ -2,6 +2,12 @@
{
public class RSAEncryptor : RSACryptographer
{
public required string PublicKeyPem
{
get => _rsa.ExportRSAPublicKeyPem();
init => _rsa.ImportFromPem(value);
}
public byte[] Encrypt(byte[] data) => _rsa.Encrypt(data, Padding);
public string Encrypt(string data) => _rsa.Encrypt(data.Base64ToByte(), Padding).BytesToString();