mirror of
https://github.com/SteamRE/DepotDownloader.git
synced 2026-10-20 01:46:17 +00:00
Add SymmetricDecryptECB to util
This commit is contained in:
1 parent
b96125f9cb
commit
9d04652f60
2 files changed
+19
-1
No files matched your search
@@ -244,7 +244,7 @@ namespace DepotDownloader
|
||||
byte[] manifest_bytes;
|
||||
try
|
||||
{
|
||||
manifest_bytes = CryptoHelper.SymmetricDecryptECB(input, appBetaPassword);
|
||||
manifest_bytes = Util.SymmetricDecryptECB(input, appBetaPassword);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -133,6 +134,23 @@ namespace DepotDownloader
|
||||
).ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decrypts using AES/ECB/PKCS7
|
||||
/// </summary>
|
||||
public static byte[] SymmetricDecryptECB(byte[] input, byte[] key)
|
||||
{
|
||||
using var aes = Aes.Create();
|
||||
aes.BlockSize = 128;
|
||||
aes.KeySize = 256;
|
||||
aes.Mode = CipherMode.ECB;
|
||||
aes.Padding = PaddingMode.PKCS7;
|
||||
|
||||
using var aesTransform = aes.CreateDecryptor(key, null);
|
||||
var output = aesTransform.TransformFinalBlock(input, 0, input.Length);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
public static async Task InvokeAsync(IEnumerable<Func<Task>> taskFactories, int maxDegreeOfParallelism)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(taskFactories);
|
||||
|
||||
Reference in new issue
Block a user