mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-18 23:40:30 +00:00
Kill Base64 encryption
It doesn't make any sense when AES is available, not to mention that it's not even proper encryption...
This commit is contained in:
@@ -548,10 +548,7 @@ namespace ArchiSteamFarm {
|
||||
return "Can't encrypt null password!";
|
||||
}
|
||||
|
||||
return Environment.NewLine +
|
||||
"Password length: " + BotConfig.SteamPassword.Length + Environment.NewLine +
|
||||
CryptoHelper.ECryptoMethod.Base64 + " encrypted: " + CryptoHelper.Encrypt(CryptoHelper.ECryptoMethod.Base64, BotConfig.SteamPassword) + Environment.NewLine +
|
||||
CryptoHelper.ECryptoMethod.AES + " encrypted: " + CryptoHelper.Encrypt(CryptoHelper.ECryptoMethod.AES, BotConfig.SteamPassword);
|
||||
return CryptoHelper.ECryptoMethod.AES + "-encrypted password: " + CryptoHelper.Encrypt(CryptoHelper.ECryptoMethod.AES, BotConfig.SteamPassword);
|
||||
}
|
||||
|
||||
private static string ResponsePassword(ulong steamID, string botName) {
|
||||
|
||||
@@ -30,7 +30,6 @@ namespace ArchiSteamFarm {
|
||||
internal static class CryptoHelper {
|
||||
internal enum ECryptoMethod : byte {
|
||||
PlainText,
|
||||
Base64,
|
||||
AES
|
||||
}
|
||||
|
||||
@@ -45,8 +44,6 @@ namespace ArchiSteamFarm {
|
||||
switch (cryptoMethod) {
|
||||
case ECryptoMethod.PlainText:
|
||||
return decrypted;
|
||||
case ECryptoMethod.Base64:
|
||||
return EncryptBase64(decrypted);
|
||||
case ECryptoMethod.AES:
|
||||
return EncryptAES(decrypted);
|
||||
default:
|
||||
@@ -63,8 +60,6 @@ namespace ArchiSteamFarm {
|
||||
switch (cryptoMethod) {
|
||||
case ECryptoMethod.PlainText:
|
||||
return encrypted;
|
||||
case ECryptoMethod.Base64:
|
||||
return DecryptBase64(encrypted);
|
||||
case ECryptoMethod.AES:
|
||||
return DecryptAES(encrypted);
|
||||
default:
|
||||
@@ -72,36 +67,6 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
private static string EncryptBase64(string decrypted) {
|
||||
if (string.IsNullOrEmpty(decrypted)) {
|
||||
Logging.LogNullError(nameof(decrypted));
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
byte[] data = Encoding.UTF8.GetBytes(decrypted);
|
||||
return Convert.ToBase64String(data);
|
||||
} catch (Exception e) {
|
||||
Logging.LogGenericException(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static string DecryptBase64(string encrypted) {
|
||||
if (string.IsNullOrEmpty(encrypted)) {
|
||||
Logging.LogNullError(nameof(encrypted));
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
byte[] data = Convert.FromBase64String(encrypted);
|
||||
return Encoding.UTF8.GetString(data);
|
||||
} catch (Exception e) {
|
||||
Logging.LogGenericException(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static string EncryptAES(string decrypted) {
|
||||
if (string.IsNullOrEmpty(decrypted)) {
|
||||
Logging.LogNullError(nameof(decrypted));
|
||||
|
||||
@@ -37,7 +37,6 @@ namespace ConfigGenerator {
|
||||
internal sealed class BotConfig : ASFConfig {
|
||||
internal enum ECryptoMethod : byte {
|
||||
PlainText,
|
||||
Base64,
|
||||
AES
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user