Fix key obtain (eboot.pbp)
This commit is contained in:
parent
ab38aa8ed4
commit
f14b166dec
|
@ -180,7 +180,7 @@ namespace ChovySign_CLI
|
|||
|
||||
if (drmInfo is null) return Error("no versionkey was found, exiting", 6);
|
||||
|
||||
Console.WriteLine("Version Key: " + BitConverter.ToString(drmInfo.VersionKey).Replace("-", ""));
|
||||
Console.WriteLine("Version Key: " + BitConverter.ToString(drmInfo.VersionKey).Replace("-", "") + ", " + drmInfo.KeyIndex);
|
||||
|
||||
if (pbpMode is null) return Error("no pbp mode was set, exiting", 7);
|
||||
|
||||
|
|
|
@ -362,6 +362,9 @@ namespace PbpResign
|
|||
return false;
|
||||
}
|
||||
|
||||
File.WriteAllBytes("PSAR.BUFF", psarBuff.ToArray());
|
||||
File.WriteAllBytes("HDRHASH.BUFF", npHdr.HeaderHash.ToArray());
|
||||
|
||||
var vkey = new byte[0x10];
|
||||
Span<byte> mkey = stackalloc byte[Marshal.SizeOf<AMCTRL.MAC_KEY>()];
|
||||
AMCTRL.sceDrmBBMacInit(mkey, 3);
|
||||
|
|
|
@ -26,25 +26,25 @@ namespace GameBuilder.VersionKey
|
|||
{
|
||||
StreamUtil ebootUtil = new StreamUtil(ebootStream);
|
||||
ebootStream.Seek(0x1, SeekOrigin.Begin);
|
||||
|
||||
if (ebootUtil.ReadCStr() != "PBP")
|
||||
string pbpMagic = ebootUtil.ReadStrLen(0x3);
|
||||
if (pbpMagic == "PBP")
|
||||
{
|
||||
int dataPspLocation = ebootUtil.ReadInt32At(0x20);
|
||||
int dataPsarLocation = ebootUtil.ReadInt32At(0x24);
|
||||
ebootStream.Seek(dataPsarLocation, SeekOrigin.Begin);
|
||||
|
||||
string magic = ebootUtil.ReadStrLen(8);
|
||||
string psarMagic = ebootUtil.ReadStrLen(8);
|
||||
|
||||
switch (magic)
|
||||
switch (psarMagic)
|
||||
{
|
||||
case "NPUMDIMG":
|
||||
int keyType = ebootUtil.ReadInt32();
|
||||
string contentId = ebootUtil.ReadStringAt(dataPsarLocation + 0x10);
|
||||
|
||||
byte[] npUmdHdr = ebootUtil.ReadBytesAt(dataPsarLocation, 0x100);
|
||||
byte[] npUmdBody = ebootUtil.ReadBytesAt(dataPsarLocation + 0xC0, 0x10);
|
||||
byte[] npUmdHdr = ebootUtil.ReadBytesAt(dataPsarLocation, 0xC0);
|
||||
byte[] npUmdHeaderHash = ebootUtil.ReadBytesAt(dataPsarLocation + 0xC0, 0x10);
|
||||
|
||||
byte[] versionkey = getKey(npUmdHdr, npUmdBody);
|
||||
byte[] versionkey = getKey(npUmdHeaderHash, npUmdHdr);
|
||||
|
||||
return new NpDrmInfo(versionkey, contentId, keyType);
|
||||
case "PSISOIMG":
|
||||
|
@ -66,13 +66,13 @@ namespace GameBuilder.VersionKey
|
|||
return new NpDrmInfo(versionkey, contentId, keyType);
|
||||
}
|
||||
default:
|
||||
throw new Exception("Cannot obtain versionkey from this EBOOT.PBP (magic:" + magic + ")");
|
||||
throw new Exception("Cannot obtain versionkey from this EBOOT.PBP (magic:" + psarMagic + ")");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Invalid PBP");
|
||||
throw new Exception("Invalid PBP (got \"" + pbpMagic + "\", expected \"PBP\")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue