diff --git a/mRemoteV1/Security/KeyDerivation/IKeyDerivationFunction.cs b/mRemoteV1/Security/KeyDerivation/IKeyDerivationFunction.cs
new file mode 100644
index 000000000..5b081e932
--- /dev/null
+++ b/mRemoteV1/Security/KeyDerivation/IKeyDerivationFunction.cs
@@ -0,0 +1,8 @@
+
+namespace mRemoteNG.Security.KeyDerivation
+{
+ public interface IKeyDerivationFunction
+ {
+ byte[] DeriveKey(string password, byte[] salt);
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/Security/KeyDerivation/Pkcs5S2KeyGenerator.cs b/mRemoteV1/Security/KeyDerivation/Pkcs5S2KeyGenerator.cs
new file mode 100644
index 000000000..2bc3c907b
--- /dev/null
+++ b/mRemoteV1/Security/KeyDerivation/Pkcs5S2KeyGenerator.cs
@@ -0,0 +1,31 @@
+using Org.BouncyCastle.Crypto;
+using Org.BouncyCastle.Crypto.Generators;
+using Org.BouncyCastle.Crypto.Parameters;
+
+
+namespace mRemoteNG.Security.KeyDerivation
+{
+ public class Pkcs5S2KeyGenerator : IKeyDerivationFunction
+ {
+ private readonly int _iterations;
+ private readonly int _keyBitSize;
+
+ public Pkcs5S2KeyGenerator(int keyBitSize = 256, int iterations = 1000)
+ {
+ _keyBitSize = keyBitSize;
+ _iterations = iterations;
+ }
+
+ public byte[] DeriveKey(string password, byte[] salt)
+ {
+ var passwordInBytes = PbeParametersGenerator.Pkcs5PasswordToBytes(password.ToCharArray());
+
+ var keyGenerator = new Pkcs5S2ParametersGenerator();
+ keyGenerator.Init(passwordInBytes, salt, _iterations);
+
+ var keyParameter = (KeyParameter) keyGenerator.GenerateDerivedMacParameters(_keyBitSize);
+ var keyBytes = keyParameter.GetKey();
+ return keyBytes;
+ }
+ }
+}
\ No newline at end of file
diff --git a/mRemoteV1/mRemoteV1.csproj b/mRemoteV1/mRemoteV1.csproj
index 7ea62e8e5..1cc368571 100644
--- a/mRemoteV1/mRemoteV1.csproj
+++ b/mRemoteV1/mRemoteV1.csproj
@@ -192,6 +192,8 @@
+
+