Fixed encryption changes not being written
This commit is contained in:
parent
c0c14e1fc3
commit
1b6a702593
2 changed files with 9 additions and 6 deletions
10
Manifest.cs
10
Manifest.cs
|
@ -304,8 +304,8 @@ public class Manifest
|
|||
|
||||
public bool SaveAccount(SteamGuardAccount account, bool encrypt, string passKey = null, string salt = null, string iV = null)
|
||||
{
|
||||
if (encrypt && String.IsNullOrEmpty(passKey)) return false;
|
||||
if (!encrypt && this.Encrypted) return false;
|
||||
if (encrypt && (String.IsNullOrEmpty(passKey) || String.IsNullOrEmpty(salt) || String.IsNullOrEmpty(iV))) return false;
|
||||
//if (!encrypt && this.Encrypted) return false;
|
||||
|
||||
string jsonAccount = JsonConvert.SerializeObject(account);
|
||||
|
||||
|
@ -337,7 +337,7 @@ public class Manifest
|
|||
}
|
||||
|
||||
bool wasEncrypted = this.Encrypted;
|
||||
this.Encrypted = encrypt || this.Encrypted;
|
||||
this.Encrypted = encrypt;// || this.Encrypted;
|
||||
|
||||
if (!this.Save())
|
||||
{
|
||||
|
@ -351,7 +351,7 @@ public class Manifest
|
|||
MemoryStream ms = null;
|
||||
RijndaelManaged aes256;
|
||||
|
||||
if (Encrypted)
|
||||
if (encrypt)
|
||||
{
|
||||
ms = new MemoryStream();
|
||||
byte[] key = GetEncryptionKey(passKey, newEntry.Salt);
|
||||
|
@ -377,7 +377,7 @@ public class Manifest
|
|||
writer.Write(jsonAccount);
|
||||
}
|
||||
|
||||
if (Encrypted)
|
||||
if (encrypt)
|
||||
{
|
||||
File.WriteAllText(Path.Combine(Program.SteamGuardPath, newEntry.Filename), Convert.ToBase64String(ms.ToArray()));
|
||||
}
|
||||
|
|
|
@ -185,7 +185,10 @@ public static class Program
|
|||
for (int i = 0; i < SteamGuardAccounts.Length; i++)
|
||||
{
|
||||
var account = SteamGuardAccounts[i];
|
||||
bool success = Manifest.SaveAccount(account, true, newPassKey, Manifest.GetRandomSalt(), Manifest.GetInitializationVector());
|
||||
var salt = Manifest.GetRandomSalt();
|
||||
var iv = Manifest.GetInitializationVector();
|
||||
if (Program.Verbose) Console.WriteLine($"New encryption info: pass: {newPassKey}, salt: {salt}, iv: {iv}");
|
||||
bool success = Manifest.SaveAccount(account, true, newPassKey, salt, iv);
|
||||
if (Verbose) Console.WriteLine("Encrypted {0}: {1}", account.AccountName, success);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue