Archived
1
1

First release build.

This commit is contained in:
Mona Lassa
2025-05-22 01:31:03 +02:00
parent ec55169d57
commit f90695dfda
30 changed files with 499 additions and 1389 deletions

View File

@@ -72,9 +72,7 @@ namespace MetroUnlocker.LibTSForge.Crypto
byte[] hash;
using (SHA1 sha1 = SHA1.Create())
{
hash = sha1.ComputeHash(data);
}
return formatter.CreateSignature(hash);
}
@@ -90,9 +88,7 @@ namespace MetroUnlocker.LibTSForge.Crypto
byte[] hash;
using (SHA1 sha1 = SHA1.Create())
{
hash = sha1.ComputeHash(data);
}
return deformatter.VerifySignature(hash, signature);
}
@@ -113,9 +109,7 @@ namespace MetroUnlocker.LibTSForge.Crypto
public static byte[] SHA256Hash(byte[] data)
{
using (SHA256 sha256 = SHA256.Create())
{
return sha256.ComputeHash(data);
}
}
}
}

View File

@@ -2,7 +2,7 @@ namespace MetroUnlocker.LibTSForge.Crypto
{
public static class Keys
{
public static readonly byte[] PRODUCTION = {
public static readonly byte[] Production = {
0x07, 0x02, 0x00, 0x00, 0x00, 0xA4, 0x00, 0x00, 0x52, 0x53, 0x41, 0x32, 0x00, 0x04, 0x00, 0x00,
0x01, 0x00, 0x01, 0x00, 0x29, 0x87, 0xBA, 0x3F, 0x52, 0x90, 0x57, 0xD8, 0x12, 0x26, 0x6B, 0x38,
0xB2, 0x3B, 0xF9, 0x67, 0x08, 0x4F, 0xDD, 0x8B, 0xF5, 0xE3, 0x11, 0xB8, 0x61, 0x3A, 0x33, 0x42,
@@ -43,7 +43,7 @@ namespace MetroUnlocker.LibTSForge.Crypto
0x81, 0x44, 0x38, 0xBF
};
public static readonly byte[] TEST = {
public static readonly byte[] Test = {
0x07, 0x02, 0x00, 0x00, 0x00, 0xA4, 0x00, 0x00, 0x52, 0x53, 0x41, 0x32, 0x00, 0x04, 0x00, 0x00,
0x01, 0x00, 0x01, 0x00, 0x0F, 0xBE, 0x77, 0xB8, 0xDD, 0x54, 0x36, 0xDD, 0x67, 0xD4, 0x17, 0x66,
0xC4, 0x13, 0xD1, 0x3F, 0x1E, 0x16, 0x0C, 0x16, 0x35, 0xAB, 0x6D, 0x3D, 0x34, 0x51, 0xED, 0x3F,

View File

@@ -12,7 +12,7 @@ namespace MetroUnlocker.LibTSForge.Crypto
{
public static byte[] DecryptPhysicalStore(byte[] data, bool production)
{
byte[] rsaKey = production ? Keys.PRODUCTION : Keys.TEST;
byte[] rsaKey = production ? Keys.Production : Keys.Test;
BinaryReader br = new BinaryReader(new MemoryStream(data));
br.BaseStream.Seek(0x10, SeekOrigin.Begin);
byte[] aesKeySig = br.ReadBytes(0x80);
@@ -33,16 +33,16 @@ namespace MetroUnlocker.LibTSForge.Crypto
return psData;
}
public static byte[] EncryptPhysicalStore(byte[] data, bool production, PSVersion version)
public static byte[] EncryptPhysicalStore(byte[] data, bool production, PhysicalStoreVersion version)
{
Dictionary<PSVersion, int> versionTable = new Dictionary<PSVersion, int>
Dictionary<PhysicalStoreVersion, int> versionTable = new Dictionary<PhysicalStoreVersion, int>
{
{PSVersion.Win8, 1},
{PSVersion.WinBlue, 2},
{PSVersion.WinModern, 3}
{PhysicalStoreVersion.Win8, 1},
{PhysicalStoreVersion.WinBlue, 2},
{PhysicalStoreVersion.WinModern, 3}
};
byte[] rsaKey = production ? Keys.PRODUCTION : Keys.TEST;
byte[] rsaKey = production ? Keys.Production : Keys.Test;
byte[] aesKey = Encoding.UTF8.GetBytes("Boop Foxyz nose!");
byte[] hmacKey = CryptoUtils.GenerateRandomKey(0x10);