Update to beta03

This commit is contained in:
SilicaAndPina 2019-10-10 20:17:29 +13:00
parent 6bd010e50f
commit 88d9b69903
17 changed files with 2463 additions and 216 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
</configuration>

View File

@ -5,10 +5,10 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D46AA2C2-2BDC-45C7-ACA5-D7A2295564E8}</ProjectGuid>
<OutputType>Exe</OutputType>
<OutputType>WinExe</OutputType>
<RootNamespace>CHOVY</RootNamespace>
<AssemblyName>CHOVY-SIGN</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
@ -37,6 +37,9 @@
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
<HintPath>..\packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll</HintPath>
@ -84,7 +87,6 @@
<Compile Include="PSVIMGFileStream.cs" />
<Compile Include="PSVIMGStream.cs" />
<Compile Include="PSVIMGStructs.cs" />
<Compile Include="psvimgtools.cs" />
<Compile Include="PSVMDBuilder.cs" />
<EmbeddedResource Include="CHOVY.resx">
<DependentUpon>CHOVY.cs</DependentUpon>
@ -128,5 +130,11 @@
<ItemGroup>
<None Include="Resources\MINIS.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\ChovyLogo.png" />
</ItemGroup>
<ItemGroup>
<Content Include="Icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -9,7 +9,7 @@ using System.Drawing;
using System.IO;
using System.Media;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Windows.Forms;
namespace CHOVY
@ -156,20 +156,10 @@ namespace CHOVY
string TitleID = GetTitleID(ISOPath.Text);
string TmpDir = Path.Combine(Application.StartupPath, "_tmp");
string GameWorkDir = Path.Combine(TmpDir, "ux0_pspemu_temp_game_PSP_GAME_"+ TitleID);
// string GameWorkDir = Path.Combine(TmpDir, TitleID);
string LicenseWorkDir = Path.Combine(TmpDir, "ux0_pspemu_temp_game_PSP_LICENSE");
string GameWorkDir = Path.Combine(TmpDir, TitleID);
string EbootFile = Path.Combine(GameWorkDir, "EBOOT.PBP");
string EbootSignature = Path.Combine(GameWorkDir, "__sce_ebootpbp");
string GamePathFile = Path.Combine(GameWorkDir, "VITA_PATH.TXT");
string LicensePathFile = Path.Combine(LicenseWorkDir, "VITA_PATH.TXT");
try
{
Directory.Delete(TmpDir, true);
}
catch (Exception) { };
Directory.CreateDirectory(TmpDir);
Directory.CreateDirectory(GameWorkDir);
@ -188,8 +178,8 @@ namespace CHOVY
string Aid = BitConverter.ToString(RifAid).Replace("-", "").ToLower();
string BackupWorkDir = Path.Combine(CmaDir, "PGAME", Aid, TitleID);
TotalProgress.Style = ProgressBarStyle.Continuous;
Status.Text = "Overthrowing The PSPEMU Monarchy 00%";
TotalProgress.Maximum = 100;
Status.Text = "Overthrowing The PSPEMU Monarchy 0%";
string BootupImage = "";
if (isMini(ISOPath.Text))
@ -197,6 +187,11 @@ namespace CHOVY
BootupImage = Path.Combine(Application.StartupPath, "_tmp", "minis.png");
Resources.MINIS.Save(BootupImage);
}
else
{
BootupImage = Path.Combine(Application.StartupPath, "_tmp", "chovy.png");
Resources.ChovyLogo.Save(BootupImage);
}
Process signnp = pbp.GenPbpFromIso(ISOPath.Text, EbootFile, ContentID, Versionkey.Text, CompressPBP.Checked, BootupImage);
while (!signnp.HasExited)
@ -207,33 +202,29 @@ namespace CHOVY
Progress = Progress.Remove(0,19);
int ProgressInt = int.Parse(Progress.Substring(0,3));
TotalProgress.Value = ProgressInt;
Status.Text = "Overthrowing The PSPEMU Monarchy " + Progress;
Status.Text = "Overthrowing The PSPEMU Monarchy " + ProgressInt.ToString() + "%";
}
Application.DoEvents();
}
TotalProgress.Value = 100;
TotalProgress.Value = 0;
if (isMini(ISOPath.Text))
{
try
{
File.Delete(BootupImage);
}
catch (Exception) { };
}
// File.WriteAllText(GamePathFile, "ux0:pspemu/temp/game/PSP/GAME/" + TitleID + "\x00");
//TotalProgress.Style = ProgressBarStyle.Marquee;
Status.Text = "Signing the Declaration of Independance 0%";
UInt64 IntAid = BitConverter.ToUInt64(RifAid,0x00);
int ChovyGenRes = pbp.gen__sce_ebootpbp(EbootFile, IntAid, EbootSignature);
if (!File.Exists(EbootSignature) || ChovyGenRes != 0)
{
MessageBox.Show("CHOVY-GEN Failed! Please check CHOVY.DLL exists\nand that the Microsoft Visual C++ 2015 Redistributable Update 3 RC is installed");
enable();
return;
Thread thrd = new Thread(() =>
{
int ChovyGenRes = pbp.gen__sce_ebootpbp(EbootFile, IntAid, EbootSignature);
if (!File.Exists(EbootSignature) || ChovyGenRes != 0)
{
MessageBox.Show("CHOVY-GEN Failed! Please check CHOVY.DLL exists\nand that the Microsoft Visual C++ 2015 Redistributable Update 3 RC is installed");
enable();
return;
}
});
thrd.Start();
while(thrd.IsAlive)
{
Application.DoEvents();
}
/*
@ -242,8 +233,7 @@ namespace CHOVY
// Pacakge GAME
//string BackupGameDir = Path.Combine(BackupWorkDir, "game");
byte[] CmaKey = CmaKeys.GenerateKey(RifAid);
string[] entrys = Directory.GetFileSystemEntries(GameWorkDir, "*", SearchOption.AllDirectories);
long noEntrys = entrys.LongLength;
@ -255,20 +245,19 @@ namespace CHOVY
}
TotalProgress.Maximum = noBlocks;
byte[] CmaKey = CmaKeys.GenerateKey(RifAid);
string BackupDir = Path.Combine(BackupWorkDir, "game");
Directory.CreateDirectory(BackupDir);
FileStream psvimg = File.OpenWrite(Path.Combine(BackupDir, "game.psvimg"));
psvimg.SetLength(0);
PSVIMGBuilder builder = new PSVIMGBuilder(psvimg, CmaKey);
string psvimgFilepath = Path.Combine(BackupDir, "game.psvimg");
FileStream gamePsvimg = File.OpenWrite(psvimgFilepath);
gamePsvimg.SetLength(0);
PSVIMGBuilder builder = new PSVIMGBuilder(gamePsvimg, CmaKey);
foreach (string entry in entrys)
{
string relativePath = entry.Remove(0, GameWorkDir.Length);
relativePath = relativePath.Replace('\\', '/');
bool isDir = File.GetAttributes(entry).HasFlag(FileAttributes.Directory);
if (isDir)
@ -295,54 +284,29 @@ namespace CHOVY
}
long ContentSize = builder.Finish();
gamePsvimg = File.OpenRead(psvimgFilepath);
FileStream gamePsvmd = File.OpenWrite(Path.Combine(BackupDir, "game.psvmd"));
PSVMDBuilder.CreatePsvmd(gamePsvmd, gamePsvimg, ContentSize, "game", CmaKey);
gamePsvmd.Close();
gamePsvimg.Close();
psvimg = File.OpenRead(Path.Combine(BackupDir, "game.psvimg"));
FileStream psvmd = File.OpenWrite(Path.Combine(BackupDir, "game.psvmd"));
PSVMDBuilder.CreatePsvmd(psvmd, psvimg, ContentSize, "game", CmaKey);
psvmd.Close();
// Directory.CreateDirectory(BackupGameDir);
//Process psvimg_create = psvimgtools.PSVIMG_CREATE(Aid, "game" ,TmpDir, Path.Combine(BackupWorkDir,"game"));
/* while(!psvimg_create.HasExited)
{
Application.DoEvents();
}
if (psvimg_create.ExitCode != 0)
{
MessageBox.Show("PSVIMG-CREATE.EXE FAILED!\nArguments:\n" + psvimg_create.StartInfo.Arguments + "\nStdOut:\n" + psvimg_create.StandardOutput.ReadToEnd() + "\nStdErr:\n" + psvimg_create.StandardError.ReadToEnd());
enable();
return;
}
*/
// Package LICENSE
try
{
Directory.Delete(TmpDir, true);
}
catch (Exception) { };
Directory.CreateDirectory(TmpDir);
Directory.CreateDirectory(LicenseWorkDir);
File.Copy(RifPath.Text, Path.Combine(LicenseWorkDir, ContentID + ".rif"), true);
File.WriteAllText(LicensePathFile, "ux0:pspemu/temp/game/PSP/LICENSE\x00");
/*Directory.CreateDirectory(BackupGameDir);
Process psvimg_create = psvimgtools.PSVIMG_CREATE(Aid, "license", TmpDir, Path.Combine(BackupWorkDir, "license"));
while (!psvimg_create.HasExited)
{
Application.DoEvents();
}
if(psvimg_create.ExitCode != 0)
{
MessageBox.Show("PSVIMG-CREATE.EXE FAILED!\nArguments:\n" + psvimg_create.StartInfo.Arguments + "\nStdOut:\n" + psvimg_create.StandardOutput.ReadToEnd() + "\nStdErr:\n" + psvimg_create.StandardError.ReadToEnd());
enable();
return;
}*/
try
{
Directory.Delete(TmpDir, true);
}
catch (Exception) { };
BackupDir = Path.Combine(BackupWorkDir, "license");
psvimgFilepath = Path.Combine(BackupDir, "license.psvimg");
Directory.CreateDirectory(BackupDir);
FileStream licensePsvimg = File.OpenWrite(psvimgFilepath);
licensePsvimg.SetLength(0);
builder = new PSVIMGBuilder(licensePsvimg, CmaKey);
builder.AddFile(RifPath.Text, "ux0:pspemu/temp/game/PSP/LICENSE", "/"+ContentID + ".rif");
ContentSize = builder.Finish();
licensePsvimg = File.OpenRead(psvimgFilepath);
FileStream licensePsvmd = File.OpenWrite(Path.Combine(BackupDir, "license.psvmd"));
PSVMDBuilder.CreatePsvmd(licensePsvmd, licensePsvimg, ContentSize, "license", CmaKey);
licensePsvmd.Close();
licensePsvimg.Close();
// Write PARAM.SFO & ICON0.PNG
string SceSysWorkDir = Path.Combine(BackupWorkDir, "sce_sys");
@ -355,9 +319,14 @@ namespace CHOVY
Status.Text = "YOU HAVE MADE A SOCIAL CONTRACT WITH FREEDOM!";
TotalProgress.Value = 0;
TotalProgress.Style = ProgressBarStyle.Continuous;
if(!MutedAudio)
try
{
Directory.Delete(TmpDir, true);
}
catch (Exception) { };
if (!MutedAudio)
{
Stream str = Resources.Murica;
SoundPlayer snd = new SoundPlayer(str);

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CHOVY));
this.label1 = new System.Windows.Forms.Label();
this.RifPath = new System.Windows.Forms.TextBox();
this.Versionkey = new System.Windows.Forms.TextBox();
@ -280,6 +281,7 @@
this.Controls.Add(this.label4);
this.Controls.Add(this.PsmChan);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "CHOVY";
this.Text = "CHOVY-SIGN";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CHOVY_FormClosing);

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CHOVYCmaSelector));
this.BackupList = new System.Windows.Forms.ListBox();
this.label1 = new System.Windows.Forms.Label();
this.CMADir = new System.Windows.Forms.TextBox();
@ -130,8 +131,9 @@
this.Controls.Add(this.label1);
this.Controls.Add(this.BackupList);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "CHOVYCmaSelector";
this.Text = "CHOVYCmaSelectorForm";
this.Text = "Chovy-Sign - Find Keys";
this.ResumeLayout(false);
this.PerformLayout();

