Skip to content
Snippets Groups Projects
Commit 5c18b5b2 authored by Ruben wihler's avatar Ruben wihler
Browse files

cleaned documentation

parent f438bba6
No related branches found
No related tags found
No related merge requests found
# EncryptionManager Class Documentation # HybridEncryption class Documentation
## Overview ## Overview
The `EncryptionManager` class provides a set of methods for performing combined RSA and AES encryption and decryption in C#. This class enables the generation of RSA key pairs, encryption of text using a combination of RSA and AES, and subsequent decryption of the encrypted text. The `HybridEncryption` class provides a set of methods for performing combined RSA and AES encryption and decryption in C#. This class enables the generation of RSA key pairs, encryption of text using a combination of RSA and AES, and subsequent decryption of the encrypted text.
## Table of Contents ## Table of Contents
...@@ -41,11 +41,13 @@ None ...@@ -41,11 +41,13 @@ None
#### Example #### Example
```csharp ```csharp
var keys = EncryptionManager.GenerateRSAKeys(); var keys = HybridEncryption.GenerateRSAKeys();
var publicKey = keys.publicKey; var publicKey = keys.publicKey;
var privateKey = keys.privateKey; var privateKey = keys.privateKey;
``` ```
------------------------------------------------------------------------------------------------------------------------
## Text Encryption <a name="text-encryption"></a> ## Text Encryption <a name="text-encryption"></a>
```csharp ```csharp
...@@ -78,12 +80,14 @@ public static (string text, string aesKey, string aesIV) Encrypt(string text, st ...@@ -78,12 +80,14 @@ public static (string text, string aesKey, string aesIV) Encrypt(string text, st
#### Example #### Example
```csharp ```csharp
var encryptionResult = EncryptionManager.Encrypt("Hello, World!", publicKey); var encryptionResult = HybridEncryption.Encrypt("Hello, World!", publicKey);
var encryptedText = encryptionResult.text; var encryptedText = encryptionResult.text;
var encryptedAESKey = encryptionResult.aesKey; var encryptedAESKey = encryptionResult.aesKey;
var encryptedAESIV = encryptionResult.aesIV; var encryptedAESIV = encryptionResult.aesIV;
``` ```
------------------------------------------------------------------------------------------------------------------------
## Text Decryption <a name="text-decryption"></a> ## Text Decryption <a name="text-decryption"></a>
```csharp ```csharp
...@@ -116,7 +120,7 @@ public static string Decrypt(string encryptedText, string aesKey, string aesIV, ...@@ -116,7 +120,7 @@ public static string Decrypt(string encryptedText, string aesKey, string aesIV,
#### Example #### Example
```csharp ```csharp
var decryptedText = EncryptionManager.Decrypt(encryptedText, encryptedAESKey, encryptedAESIV, privateKey); var decryptedText = HybridEncryption.Decrypt(encryptedText, encryptedAESKey, encryptedAESIV, privateKey);
``` ```
## Private Methods <a name="private-methods"></a> ## Private Methods <a name="private-methods"></a>
...@@ -146,6 +150,8 @@ private static byte[] RsaEncrypt(string data, string publicKey) ...@@ -146,6 +150,8 @@ private static byte[] RsaEncrypt(string data, string publicKey)
- The encrypted data. - The encrypted data.
------------------------------------------------------------------------------------------------------------------------
```csharp ```csharp
private static byte[] RsaDecrypt(string data, string privateKey) private static byte[] RsaDecrypt(string data, string privateKey)
``` ```
...@@ -171,6 +177,8 @@ private static byte[] RsaDecrypt(string data, string privateKey) ...@@ -171,6 +177,8 @@ private static byte[] RsaDecrypt(string data, string privateKey)
- The decrypted data. - The decrypted data.
------------------------------------------------------------------------------------------------------------------------
```csharp ```csharp
private static byte[] AesEncrypt(string data, byte[] key, byte[] IV) private static byte[] AesEncrypt(string data, byte[] key, byte[] IV)
``` ```
...@@ -197,6 +205,8 @@ private static byte[] AesEncrypt(string data, byte[] key, byte[] IV) ...@@ -197,6 +205,8 @@ private static byte[] AesEncrypt(string data, byte[] key, byte[] IV)
- The encrypted data. - The encrypted data.
------------------------------------------------------------------------------------------------------------------------
```csharp ```csharp
private static string AesDecrypt(byte[] cipherText, byte[] key, byte[] IV) private static string AesDecrypt(byte[] cipherText, byte[] key, byte[] IV)
``` ```
...@@ -223,6 +233,8 @@ private static string AesDecrypt(byte[] cipherText, byte[] key, byte[] IV) ...@@ -223,6 +233,8 @@ private static string AesDecrypt(byte[] cipherText, byte[] key, byte[] IV)
- The decrypted data. - The decrypted data.
------------------------------------------------------------------------------------------------------------------------
```csharp ```csharp
private static (byte[] key, byte[] IV) GenerateAESKey() private static (byte[] key, byte[] IV) GenerateAESKey()
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment