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:
JustArchi
2016-06-28 04:52:00 +02:00
parent 3627a01f59
commit d5514422b6
3 changed files with 1 additions and 40 deletions

View File

@@ -548,10 +548,7 @@ namespace ArchiSteamFarm {
return "Can't encrypt null password!"; return "Can't encrypt null password!";
} }
return Environment.NewLine + return CryptoHelper.ECryptoMethod.AES + "-encrypted password: " + CryptoHelper.Encrypt(CryptoHelper.ECryptoMethod.AES, BotConfig.SteamPassword);
"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);
} }
private static string ResponsePassword(ulong steamID, string botName) { private static string ResponsePassword(ulong steamID, string botName) {

View File

@@ -30,7 +30,6 @@ namespace ArchiSteamFarm {
internal static class CryptoHelper { internal static class CryptoHelper {
internal enum ECryptoMethod : byte { internal enum ECryptoMethod : byte {
PlainText, PlainText,
Base64,
AES AES
} }
@@ -45,8 +44,6 @@ namespace ArchiSteamFarm {
switch (cryptoMethod) { switch (cryptoMethod) {
case ECryptoMethod.PlainText: case ECryptoMethod.PlainText:
return decrypted; return decrypted;
case ECryptoMethod.Base64:
return EncryptBase64(decrypted);
case ECryptoMethod.AES: case ECryptoMethod.AES:
return EncryptAES(decrypted); return EncryptAES(decrypted);
default: default:
@@ -63,8 +60,6 @@ namespace ArchiSteamFarm {
switch (cryptoMethod) { switch (cryptoMethod) {
case ECryptoMethod.PlainText: case ECryptoMethod.PlainText:
return encrypted; return encrypted;
case ECryptoMethod.Base64:
return DecryptBase64(encrypted);
case ECryptoMethod.AES: case ECryptoMethod.AES:
return DecryptAES(encrypted); return DecryptAES(encrypted);
default: 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) { private static string EncryptAES(string decrypted) {
if (string.IsNullOrEmpty(decrypted)) { if (string.IsNullOrEmpty(decrypted)) {
Logging.LogNullError(nameof(decrypted)); Logging.LogNullError(nameof(decrypted));

View File

@@ -37,7 +37,6 @@ namespace ConfigGenerator {
internal sealed class BotConfig : ASFConfig { internal sealed class BotConfig : ASFConfig {
internal enum ECryptoMethod : byte { internal enum ECryptoMethod : byte {
PlainText, PlainText,
Base64,
AES AES
} }