fixed CryptographicException: Length of the data to decrypt is invalid. when attempting to decrypt
This commit is contained in:
parent
374fe6c793
commit
6fab87b485
1 changed files with 6 additions and 7 deletions
13
Manifest.cs
13
Manifest.cs
|
@ -227,11 +227,11 @@ public class Manifest
|
||||||
{
|
{
|
||||||
string fileText = "";
|
string fileText = "";
|
||||||
Stream stream = null;
|
Stream stream = null;
|
||||||
FileStream fileStream = File.OpenRead(Path.Combine(Program.SteamGuardPath, entry.Filename));
|
|
||||||
RijndaelManaged aes256;
|
RijndaelManaged aes256;
|
||||||
|
|
||||||
if (this.Encrypted)
|
if (this.Encrypted)
|
||||||
{
|
{
|
||||||
|
MemoryStream ms = new MemoryStream(Convert.FromBase64String(File.ReadAllText(Path.Combine(Program.SteamGuardPath, entry.Filename))));
|
||||||
byte[] key = GetEncryptionKey(passKey, entry.Salt);
|
byte[] key = GetEncryptionKey(passKey, entry.Salt);
|
||||||
|
|
||||||
aes256 = new RijndaelManaged
|
aes256 = new RijndaelManaged
|
||||||
|
@ -243,21 +243,20 @@ public class Manifest
|
||||||
};
|
};
|
||||||
|
|
||||||
ICryptoTransform decryptor = aes256.CreateDecryptor(aes256.Key, aes256.IV);
|
ICryptoTransform decryptor = aes256.CreateDecryptor(aes256.Key, aes256.IV);
|
||||||
stream = new CryptoStream(fileStream, decryptor, CryptoStreamMode.Read);
|
stream = new CryptoStream(ms, decryptor, CryptoStreamMode.Read);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
FileStream fileStream = File.OpenRead(Path.Combine(Program.SteamGuardPath, entry.Filename));
|
||||||
stream = fileStream;
|
stream = fileStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] b = new byte[1024];
|
if (Program.Verbose) Console.WriteLine("Decrypting...");
|
||||||
StringBuilder sb = new StringBuilder();
|
using (StreamReader reader = new StreamReader(stream))
|
||||||
while (stream.Read(b,0,b.Length) > 0)
|
|
||||||
{
|
{
|
||||||
sb.Append(Encoding.UTF8.GetString(b));
|
fileText = reader.ReadToEnd();
|
||||||
}
|
}
|
||||||
stream.Close();
|
stream.Close();
|
||||||
fileText = sb.ToString();
|
|
||||||
|
|
||||||
var account = JsonConvert.DeserializeObject<SteamAuth.SteamGuardAccount>(fileText);
|
var account = JsonConvert.DeserializeObject<SteamAuth.SteamGuardAccount>(fileText);
|
||||||
if (account == null) continue;
|
if (account == null) continue;
|
||||||
|
|
Loading…
Reference in a new issue