refactor(Core.Security): Implementierung der entsprechenden Schnittstellen zu RSACryptographer, RSADecryptor und RSAEncryptor.
This commit is contained in:
parent
51ebf3fa67
commit
0bb779b7b6
@ -7,6 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DigitalData.Core.Abstractions\DigitalData.Core.Abstractions.csproj" />
|
||||
<ProjectReference Include="..\DigitalData.Core.Security.Extensions\DigitalData.Core.Security.Extensions.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
using System.Security.Cryptography;
|
||||
using DigitalData.Core.Abstractions.Security;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace DigitalData.Core.Security
|
||||
{
|
||||
public class RSACryptographer
|
||||
public class RSACryptographer : IRSACryptographer
|
||||
{
|
||||
public required RSAEncryptionPadding Padding { get; init; }
|
||||
|
||||
|
||||
@ -1,19 +1,20 @@
|
||||
using DigitalData.Core.Security.Extensions;
|
||||
using DigitalData.Core.Abstractions.Security;
|
||||
using DigitalData.Core.Security.Extensions;
|
||||
|
||||
namespace DigitalData.Core.Security
|
||||
{
|
||||
public class RSADecryptor : RSACryptographer
|
||||
public class RSADecryptor : RSACryptographer, IRSADecryptor, IRSACryptographer
|
||||
{
|
||||
public required string PrivateKeyPem
|
||||
{
|
||||
init => _rsa.ImportFromPem(value);
|
||||
}
|
||||
|
||||
public RSAEncryptor Encryptor
|
||||
public IRSAEncryptor Encryptor
|
||||
{
|
||||
get
|
||||
{
|
||||
return new ()
|
||||
return new RSAEncryptor()
|
||||
{
|
||||
PublicKeyPem = _rsa.ExportRSAPublicKeyPem(),
|
||||
Padding = Padding
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
using DigitalData.Core.Security.Extensions;
|
||||
using DigitalData.Core.Abstractions.Security;
|
||||
using DigitalData.Core.Security.Extensions;
|
||||
|
||||
namespace DigitalData.Core.Security
|
||||
{
|
||||
public class RSAEncryptor : RSACryptographer
|
||||
public class RSAEncryptor : RSACryptographer, IRSAEncryptor, IRSACryptographer
|
||||
{
|
||||
public required string PublicKeyPem
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user