Add stuff
This commit is contained in:
parent
b98eac4789
commit
318cd09f5a
|
@ -149,8 +149,28 @@ namespace CHOVY_SIGN
|
|||
{
|
||||
Action enable = () => {
|
||||
this.FREEDOM.Enabled = true;
|
||||
this.Ps1Menu.Enabled = true;
|
||||
this.FindFromCMA.Enabled = true;
|
||||
this.RifPath.ReadOnly = false;
|
||||
this.Versionkey.ReadOnly = false;
|
||||
this.ISOPath.ReadOnly = false;
|
||||
this.CompressPBP.Enabled = true;
|
||||
this.BrowseButton.Enabled = true;
|
||||
};
|
||||
|
||||
Action disable = () => {
|
||||
this.FREEDOM.Enabled = false;
|
||||
this.Ps1Menu.Enabled = false;
|
||||
this.FindFromCMA.Enabled = false;
|
||||
this.RifPath.ReadOnly = true;
|
||||
this.Versionkey.ReadOnly = true;
|
||||
this.ISOPath.ReadOnly = true;
|
||||
this.CompressPBP.Enabled = false;
|
||||
this.BrowseButton.Enabled = false;
|
||||
};
|
||||
|
||||
disable();
|
||||
|
||||
bool isZrif = false;
|
||||
if(RifPath.Text == "" || !File.Exists(RifPath.Text))
|
||||
{
|
||||
|
@ -163,6 +183,7 @@ namespace CHOVY_SIGN
|
|||
catch(Exception)
|
||||
{
|
||||
MessageBox.Show("INVALID RIF!\nPlease try \"Find from CMA\"", "RIF ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
enable();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -170,11 +191,13 @@ namespace CHOVY_SIGN
|
|||
if(Versionkey.Text.Length != 32)
|
||||
{
|
||||
MessageBox.Show("INVALID VERSION KEY!\nPlease try \"Find from CMA\"", "VERKEY ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
enable();
|
||||
return;
|
||||
}
|
||||
if(ISOPath.Text == "" || !File.Exists(ISOPath.Text))
|
||||
{
|
||||
MessageBox.Show("INVALID ISO PATH!", "ISO ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
enable();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -276,19 +299,7 @@ namespace CHOVY_SIGN
|
|||
}
|
||||
}
|
||||
|
||||
/*Process signnp = pbp.GenPbpFromIso(ISOPath.Text, EbootFile, ContentID, Versionkey.Text, CompressPBP.Checked, BootupImage);
|
||||
while (!signnp.HasExited)
|
||||
{
|
||||
string Progress = signnp.StandardOutput.ReadLine();
|
||||
if(Progress.StartsWith("Writing ISO blocks: "))
|
||||
{
|
||||
Progress = Progress.Remove(0,19);
|
||||
int ProgressInt = int.Parse(Progress.Substring(0,3));
|
||||
TotalProgress.Value = ProgressInt;
|
||||
Status.Text = "Overthrowing The PSPEMU Monarchy " + ProgressInt.ToString() + "%";
|
||||
}
|
||||
Application.DoEvents();
|
||||
}*/
|
||||
|
||||
TotalProgress.Value = 0;
|
||||
|
||||
Status.Text = "Signing the Declaration of Independance 0%";
|
||||
|
@ -297,12 +308,6 @@ namespace CHOVY_SIGN
|
|||
{
|
||||
|
||||
int ChovyGenRes = Pbp.gen__sce_ebootpbp(EbootFile, IntAid, EbootSignature);
|
||||
if (!File.Exists(EbootSignature) || ChovyGenRes != 0)
|
||||
{
|
||||
MessageBox.Show("CHOVY-GEN Failed! Please check CHOVY-KIRK.DLL exists");
|
||||
enable();
|
||||
return;
|
||||
}
|
||||
});
|
||||
ChovyGenThread.Start();
|
||||
while(ChovyGenThread.IsAlive)
|
||||
|
|
|
@ -96,32 +96,6 @@ namespace CHOVY_SIGN
|
|||
// PSVita
|
||||
[DllImport("CHOVY-GEN.DLL", CallingConvention = CallingConvention.Cdecl)]
|
||||
private unsafe static extern int chovy_gen(string ebootpbp, UInt64 AID, string outscefile);
|
||||
public static Process GenPbpFromIso(string ISOPath, string OutputPBP, string ContentId, string VersionKey, bool compress, string bootup="")
|
||||
{
|
||||
string SignNpArgs = "-pbp ";
|
||||
if(compress)
|
||||
{
|
||||
SignNpArgs += "-c ";
|
||||
}
|
||||
SignNpArgs += "\"" + ISOPath + "\" ";
|
||||
SignNpArgs += "\"" + OutputPBP + "\" ";
|
||||
SignNpArgs += ContentId+" ";
|
||||
SignNpArgs += VersionKey;
|
||||
if(bootup != "")
|
||||
{
|
||||
SignNpArgs += " \"" + bootup + "\" ";
|
||||
}
|
||||
|
||||
Process signnp = new Process();
|
||||
signnp.StartInfo.FileName = Path.Combine(Application.StartupPath, "tools", "sign_np.exe");
|
||||
signnp.StartInfo.Arguments = SignNpArgs;
|
||||
signnp.StartInfo.CreateNoWindow = true;
|
||||
signnp.StartInfo.UseShellExecute = false;
|
||||
signnp.StartInfo.RedirectStandardOutput = true;
|
||||
signnp.StartInfo.RedirectStandardError = true;
|
||||
signnp.Start();
|
||||
return signnp;
|
||||
}
|
||||
|
||||
public static int NumberOfSectors = 0;
|
||||
public static int SectorsDone = 0;
|
||||
|
@ -153,7 +127,7 @@ namespace CHOVY_SIGN
|
|||
int fz = process_pgd(pgd, pgd.Length, 2);
|
||||
if(fz < 0)
|
||||
{
|
||||
throw new Exception("Failed to decrypt!");
|
||||
throw new Exception("Failed to decrypt IS1ISO Header.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -278,21 +252,21 @@ namespace CHOVY_SIGN
|
|||
|
||||
if (sceUtilsBufferCopyWithRange(DataPspSignBufOut, DataPspSignBufOut.Length, DataPspSignBufIn, DataPspSignBufIn.Length, KIRK_CMD_ECDSA_SIGN) != 0)
|
||||
{
|
||||
throw new Exception("Failed to generate ECDSA signature for DATA.PSP!\n");
|
||||
throw new Exception("Failed to generate ECDSA signature");
|
||||
}
|
||||
return DataPspSignBufOut;
|
||||
}
|
||||
|
||||
public static void VerifySignature(bool PS1,byte[] Hash, byte[] Signature)
|
||||
{
|
||||
DoEvents = false;
|
||||
DoEvents = false; // Chovy crashes if Application.DoEvents is called while verifying a signature.. for some reason
|
||||
byte[] TestData = new byte[0x64];
|
||||
Array.ConstrainedCopy(npumdimg_public_key, 0, TestData, 0, npumdimg_public_key.Length);
|
||||
Array.ConstrainedCopy(Hash, 0, TestData, npumdimg_public_key.Length, Hash.Length);
|
||||
Array.ConstrainedCopy(Signature, 0, TestData, npumdimg_public_key.Length + Hash.Length, Signature.Length);
|
||||
if (sceUtilsBufferCopyWithRange(null, 0, TestData, TestData.Length, KIRK_CMD_ECDSA_VERIFY) != 0)
|
||||
{
|
||||
throw new Exception("ECDSA signature for "+BitConverter.ToString(Hash)+" is invalid!\n");
|
||||
throw new Exception("ECDSA signature is invalid!");
|
||||
}
|
||||
DoEvents = true;
|
||||
}
|
||||
|
@ -587,7 +561,7 @@ namespace CHOVY_SIGN
|
|||
bbmac_build_final2(3, Tb);
|
||||
|
||||
// Encrypt table.
|
||||
byte[] EncTb = encrypt_table(Tb);
|
||||
byte[] EncTb = EncryptTable(Tb);
|
||||
|
||||
// Write ISO data.
|
||||
WSize = (WSize + 15) & ~15;
|
||||
|
@ -630,7 +604,7 @@ namespace CHOVY_SIGN
|
|||
System.Buffer.BlockCopy(Uint32Array, 0, decode, 0, Uint32Array.Length * 4);
|
||||
return decode;
|
||||
}
|
||||
public static byte[] encrypt_table(byte[] table)
|
||||
public static byte[] EncryptTable(byte[] table)
|
||||
{
|
||||
|
||||
UInt32[] p = ByteArrayToUint32Array(table);
|
||||
|
@ -650,7 +624,6 @@ namespace CHOVY_SIGN
|
|||
}
|
||||
public static void BuildPbp(Stream Str, Stream Iso, bool Compress, byte[] VersionKey, Bitmap start_image, string content_id, byte[] param_sfo,byte[] icon0, byte[] icon1pmf, byte[] pic0, byte[] pic1, byte[] sndat3)
|
||||
{
|
||||
|
||||
DoEvents = true;
|
||||
kirk_init();
|
||||
|
||||
|
|
Loading…
Reference in New Issue