From 8cc6fd95f7fff50b9073257898343a8af48a54c8 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Mon, 18 Nov 2024 10:54:57 +0100 Subject: [PATCH] =?UTF-8?q?feat(Abstraktionen.Sicherheit):=20Schnittstelle?= =?UTF-8?q?n=20f=C3=BCr=20IRSACryptographer,=20IRSADecryptor=20und=20IRSAE?= =?UTF-8?q?ncryptor=20erstellt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Security/IRSACryptographer.cs | 9 +++++++++ .../Security/IRSADecryptor.cs | 13 +++++++++++++ .../Security/IRSAEncryptor.cs | 13 +++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 DigitalData.Core.Abstractions/Security/IRSACryptographer.cs create mode 100644 DigitalData.Core.Abstractions/Security/IRSADecryptor.cs create mode 100644 DigitalData.Core.Abstractions/Security/IRSAEncryptor.cs diff --git a/DigitalData.Core.Abstractions/Security/IRSACryptographer.cs b/DigitalData.Core.Abstractions/Security/IRSACryptographer.cs new file mode 100644 index 0000000..2da1e43 --- /dev/null +++ b/DigitalData.Core.Abstractions/Security/IRSACryptographer.cs @@ -0,0 +1,9 @@ +using System.Security.Cryptography; + +namespace DigitalData.Core.Abstractions.Security +{ + public interface IRSACryptographer + { + public RSAEncryptionPadding Padding { get; init; } + } +} \ No newline at end of file diff --git a/DigitalData.Core.Abstractions/Security/IRSADecryptor.cs b/DigitalData.Core.Abstractions/Security/IRSADecryptor.cs new file mode 100644 index 0000000..88864e0 --- /dev/null +++ b/DigitalData.Core.Abstractions/Security/IRSADecryptor.cs @@ -0,0 +1,13 @@ +namespace DigitalData.Core.Abstractions.Security +{ + public interface IRSADecryptor : IRSACryptographer + { + public string PrivateKeyPem { init; } + + public IRSAEncryptor Encryptor { get; } + + public byte[] Decrypt(byte[] data); + + public string Decrypt(string data); + } +} \ No newline at end of file diff --git a/DigitalData.Core.Abstractions/Security/IRSAEncryptor.cs b/DigitalData.Core.Abstractions/Security/IRSAEncryptor.cs new file mode 100644 index 0000000..b3fa28c --- /dev/null +++ b/DigitalData.Core.Abstractions/Security/IRSAEncryptor.cs @@ -0,0 +1,13 @@ +namespace DigitalData.Core.Abstractions.Security +{ + public interface IRSAEncryptor : IRSACryptographer + { + public string PublicKeyPem { get; init; } + + public byte[] Encrypt(byte[] data); + + public string Encrypt(string data); + + public bool Verify(string data, string signature) => Encrypt(data) == signature; + } +} \ No newline at end of file