feat(RSAFactory): Optionale Verschlüsselungseingabe in CreatePrivateKeyPem Methode hinzugefügt.

- Falsch als Standard eingestellt.
This commit is contained in:
Developer 02
2024-12-16 10:01:09 +01:00
parent 7da93c6719
commit eced1a5afc
2 changed files with 6 additions and 5 deletions

View File

@@ -11,8 +11,9 @@ namespace DigitalData.Core.Security.Cryptographer
public RSAFactory(IOptions<TRSAFactoryParams> options) => _params = options.Value;
public string CreatePrivateKeyPem(int? keySizeInBits = null)
=> RSA.Create(keySizeInBits ?? _params.KeySizeInBits).ExportRSAPrivateKeyPem();
public string CreatePrivateKeyPem(int? keySizeInBits = null, bool encrypt = false) => encrypt
? CreateEncryptedPrivateKeyPem(keySizeInBits: keySizeInBits)
: RSA.Create(keySizeInBits ?? _params.KeySizeInBits).ExportRSAPrivateKeyPem();
public string CreateEncryptedPrivateKeyPem(
PbeEncryptionAlgorithm? pbeEncryptionAlgorithm = null,