Example #1
0
 public Ps3File(Stream stream, string filename, Param_PFD.PFDEntry entry, Ps3SaveManager manager)
 {
     FileName   = filename;
     FileStream = stream;
     PFDEntry   = entry;
     Manager    = manager;
 }
 public Ps3File(string filepath, Param_PFD.PFDEntry entry, Ps3SaveManager manager)
 {
     FilePath = filepath;
     PFDEntry = entry;
     Manager = manager;
 }
Example #3
0
 public Ps3File(string filepath, Param_PFD.PFDEntry entry, Ps3SaveManager manager)
 {
     FilePath = filepath;
     PFDEntry = entry;
     Manager  = manager;
 }
 public static void ps3_Rebuild(string dirpath)
 {
     //declare ps3 manager using the directory path, and the secure file id
     Ps3SaveManager manager = new Ps3SaveManager(dirpath, key);
     //manager.ReBuildChanges();//Rebuild param.pfd, and keeps any decrypted file decrypted.
     manager.ReBuildChanges(true);//Rebuild param.pfd, and encrypt any decrypted file.
     if (File.Exists(dirpath + "/~files_decrypted_by_pfdtool.txt"))
     {
         File.Delete(dirpath + "/~files_decrypted_by_pfdtool.txt");
     }
 }
        public static void ps3_Encrypt(string dirpath)
        {
            if (File.Exists(dirpath + "/~files_decrypted_by_pfdtool.txt"))
            {
                File.Delete(dirpath + "/~files_decrypted_by_pfdtool.txt");
            }
            //declare ps3 manager using the directory path, and the secure file id
            Ps3SaveManager manager = new Ps3SaveManager(dirpath, key);
            //get file entry using name
            Ps3File file = manager.Files.FirstOrDefault(t => t.PFDEntry.file_name == "METADATA");
            //define byte array that should be encrypted
            byte[] filedata = File.ReadAllBytes(dirpath + "/METADATA");
            //check if file is not null
            if (file != null)
            {

                //file.Encrypt(filedata); //Encrypt from byte[]
                //filedata = file.EncryptToBytes(); //Encrypt to memory (byte[])
                //FileStream METADATA = File.Open(dirpath + "/METADATA", FileMode.Open);

                //METADATA.Seek(0, SeekOrigin.Begin);
                //METADATA.Write(filedata, 0, filedata.Length);
                //METADATA.Close();
            }
        }
        public static void ps3_Decrypt(string dirpath)
        {
            FileStream filelist = File.Open(dirpath + "/~files_decrypted_by_pfdtool.txt", FileMode.OpenOrCreate);

               //declare ps3 manager using the directory path, and the secure file id
            Ps3SaveManager manager = new Ps3SaveManager(dirpath, key);
            //get file entry using name
            Ps3File file = manager.Files.FirstOrDefault(t => t.PFDEntry.file_name == "METADATA");
            //define byte array that the decrypted data should be allocated
            byte[] filedata = null;
            //check if file is not null
            if (file != null)
            {
                byte[] filel = { 0x20, 0x4D, 0x45, 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, 0x0D, 0x0A };//StringToByteArray(" METADATA");
                file.Decypt();
                //filedata = file.DecryptToBytes();
                filelist.Write(filel, 0, filel.Length);
            }
            if (filedata != null)
            {
                //do stuff with the decrypted data
            }
        }