File diff suppressed because it is too large Load Diff

BIN
CHOVY/Icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -58,6 +58,11 @@ namespace PSVIMGTOOLS
}
MemoryStream ms = new MemoryStream();
/*
*- DEBUG Disable Encryption
ms.Write(plainText, 0x00, size);
ms.Seek(0x00,SeekOrigin.Begin);
return ms.ToArray();*/
Aes alg = Aes.Create();
alg.Mode = CipherMode.CBC;
@ -73,6 +78,33 @@ namespace PSVIMGTOOLS
return cipherText;
}
private byte[] aes_ecb_encrypt(byte[] plainText, byte[] KEY, int size = -1)
{
if (size < 0)
{
size = plainText.Length;
}
MemoryStream ms = new MemoryStream();
/*
*- DEBUG Disable Encryption
ms.Write(plainText, 0x00, size);
ms.Seek(0x00,SeekOrigin.Begin);
return ms.ToArray();*/
Aes alg = Aes.Create();
alg.Mode = CipherMode.ECB;
alg.Padding = PaddingMode.None;
alg.KeySize = 256;
alg.BlockSize = 128;
alg.Key = KEY;
CryptoStream cs = new CryptoStream(ms, alg.CreateEncryptor(), CryptoStreamMode.Write);
cs.Write(plainText, 0, size);
cs.Close();
byte[] cipherText = ms.ToArray();
return cipherText;
}
private void writeUInt64(Stream dst,UInt64 value)
{
byte[] ValueBytes = BitConverter.GetBytes(value);
@ -128,13 +160,11 @@ namespace PSVIMGTOOLS
if (attrbutes.HasFlag(FileAttributes.Directory))
{
stats.Mode |= Modes.Directory;
stats.Attributes |= AttributesEnum.Directory;
stats.Size = 0;
}
else
{
stats.Mode |= Modes.File;
stats.Attributes |= AttributesEnum.File;
stats.Size = Convert.ToUInt64(new FileInfo(path).Length);
}
@ -142,34 +172,21 @@ namespace PSVIMGTOOLS
if(attrbutes.HasFlag(FileAttributes.ReadOnly))
{
stats.Mode |= Modes.GroupRead;
stats.Mode |= Modes.GroupExecute;
stats.Mode |= Modes.OthersExecute;
stats.Mode |= Modes.OthersRead;
stats.Mode |= Modes.UserRead;
stats.Mode |= Modes.UserExecute;
stats.Attributes |= AttributesEnum.Read;
stats.Attributes |= AttributesEnum.Execute;
}
else
{
stats.Mode |= Modes.GroupRead;
stats.Mode |= Modes.GroupExecute;
stats.Mode |= Modes.GroupWrite;
stats.Mode |= Modes.OthersExecute;
stats.Mode |= Modes.OthersRead;
stats.Mode |= Modes.OthersWrite;
stats.Mode |= Modes.UserRead;
stats.Mode |= Modes.UserExecute;
stats.Mode |= Modes.UserWrite;
stats.Attributes |= AttributesEnum.Read;
stats.Attributes |= AttributesEnum.Write;
stats.Attributes |= AttributesEnum.Execute;
}
stats.CreationTime = dateTimeToSceDateTime(File.GetCreationTimeUtc(path));
@ -282,7 +299,6 @@ namespace PSVIMGTOOLS
int len = Convert.ToInt32(blockStream.Position);
byte[] shaBytes = shaBlock(len, final);
blockStream.Write(shaBytes, 0x00, PSVIMGConstants.SHA256_BLOCK_SIZE);
blockStream.Close();
len += PSVIMGConstants.SHA256_BLOCK_SIZE;
//Get next IV
@ -295,6 +311,8 @@ namespace PSVIMGTOOLS
mainStream.Write(encryptedBlock, 0x00, encryptedBlock.Length);
totalBytes += encryptedBlock.Length;
blockStream.Dispose();
}
private int remainingBlockSize()
@ -305,28 +323,38 @@ namespace PSVIMGTOOLS
private void writeBlock(byte[] data, bool update=false)
{
long dLen = data.Length;
long writeTotal = 0;
while (dLen > 0)
{
int remaining = remainingBlockSize();
if (dLen > remaining)
{
blockStream.Write(data, 0x00, remaining);
byte[] dataRemains = new byte[remaining];
Array.Copy(data, writeTotal, dataRemains, 0, remaining);
blockStream.Write(dataRemains, 0x00, remaining);
writeTotal += remaining;
dLen -= remaining;
finishBlock();
startNewBlock();
if(update)
if (update)
{
blocksWritten += 1;
}
}
else
{
blockStream.Write(data, 0x00, Convert.ToInt32(dLen));
dLen = 0;
byte[] dataRemains = new byte[dLen];
Array.Copy(data, writeTotal, dataRemains, 0, dLen);
blockStream.Write(dataRemains, 0x00, Convert.ToInt32(dLen));
writeTotal += dLen;
dLen -= dLen;
}
}
}
private byte[] getPadding(long size)
{
@ -362,30 +390,9 @@ namespace PSVIMGTOOLS
{
byte[] work_buf;
Int64 bytes_remain = (dst.Length - dst.Position);
if (bytes_remain > 0x8388608)
if (bytes_remain > 0x33554432)
{
work_buf = new byte[0x8388608];
}
else
{
work_buf = new byte[bytes_remain];
}
dst.Read(work_buf, 0x00, work_buf.Length);
writeBlock(work_buf);
}
}
private void writeStreamAsync(Stream dst)
{
long numberOfBlocks = dst.Length / PSVIMGConstants.PSVIMG_BLOCK_SIZE;
while (dst.Position < dst.Length)
{
byte[] work_buf;
Int64 bytes_remain = (dst.Length - dst.Position);
if (bytes_remain > 0x10485760)
{
work_buf = new byte[0x10485760];
work_buf = new byte[0x33554432];
}
else
{
@ -393,17 +400,13 @@ namespace PSVIMGTOOLS
}
dst.Read(work_buf, 0x00, work_buf.Length);
writeBlock(work_buf, true);
}
}
private byte[] getFooter()
{
using (MemoryStream ms = new MemoryStream())
{
// uint sz = Convert.ToUInt32(totalBytes & (PSVIMGConstants.AES_BLOCK_SIZE - 1));
// int paddingInt = Convert.ToInt32(PSVIMGConstants.AES_BLOCK_SIZE - (sz & (PSVIMGConstants.AES_BLOCK_SIZE - 1)));
totalBytes += 0x10; //number of bytes used by this footer.
writeInt32(ms, 0x00); // int padding (idk wht this is)
@ -422,7 +425,10 @@ namespace PSVIMGTOOLS
{
long sz = Convert.ToInt64(sceIoStat(FilePath).Size);
writeBlock(getHeader(FilePath, ParentPath, PathRel));
writeStreamAsync(File.OpenRead(FilePath));
using (FileStream fs = File.OpenRead(FilePath))
{
writeStream(fs);
}
writeBlock(getPadding(sz));
writeBlock(getTailer());
contentSize += sz;
@ -432,9 +438,13 @@ namespace PSVIMGTOOLS
}
public void AddFile(string FilePath, string ParentPath, string PathRel)
{
long sz = Convert.ToInt64(sceIoStat(FilePath).Size);
writeBlock(getHeader(FilePath, ParentPath, PathRel));
writeStream(File.OpenRead(FilePath));
using (FileStream fs = File.OpenRead(FilePath))
{
writeStream(fs);
}
writeBlock(getPadding(sz));
writeBlock(getTailer());
contentSize += sz;
@ -452,11 +462,12 @@ namespace PSVIMGTOOLS
byte[] footer = getFooter();
mainStream.Write(footer, 0x00, footer.Length);
blockStream.Close();
mainStream.Close();
blockStream.Dispose();
mainStream.Dispose();
return contentSize;
}
public PSVIMGBuilder(Stream dst, byte[] Key)
{
totalBytes = 0;
@ -466,6 +477,8 @@ namespace PSVIMGTOOLS
KEY = Key;
rnd.NextBytes(IV);
IV = aes_ecb_encrypt(IV, Key);
mainStream.Write(IV, 0x00, IV.Length);
totalBytes += IV.Length;

View File

@ -79,6 +79,28 @@ namespace PSVIMGTOOLS
writePadding(dst, padByte, PaddingLen);
}
private static byte[] aes_ecb_decrypt(byte[] cipherText, byte[] KEY, int size = -1)
{
if (size < 0)
{
size = cipherText.Length;
}
MemoryStream ms = new MemoryStream();
Aes alg = Aes.Create();
alg.Mode = CipherMode.ECB;
alg.Padding = PaddingMode.None;
alg.KeySize = 256;
alg.BlockSize = 128;
alg.Key = KEY;
CryptoStream cs = new CryptoStream(ms, alg.CreateDecryptor(), CryptoStreamMode.Write);
cs.Write(cipherText, 0, size);
cs.Close();
byte[] plainText = ms.ToArray();
return plainText;
}
private static byte[] aes_cbc_decrypt(byte[] cipherData, byte[] IV, byte[] Key)
{
MemoryStream ms = new MemoryStream();
@ -124,6 +146,7 @@ namespace PSVIMGTOOLS
byte[] IV = new byte[PSVIMGConstants.AES_BLOCK_SIZE];
EncryptedPsvimg.Seek(0x00, SeekOrigin.Begin);
EncryptedPsvimg.Read(IV, 0x00, IV.Length);
IV = aes_ecb_decrypt(IV, Key);
MemoryStream ms = new MemoryStream();
writeUInt32(ms, 0xFEE1900D); // magic
@ -132,18 +155,17 @@ namespace PSVIMGTOOLS
ms.Write(new byte[0x10], 0x00, 0x10); // PSID
writeStringWithPadding(ms, BackupType, 0x40, 0x00); //backup type
writeInt64(ms, EncryptedPsvimg.Length); // total size
writeUInt32(ms, 0x2); //version
writeUInt64(ms, 0x2); //version
writeInt64(ms, ContentSize); // content size
ms.Write(IV, 0x00, IV.Length); // IV
writeInt64(ms, 0x00); //ux0 info
writeInt64(ms, 0x00); //ur0 info
writeInt64(ms, 0x00); //unused 98
writeInt64(ms, 0x00); //unused A0
ms.Write(IV, 0x00, 0x10); // IV
writeUInt64(ms, 0x00); //ux0 info
writeUInt64(ms, 0x00); //ur0 info
writeUInt64(ms, 0x00); //unused 98
writeUInt64(ms, 0x00); //unused A0
writeUInt32(ms, 0x1); //add data
ms.Seek(0x00, SeekOrigin.Begin);
byte[] psvMd = ms.ToArray();
ms.Close();
ms = new MemoryStream();
@ -154,17 +176,20 @@ namespace PSVIMGTOOLS
SHA256 sha = SHA256.Create();
byte[] shadata = sha.ComputeHash(psvMdCompressed);
ms.Write(shadata, 0x00, shadata.Length);
writeInt32(ms, 0x00);
int PaddingLen = Convert.ToInt32(PSVIMGConstants.AES_BLOCK_SIZE - (ms.Length & (PSVIMGConstants.AES_BLOCK_SIZE - 1)));
writePadding(ms, 0x00, PaddingLen);
writeInt32(ms, PaddingLen); //Padding Length
writeUInt32(ms, 0x00);
writeInt64(ms, ms.Length+0x8);
writeInt64(ms, (ms.Length+0x8)+IV.Length);
ms.Seek(0x00, SeekOrigin.Begin);
byte[] toEncrypt = ms.ToArray();
ms.Close();
byte[] EncryptedData = aes_cbc_encrypt(toEncrypt, IV, Key);
OutputStream.Write(IV, 0x00, IV.Length);
OutputStream.Write(EncryptedData, 0x00, toEncrypt.Length);
OutputStream.Write(EncryptedData, 0x00, EncryptedData.Length);
return;
}

View File

@ -1,6 +1,4 @@
using PSVIMGTOOLS;
using System;
using System.IO;
using System;
using System.Windows.Forms;
namespace CHOVY
@ -13,8 +11,6 @@ namespace CHOVY
[STAThread]
static void Main()
{
FileStream psvmd = File.OpenRead(@"C:\Users\earsy\Documents\PS Vita\PGAME\cf6185d5a7870c4a\UCES00304\game\game.psvmd");
//File.WriteAllBytes(@"C:\Users\earsy\Documents\PS Vita\PGAME\cf6185d5a7870c4a\UCES00304\game\game.psvmdi", PSVMDBuilder.DecryptPsvmd(psvmd, CmaKeys.GenerateKey(new byte[] { 0xcf, 0x61, 0x85, 0xd5, 0xa7, 0x87, 0x0c, 0x4a })));
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new CHOVY());

View File

@ -60,6 +60,16 @@ namespace CHOVY.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ChovyLogo {
get {
object obj = ResourceManager.GetObject("ChovyLogo", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@ -130,4 +130,7 @@
<data name="MINIS" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\MINIS.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ChovyLogo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ChovyLogo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -26,7 +26,6 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;
using System.Linq;
namespace Param_SFO

View File

@ -1,46 +0,0 @@
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
namespace CHOVY
{
class psvimgtools
{
public static Process PSVIMG_EXTRACT(string AID, string PSVIMG, string OUTPUT)
{
PSVIMG = PSVIMG.Replace("/", "\\");
OUTPUT = OUTPUT.Replace("/", "\\");
string CmaKey = CmaKeys.GenerateKeyStr(AID);
Process psvimgtools = new Process();
psvimgtools.StartInfo.FileName = Path.Combine(Application.StartupPath, "tools", "psvimg-extract.exe");
psvimgtools.StartInfo.Arguments = "-K " + CmaKey + " \"" + PSVIMG + "\" \"" + OUTPUT + "\"";
psvimgtools.StartInfo.CreateNoWindow = true;
psvimgtools.StartInfo.UseShellExecute = false;
psvimgtools.StartInfo.RedirectStandardInput = true; // NO IDEA WHY BUT IT DOESNT WORK WITHOUT THIS
psvimgtools.StartInfo.RedirectStandardOutput = true;
psvimgtools.StartInfo.RedirectStandardError = true;
psvimgtools.Start();
return psvimgtools;
}
public static Process PSVIMG_CREATE(string AID, string TYPE,string INPUT, string OUTPUT)
{
INPUT = INPUT.Replace("/", "\\");
OUTPUT = OUTPUT.Replace("/", "\\");
string CmaKey = CmaKeys.GenerateKeyStr(AID);
Process psvimgtools = new Process();
psvimgtools.StartInfo.FileName = Path.Combine(Application.StartupPath, "tools", "psvimg-create.exe");
psvimgtools.StartInfo.Arguments = "-n "+TYPE+" -K " + CmaKey + " \"" + INPUT + "\" \"" + OUTPUT + "\"";
psvimgtools.StartInfo.CreateNoWindow = true;
psvimgtools.StartInfo.UseShellExecute = false;
psvimgtools.StartInfo.RedirectStandardInput = true; // NO IDEA WHY BUT IT DOESNT WORK WITHOUT THIS
psvimgtools.StartInfo.RedirectStandardOutput = true;
psvimgtools.StartInfo.RedirectStandardError = true;
psvimgtools.Start();
return psvimgtools;
}
}
}

View File

@ -218,7 +218,7 @@ __declspec(dllexport) int chovy_gen(char *ebootpbp, uint64_t signaid, char *outs
memcpy(&sceebootpbp_file->magic, "NPUMDSIG", 0x8);
sceebootpbp_file->type = 2;
sceebootpbp_file->key_type = 1;
sceebootpbp_file->aid = _byteswap_uint64(signaid);
sceebootpbp_file->aid = signaid;
fseek(fin, 0, SEEK_END);