diff --git a/NovetusLauncher/NovetusLauncher/ClientinfoCreator.cs b/NovetusLauncher/NovetusLauncher/ClientinfoCreator.cs index d91d8a4..8de8c04 100644 --- a/NovetusLauncher/NovetusLauncher/ClientinfoCreator.cs +++ b/NovetusLauncher/NovetusLauncher/ClientinfoCreator.cs @@ -240,7 +240,7 @@ namespace NovetusLauncher line1 = reader.ReadLine(); } - string ConvertedLine = SecurityFuncs.DecryptText(line1,""); + string ConvertedLine = SecurityFuncs.Base64Decode(line1); string[] result = ConvertedLine.Split('|'); Decryptline1 = SecurityFuncs.Base64Decode(result[0]); Decryptline2 = SecurityFuncs.Base64Decode(result[1]); @@ -338,7 +338,7 @@ namespace NovetusLauncher SecurityFuncs.Base64Encode(AlreadyHasSecurity.ToString()), SecurityFuncs.Base64Encode(CustomArgs.ToString()) }; - File.WriteAllText(sfd.FileName, SecurityFuncs.EncryptText(string.Join("|",lines),"")); + File.WriteAllText(sfd.FileName, SecurityFuncs.Base64Encode(string.Join("|",lines))); SelectedClientInfoPath = Path.GetDirectoryName(sfd.FileName); } } diff --git a/NovetusLauncher/NovetusLauncher/LauncherFuncs.cs b/NovetusLauncher/NovetusLauncher/LauncherFuncs.cs index a377deb..5b47b62 100644 --- a/NovetusLauncher/NovetusLauncher/LauncherFuncs.cs +++ b/NovetusLauncher/NovetusLauncher/LauncherFuncs.cs @@ -333,7 +333,7 @@ namespace NovetusLauncher line1 = reader.ReadLine(); } - string ConvertedLine = SecurityFuncs.DecryptText(line1,""); + string ConvertedLine = SecurityFuncs.Base64Decode(line1); string[] result = ConvertedLine.Split('|'); Decryptline1 = SecurityFuncs.Base64Decode(result[0]); Decryptline2 = SecurityFuncs.Base64Decode(result[1]); @@ -599,93 +599,6 @@ namespace NovetusLauncher { } - public static byte[] AES_Encrypt(byte[] bytesToBeEncrypted, byte[] passwordBytes) - { - byte[] encryptedBytes = null; - byte[] saltBytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }; - using (MemoryStream ms = new MemoryStream()) - { - using (RijndaelManaged AES = new RijndaelManaged()) - { - AES.KeySize = 256; - AES.BlockSize = 128; - var key = new Rfc2898DeriveBytes(passwordBytes, saltBytes, 1000); - AES.Key = key.GetBytes(AES.KeySize / 8); - AES.IV = key.GetBytes(AES.BlockSize / 8); - AES.Mode = CipherMode.CBC; - using (var cs = new CryptoStream(ms, AES.CreateEncryptor(), CryptoStreamMode.Write)) - { - cs.Write(bytesToBeEncrypted, 0, bytesToBeEncrypted.Length); - cs.Close(); - } - encryptedBytes = ms.ToArray(); - } - } - return encryptedBytes; - } - - public static byte[] AES_Decrypt(byte[] bytesToBeDecrypted, byte[] passwordBytes) - { - byte[] decryptedBytes = null; - byte[] saltBytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }; - using (MemoryStream ms = new MemoryStream()) - { - using (RijndaelManaged AES = new RijndaelManaged()) - { - AES.KeySize = 256; - AES.BlockSize = 128; - var key = new Rfc2898DeriveBytes(passwordBytes, saltBytes, 1000); - AES.Key = key.GetBytes(AES.KeySize / 8); - AES.IV = key.GetBytes(AES.BlockSize / 8); - AES.Mode = CipherMode.CBC; - using (var cs = new CryptoStream(ms, AES.CreateDecryptor(), CryptoStreamMode.Write)) - { - cs.Write(bytesToBeDecrypted, 0, bytesToBeDecrypted.Length); - cs.Close(); - } - decryptedBytes = ms.ToArray(); - } - } - return decryptedBytes; - } - - public static string EncryptText(string input, string password) - { - // Get the bytes of the string - byte[] bytesToBeEncrypted = Encoding.UTF8.GetBytes(input); - byte[] passwordBytes = Encoding.UTF8.GetBytes(password); - - // Hash the password with SHA256 - passwordBytes = SHA256.Create().ComputeHash(passwordBytes); - - byte[] bytesEncrypted = AES_Encrypt(bytesToBeEncrypted, passwordBytes); - - string result = Convert.ToBase64String(bytesEncrypted); - - return result; - } - - public static string DecryptText(string input, string password) - { - // Get the bytes of the string - try - { - byte[] bytesToBeDecrypted = Convert.FromBase64String(input); - byte[] passwordBytes = Encoding.UTF8.GetBytes(password); - passwordBytes = SHA256.Create().ComputeHash(passwordBytes); - - byte[] bytesDecrypted = AES_Decrypt(bytesToBeDecrypted, passwordBytes); - - string result = Encoding.UTF8.GetString(bytesDecrypted); - - return result; - } - catch (Exception) - { - return Base64Decode(input); - } - } - public static string RandomString(int length) { CryptoRandom random = new CryptoRandom();