Skip to content

Commit 338bb63

Browse files
authored
Merge pull request #16 from selfmadecode/dev_raphael_aes
restructure folder structure
2 parents 4c0bd03 + 2202855 commit 338bb63

5 files changed

Lines changed: 23 additions & 14 deletions

File tree

Encrypt/AesEncryption/AesEncryption.cs renamed to src/Encryption/AesEncryption/AesEncryption.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
using System;
22
using System.Text;
33
using System.Security.Cryptography;
4+
using SafeCrypt.src.Helpers;
5+
using SafeCrypt.src.Encryption.AesEncryption.Models;
46

5-
namespace SafeCrypt
7+
namespace SafeCrypt.src.Encrypt.AesEncryption
68
{
79
public class AesEncryption : BaseAesEncryption
810
{
@@ -116,12 +118,7 @@ private void NullChecks(string data, string secretKey)
116118

117119
if (secretKey == null || secretKey.Length <= 0)
118120
throw new ArgumentNullException(nameof(secretKey));
119-
}
121+
}
120122
}
121123

122-
public class AesEncryptionData
123-
{
124-
public byte[] Data { get; set; }
125-
public byte[] Iv { get; set; }
126-
}
127124
}

Encrypt/AesEncryption/BaseAesEncryption.cs renamed to src/Encryption/AesEncryption/BaseAesEncryption.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.IO;
33
using System.Security.Cryptography;
44

5-
namespace SafeCrypt
5+
namespace SafeCrypt.src.Encrypt.AesEncryption
66
{
77
public class BaseAesEncryption
88
{
@@ -56,10 +56,10 @@ public static byte[] DecryptAES(byte[] encryptedData, byte[] key, byte[] iv)
5656
}
5757
}
5858

59-
// Method to generate a random byte array of given length
60-
// Used to get the IV
61-
// Generate a random 16-byte IV for AES in CBC mode
62-
public static byte[] GenerateRandomBytes(int length)
59+
// Method to generate a random byte array of given length
60+
// Used to get the IV
61+
// Generate a random 16-byte IV for AES in CBC mode
62+
public static byte[] GenerateRandomBytes(int length)
6363
{
6464
byte[] randomBytes = new byte[length];
6565
using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider())
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace SafeCrypt.src.Encryption.AesEncryption.Models
6+
{
7+
public class AesEncryptionData
8+
{
9+
public byte[] Data { get; set; }
10+
public byte[] Iv { get; set; }
11+
}
12+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Collections.Generic;
33
using System.Text;
44

5-
namespace SafeCrypt
5+
namespace SafeCrypt.src.Enums
66
{
77
public enum ReturnType
88
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.IO;
44
using System.Text;
55

6-
namespace SafeCrypt
6+
namespace SafeCrypt.src.Helpers
77
{
88
public static class Converters
99
{

0 commit comments

Comments
 (0)