Skip to content

Commit df239ab

Browse files
committed
added new abstract class
1 parent 129214b commit df239ab

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

src/Backend/AESCryptoManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Encryption_App
66
{
77
class AESCryptoManager
88
{
9-
public void AES_Encrypt(string iF, string oF, byte[] passwordBytes)
9+
public void EncryptBytes(string iF, string oF, byte[] passwordBytes)
1010
{
1111

1212
byte[] saltBytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };
@@ -36,7 +36,7 @@ public void AES_Encrypt(string iF, string oF, byte[] passwordBytes)
3636
}
3737
}
3838

39-
public bool AES_Decrypt(string iF, string oF, byte[] passwordBytes)
39+
public bool DecryptBytes(string iF, string oF, byte[] passwordBytes)
4040
{
4141

4242
byte[] saltBytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };

src/Backend/CryptoManager.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Encryption_App.Backend
8+
{
9+
abstract class CryptoManager
10+
{
11+
public abstract byte[] EncryptBytes();
12+
13+
public abstract bool DecryptBytes();
14+
}
15+
}

src/EncryptionApp.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<SubType>Designer</SubType>
6161
</Page>
6262
<Compile Include="Backend\AESCryptoManager.cs" />
63+
<Compile Include="Backend\CryptoManager.cs" />
6364
<Compile Include="Backend\MessageAuthenticator.cs" />
6465
<Compile Include="UI\App.xaml.cs">
6566
<DependentUpon>App.xaml</DependentUpon>

src/UI/MainWindow.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private void Encrypt_Click(object sender, RoutedEventArgs e)
7979
string pwd = InpTxtBox.Text;
8080
string ofilePath = FileTxtBox.Text;
8181
AESCryptoManager encryptor = new AESCryptoManager();
82-
encryptor.AES_Encrypt(ofilePath, System.IO.Path.GetTempPath() + "tempdata.ini", Encoding.UTF8.GetBytes(pwd));
82+
encryptor.EncryptBytes(ofilePath, System.IO.Path.GetTempPath() + "tempdata.ini", Encoding.UTF8.GetBytes(pwd));
8383
File.Copy(System.IO.Path.GetTempPath() + "tempdata.ini", ofilePath, true);
8484
}
8585

@@ -91,7 +91,7 @@ private void Decrypt_Click(object sender, RoutedEventArgs e)
9191
FileInfo f = new FileInfo(ofilePath);
9292

9393
AESCryptoManager decryptor = new AESCryptoManager();
94-
bool worked = decryptor.AES_Decrypt(ofilePath, System.IO.Path.GetTempPath() + "tempdata.ini", Encoding.UTF8.GetBytes(pwd)); ;
94+
bool worked = decryptor.DecryptBytes(ofilePath, System.IO.Path.GetTempPath() + "tempdata.ini", Encoding.UTF8.GetBytes(pwd)); ;
9595
if (worked) { File.Copy(System.IO.Path.GetTempPath() + "tempdata.ini", ofilePath, true); }
9696

9797
if (!worked)

0 commit comments

Comments
 (0)