Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Super Robot Wars 30 (PC) .cpk extracting, decryption & encryption

Featured Replies

  • Author
  • Localization

enixl, posted Thu Oct 28, 2021 5:18 pm (67211)


I tried to use crifilesystem 2.40.13.0 to extract Super Robot Wars 30 (PC)'s rpw_data.cpk file, but crifilesystem 2.40.13.0 crashed.
It may be encrypted, and doesn't seem like blowfish.
Could anyone help me to find a way to extract this file, and tell me how to repack it? Thanks!

srw30.rar

  • Author
  • Localization

enixl, posted Thu Oct 28, 2021 5:20 pm (67212)


SRW30's cpk file is attached.
  • Author
  • Localization

anakronus, posted Fri Oct 29, 2021 5:48 am (67225)


enixl wrote:
I tried to use crifilesystem 2.40.13.0 to extract Super Robot Wars 30 (PC)'s rpw_data.cpk file, but crifilesystem 2.40.13.0 crashed.
It may be encrypted, and doesn't seem like blowfish.
Could anyone help me to find a way to extract this file, and tell me how to repack it? Thanks!

Ah, I see someone else is interested in the game, I just cracked the code! (again :P)

SRW30 just like SRWV and X before it uses Blowfish encryption for the files in the PC release, this time however the pass isn't a variant of "SRW Steam Game" or something xd

Anyway, cutting to the chase.

Not sure why crifilesystem crashes with the .cpk but I could extract the contents just fine with cripakGUI, to decrypt the file after extraction just decrypt with blowfish and use "CryptedByMititei" as password (it's actually the same from the Switch demo, but there only a couple of files were encrypted), reusing the sample scripts from my SRWV post:

Decryption:
Code:
encryption blowfish "CryptedByMititei" #Use the key "SRVX Steam Game" for SRW X and "SRVW Steam Game" for SRW V
get SIZE asize
get NAME basename
get EXT extension
string NAME _decrypted.
string NAME EXT
log NAME 0 SIZE

Encryption:
Code:
encryption blowfish "CryptedByMititei" "" 1 #Use the key "SRVX Steam Game" for SRW X and "SRVW Steam Game" for SRW V
get SIZE asize
get NAME basename
get EXT extension
log NAME 0 SIZE


Brought to you by ClanSenju blog research e.e, happy hacking
  • Author
  • Localization

anakronus, posted Fri Oct 29, 2021 6:02 am (67226)


Also, here's the cpk's file decrypted, just to show it works fine, it has a recognizable CRILAYLA header and everything c:
  • Author
  • Localization

enixl, posted Fri Oct 29, 2021 6:40 am (67227)


Hi Anakronus,
Thank you! The key works well.
  • Author
  • Localization

descatal2, posted Fri Oct 29, 2021 7:28 am (67228)


anakronus wrote:
enixl wrote:
I tried to use crifilesystem 2.40.13.0 to extract Super Robot Wars 30 (PC)'s rpw_data.cpk file, but crifilesystem 2.40.13.0 crashed.
It may be encrypted, and doesn't seem like blowfish.
Could anyone help me to find a way to extract this file, and tell me how to repack it? Thanks!

Ah, I see someone else is interested in the game, I just cracked the code! (again :P)

SRW30 just like SRWV and X before it uses Blowfish encryption for the files in the PC release, this time however the pass isn't a variant of "SRW Steam Game" or something xd

Anyway, cutting to the chase.

Not sure why crifilesystem crashes with the .cpk but I could extract the contents just fine with cripakGUI, to decrypt the file after extraction just decrypt with blowfish and use "CryptedByMititei" as password (it's actually the same from the Switch demo, but there only a couple of files were encrypted), reusing the sample scripts from my SRWV post:

Decryption:
Code:
encryption blowfish "CryptedByMititei" #Use the key "SRVX Steam Game" for SRW X and "SRVW Steam Game" for SRW V
get SIZE asize
get NAME basename
get EXT extension
string NAME _decrypted.
string NAME EXT
log NAME 0 SIZE

Encryption:
Code:
encryption blowfish "CryptedByMititei" "" 1 #Use the key "SRVX Steam Game" for SRW X and "SRVW Steam Game" for SRW V
get SIZE asize
get NAME basename
get EXT extension
log NAME 0 SIZE


Brought to you by ClanSenju blog research e.e, happy hacking


We made the same discovery at the same time :D

For future SRW game PC port's reference, try to see if the EXE contains the following binary:

A6 0B 31 D1 AC B5 DF 98 DB 72 FD 2F B7 DF 1A D0 ED AF E1 B8 96 7E 26 6A 45 90 7C BA 99 7F 2C F1

If this exists, it means that the game is still encrypted in blowfish

For reference:
viewtopic.php?t=453
https://github.com/magcius/bbtucrypt/

Those binaries are one of the encryption keys used alongside the actual key we need to find (a.k.a "SRVW Steam Game")

Following the xref to this section pointer will lead you to the func that loads these keys, and if you try to search what call this func you will get the actual decryption func.
In SRW V it was just a simple load, while in SRW 30 they are a little bit cheeky and went for dynamic loading to get the key.

Although we have the decryption script, it is possible to decrypt standalone CRILAYLA files? AFAIK they are the keywords CPK extractors find to extract compressed files,
and since the files are encrypted in blowfish, CPK can't recognize the file properly and will always export an encrypted file.

Or would it be easier if we just to decrypt the blowfish encryption while it is still inside the CPK so that the CPK extractor can decompress CRILAYLA files automatically?
  • Author
  • Localization

anakronus, posted Sat Oct 30, 2021 1:15 am (67243)


descatal2 wrote:
We made the same discovery at the same time :D

Hahaha, awesome! I was sitting on the key from the switch demo, didn't think they would keep it for PC release xd

descatal2 wrote:
For future SRW game PC port's reference, try to see if the EXE contains the following binary:

A6 0B 31 D1 AC B5 DF 98 DB 72 FD 2F B7 DF 1A D0 ED AF E1 B8 96 7E 26 6A 45 90 7C BA 99 7F 2C F1
[...]
Following the xref to this section pointer will lead you to the func that loads these keys, and if you try to search what call this func you will get the actual decryption func.
In SRW V it was just a simple load, while in SRW 30 they are a little bit cheeky and went for dynamic loading to get the key.

Nice breakdown, hopefully it's useful for people dealing with other games too :)

descatal2 wrote:
Although we have the decryption script, it is possible to decrypt standalone CRILAYLA files? AFAIK they are the keywords CPK extractors find to extract compressed files,
and since the files are encrypted in blowfish, CPK can't recognize the file properly and will always export an encrypted file.

Or would it be easier if we just to decrypt the blowfish encryption while it is still inside the CPK so that the CPK extractor can decompress CRILAYLA files automatically?


Yeah, the decryption script is useful but not very efficient in this case (at least in SRW V/X the files were encrypted *before* CRILAYLA compression).

Luckily, we can actually decompress CRILAYLA files with quickbms too, here's an example:

Decryption CRILAYLA decompression:
Code:
encryption blowfish "CryptedByMititei"
comtype cpk
get SIZE asize
get NAME basename
get EXT extension

log MEMORY_FILE 0 SIZE
encryption "" ""

getdstring HEADER 8 MEMORY_FILE

if HEADER == "CRILAYLA"
    get CSIZE long MEMORY_FILE
    xmath CSIZE "CSIZE 0x100"

    string NAME "_dec_layla." EXT # Change names to something more useful if you want
    clog NAME 0 SIZE CSIZE MEMORY_FILE
else
    #Not sure if these kind of files exist, don't actually have SRW 30 on PC, but just in case...
    string NAME "_dec." EXT
    log NAME 0 SIZE MEMORY_FILE
endif


CRILAYLA compression Encryption:
Code:
comtype cpk_compress
get SIZE asize
get NAME basename
get EXT extension

clog MEMORY_FILE 0 SIZE SIZE

encryption blowfish "CryptedByMititei" "" 1

get SIZE asize MEMORY_FILE
log NAME 0 SIZE MEMORY_FILE


The decryption decompression script used on this post's cpk file produces the file attatched, which looks about perfect.
In my case though, I edited CriPakGUI (as it's open source) and made it decrypt the files before extraction/insertion back with the SRW V/X, something similar could be done here if for some reason the bms scripts are not enough.
  • Author
  • Localization

MSQ, posted Sat Oct 30, 2021 8:18 pm (67264)


Good evening anakronus, thank you for the resources you have posted in the topic! I have understood a lot from reading your comments here. :)

I would like to ask how I am meant to extract and decompress the resources inside the 3 larger CPK files for this game, they are:
Code:
pc/data/btlc/wp00.cpk
pc/data/mapetc/mapdataest010steam.cpk
pc/data/statusimage/psg00.cpk
Unfortunately when I try your decryption BMS script in order to decrypt any of the above CPKs, I receive this error:
Code:
CMD > quickbms run.bms wp00.cpk

  offset           filesize   filename
--------------------------------------
  0000000000000000 3551297280 wp00_decrypted.cpk

- error in src\extra\xalloc.c line 618: xdbg_malloc()

Error: memory allocation problem
       Not enough memory resources are available to process this command.

I fail to understand why this is, I am not awfully familiar with QuickBMS. I am using the 4GB_files.exe always, and have tried the normal EXE but I receive the same error. It is only for those above 3 files. The rest have decrypted correctly and I can extract the encrypted crilayla streams from the file. I have 64GB of RAM in my computer, so I do not see any limitations there. Is there something I am doing wrong with your script? I copied it directly from your post.

Thank you in advance!
  • Author
  • Localization

spiritovod, posted Sun Oct 31, 2021 12:03 pm (67274)


@MSQ: quickbms (even 4GB version) is kind of pseudo-64bit app, so you can't allocate more than 3GB memory with a single allocation operation, required for encryption and compression algorithms (it also depends on virtual memory settings in Windows). And the file you're trying to process if over 3GB, hence the error. Theoretically it's possible to process decryption operations in blocks (most algorithms are block-based) and maybe decompression as well - but it's better someone more qualified to answer that. I hope aluigi will explain it better.
  • Author
  • Localization

anakronus, posted Sun Oct 31, 2021 1:21 pm (67275)


MSQ wrote:
Good evening anakronus, thank you for the resources you have posted in the topic! I have understood a lot from reading your comments here. :)

I would like to ask how I am meant to extract and decompress the resources inside the 3 larger CPK files for this game, they are:
Code:
pc/data/btlc/wp00.cpk
pc/data/mapetc/mapdataest010steam.cpk
pc/data/statusimage/psg00.cpk
Unfortunately when I try your decryption BMS script in order to decrypt any of the above CPKs, I receive this error:
[...]
I fail to understand why this is, I am not awfully familiar with QuickBMS. I am using the 4GB_files.exe always, and have tried the normal EXE but I receive the same error. It is only for those above 3 files. The rest have decrypted correctly and I can extract the encrypted crilayla streams from the file. I have 64GB of RAM in my computer, so I do not see any limitations there. Is there something I am doing wrong with your script? I copied it directly from your post.

Thank you in advance!


I don't think any individual file inside the cpk's over 3Gigs though? The way the script is meant to work involves extracting the .cpk first and then using the decryptor/decompressor, you could try with any cpk handling tool to extract the big .cpk (even the qbms script, but that one's deprecated iirc) then you can batch decrypt them with the script provided in the post.
  • Author
  • Localization

descatal2, posted Sun Oct 31, 2021 2:37 pm (67277)


MSQ wrote:
Good evening anakronus, thank you for the resources you have posted in the topic! I have understood a lot from reading your comments here. :)

I would like to ask how I am meant to extract and decompress the resources inside the 3 larger CPK files for this game, they are:
Code:
pc/data/btlc/wp00.cpk
pc/data/mapetc/mapdataest010steam.cpk
pc/data/statusimage/psg00.cpk
Unfortunately when I try your decryption BMS script in order to decrypt any of the above CPKs, I receive this error:
Code:
CMD > quickbms run.bms wp00.cpk

  offset           filesize   filename
--------------------------------------
  0000000000000000 3551297280 wp00_decrypted.cpk

- error in src\extra\xalloc.c line 618: xdbg_malloc()

Error: memory allocation problem
       Not enough memory resources are available to process this command.

I fail to understand why this is, I am not awfully familiar with QuickBMS. I am using the 4GB_files.exe always, and have tried the normal EXE but I receive the same error. It is only for those above 3 files. The rest have decrypted correctly and I can extract the encrypted crilayla streams from the file. I have 64GB of RAM in my computer, so I do not see any limitations there. Is there something I am doing wrong with your script? I copied it directly from your post.

Thank you in advance!


I've been working on a modified CriPakTool to properly uncompressed the cpk files with blowfish decryption in one go, but it is still under progress.
For mapdataest010steam.cpk there's a problem with normal CriPakTool, I am not sure what's the problem, but most probably related to ITOC pointer being read wrong.
I will post the program once I finish small tweaks, it should be able to decompress wp00 and psg00 cpks in one go.

But please keep in mind psg00's content is about 20gb after decompression so save some space before you start
  • Author
  • Localization

descatal2, posted Sun Oct 31, 2021 2:39 pm (67278)


anakronus wrote:
descatal2 wrote:
We made the same discovery at the same time :D

Hahaha, awesome! I was sitting on the key from the switch demo, didn't think they would keep it for PC release xd

descatal2 wrote:
For future SRW game PC port's reference, try to see if the EXE contains the following binary:

A6 0B 31 D1 AC B5 DF 98 DB 72 FD 2F B7 DF 1A D0 ED AF E1 B8 96 7E 26 6A 45 90 7C BA 99 7F 2C F1
[...]
Following the xref to this section pointer will lead you to the func that loads these keys, and if you try to search what call this func you will get the actual decryption func.
In SRW V it was just a simple load, while in SRW 30 they are a little bit cheeky and went for dynamic loading to get the key.

Nice breakdown, hopefully it's useful for people dealing with other games too :)

descatal2 wrote:
Although we have the decryption script, it is possible to decrypt standalone CRILAYLA files? AFAIK they are the keywords CPK extractors find to extract compressed files,
and since the files are encrypted in blowfish, CPK can't recognize the file properly and will always export an encrypted file.

Or would it be easier if we just to decrypt the blowfish encryption while it is still inside the CPK so that the CPK extractor can decompress CRILAYLA files automatically?


Yeah, the decryption script is useful but not very efficient in this case (at least in SRW V/X the files were encrypted *before* CRILAYLA compression).

Luckily, we can actually decompress CRILAYLA files with quickbms too, here's an example:

Decryption CRILAYLA decompression:
Code:
encryption blowfish "CryptedByMititei"
comtype cpk
get SIZE asize
get NAME basename
get EXT extension

log MEMORY_FILE 0 SIZE
encryption "" ""

getdstring HEADER 8 MEMORY_FILE

if HEADER == "CRILAYLA"
    get CSIZE long MEMORY_FILE
    xmath CSIZE "CSIZE 0x100"

    string NAME "_dec_layla." EXT # Change names to something more useful if you want
    clog NAME 0 SIZE CSIZE MEMORY_FILE
else
    #Not sure if these kind of files exist, don't actually have SRW 30 on PC, but just in case...
    string NAME "_dec." EXT
    log NAME 0 SIZE MEMORY_FILE
endif


CRILAYLA compression Encryption:
Code:
comtype cpk_compress
get SIZE asize
get NAME basename
get EXT extension

clog MEMORY_FILE 0 SIZE SIZE

encryption blowfish "CryptedByMititei" "" 1

get SIZE asize MEMORY_FILE
log NAME 0 SIZE MEMORY_FILE


The decryption decompression script used on this post's cpk file produces the file attatched, which looks about perfect.
In my case though, I edited CriPakGUI (as it's open source) and made it decrypt the files before extraction/insertion back with the SRW V/X, something similar could be done here if for some reason the bms scripts are not enough.


Also, thanks for the writeup, very interesting stuff
  • Author
  • Localization

MSQ, posted Sun Oct 31, 2021 6:37 pm (67282)


anakronus wrote:
I don't think any individual file inside the cpk's over 3Gigs though? The way the script is meant to work involves extracting the .cpk first and then using the decryptor/decompressor, you could try with any cpk handling tool to extract the big .cpk (even the qbms script, but that one's deprecated iirc) then you can batch decrypt them with the script provided in the post.

I thought that in order to extract the encrypted CRILAYLA streams from the CPK, I first need to decrypt the entire CPK using the BMS script. This is because without doing so, I cannot extract the streams since the CriPakTools etc.. are all looking for the CPK header in the file.

Am I getting this incorrect?

My current process:

Start: Encrypted CPK ----> Decrpyt using BMS script ----> Extract encrypted CRILAYLA streams using CriPakTools ----> Decrypt each CRILAYLA stream using BMS script.
  • Author
  • Localization

spiritovod, posted Sun Oct 31, 2021 8:08 pm (67285)


Here is script for decrypting large cpk files (and small ones as well) in blocks.

Edited: Script restored, since pc version has encryption on the whole cpk files.
  • Author
  • Localization

anakronus, posted Sun Oct 31, 2021 10:28 pm (67287)


MSQ wrote:
I thought that in order to extract the encrypted CRILAYLA streams from the CPK, I first need to decrypt the entire CPK using the BMS script. This is because without doing so, I cannot extract the streams since the CriPakTools etc.. are all looking for the CPK header in the file.

Am I getting this incorrect?

My current process:

Start: Encrypted CPK ----> Decrpyt using BMS script ----> Extract encrypted CRILAYLA streams using CriPakTools ----> Decrypt each CRILAYLA stream using BMS script.

Yeah, you got it wrong, the idea was to get the encrypted streams from CriPakTools and then use the bms script on those, it handles the CRILAYLA files by itself, so it would be:
Note that CRILAYLA is *compression* not encryption, so encrypted CRILAYLA streams just mean CRILAYLA compressed files that are encrypted
Start: CPK (they shouldn't be encrypted in their totality)----> Extract encrypted CRILAYLA streams using CriPakTools ----> Decrypt each CRILAYLA stream using BMS script.

If you want a quick and dirty solution, I modified my old version of CriPakTools so it decrypts first and then decompress, probably has errors here and there, but if you can't wait for @descatal2's more proper solution then it's attached.

(Also note the tool is kinda dumb, decrypting everything without a CRILAYLA header, so if there are unencrypted files intermixed with encrypted files it would silently encrypt those, hopefully @descatal2's version will be more careful)

EDIT: updated modified CriPakTools, solved a dumb bug regarding file sizes

CriPakGUI-Release.zip

  • Author
  • Localization

MSQ, posted Mon Nov 01, 2021 7:58 am (67289)


anakronus wrote:
Yeah, you got it wrong, the idea was to get the encrypted streams from CriPakTools and then use the bms script on those, it handles the CRILAYLA files by itself, so it would be:
Note that CRILAYLA is *compression* not encryption, so encrypted CRILAYLA streams just mean CRILAYLA compressed files that are encrypted
Start: CPK (they shouldn't be encrypted in their totality)----> Extract encrypted CRILAYLA streams using CriPakTools ----> Decrypt each CRILAYLA stream using BMS script.

If you want a quick and dirty solution, I modified my old version of CriPakTools so it decrypts first and then decompress, probably has errors here and there, but if you can't wait for @descatal2's more proper solution then it's attached.

(Also note the tool is kinda dumb, decrypting everything without a CRILAYLA header, so if there are unencrypted files intermixed with encrypted files it would silently encrypt those, hopefully @descatal2's version will be more careful)

EDIT: updated modified CriPakTools, solved a dumb bug regarding file sizes

Yes, I understand that CRILAYLA is the compression algorithm and that Blowfish is the encryption algorithm used on the files.

The reason why I was using the BMS script on the entire CPK file was because of this:
Image
The file does not have the correct CPK header (this is default.CPK from my Steam library), so it cannot be extracted, even by the tool you attached to your comment. This file is completely encrypted.

Whereas, after running the BMS script to decrypt the CPK, we end up with a readable header:
Image

Your tool can also read the file:
Image
And we can extract the .BIN files which are encrypted Crilayla streams. We can then encrypt and decrypt these as we please.

Hopefully you understand the issue I am facing. Since the CPK is completely encrypted, it's not possible to extract any of the crilayla streams from the file unless we first decrypt the entire CPK.
  • Author
  • Localization

spiritovod, posted Mon Nov 01, 2021 9:25 am (67291)


Oh, so the whole cpk are also encrypted.

@MSQ: I've restored script for decrypting large packages in blocks in my previous post above, try it, it should work.
  • Author
  • Localization

anakronus, posted Mon Nov 01, 2021 9:26 am (67292)


MSQ wrote:
Yes, I understand that CRILAYLA is the compression algorithm and that Blowfish is the encryption algorithm used on the files.

The reason why I was using the BMS script on the entire CPK file was because of this:
[snip]
The file does not have the correct CPK header (this is default.CPK from my Steam library), so it cannot be extracted, even by the tool you attached to your comment. This file is completely encrypted.

Whereas, after running the BMS script to decrypt the CPK, we end up with a readable header:
[snip]

Your tool can also read the file:
[snip]
And we can extract the .BIN files which are encrypted Crilayla streams. We can then encrypt and decrypt these as we please.

Hopefully you understand the issue I am facing. Since the CPK is completely encrypted, it's not possible to extract any of the crilayla streams from the file unless we first decrypt the entire CPK.

Ah I see what you mean now, as I mentioned earlier I currently do not have the PC version of the game so I didn't think the actual containers would be fully encrypted.

In this case you can make use of @spiritovod's script (which has as of now been removed, but I got while available and is provided in the attachments, credits to spiritovod) can't test on the actual 3GiB file but it seems to work perfectly for smaller files (1.2GiB).

Edit: Looks like I got ninja'd, you can get the script from @spiritovod's now as well :P

SRW30_block_decrypt.bms

  • Author
  • Localization

MSQ, posted Mon Nov 01, 2021 5:17 pm (67300)


spiritovod, anakronus

Thank you for the script, this works perfectly on the larger CPK files! I am sorry for the confusion regarding the differences in platforms, I did not realise the files were different in this case.

Edit: The CPK containers are not encrypted, I just messed up my game files (I might have accidentally encrypted them?) not too sure, but I can confirm that after clean reinstalling, the files definitely have the CPK header by default and by no means are fully encrypted. Sorry about this!

To further my knowledge of this topic: would there be a way to create a tool that decrypts the crilayla streams while they are still inside the CPK, or is it a must that each stream must be unpacked then decrypted. Thanks again!
  • Author
  • Localization

anakronus, posted Mon Nov 01, 2021 9:39 pm (67310)


MSQ wrote:
spiritovod, anakronus

Thank you for the script, this works perfectly on the larger CPK files! I am sorry for the confusion regarding the differences in platforms, I did not realise the files were different in this case.

Edit: The CPK containers are not encrypted, I just messed up my game files (I might have accidentally encrypted them?) not too sure, but I can confirm that after clean reinstalling, the files definitely have the CPK header by default and by no means are fully encrypted. Sorry about this!

To further my knowledge of this topic: would there be a way to create a tool that decrypts the crilayla streams while they are still inside the CPK, or is it a must that each stream must be unpacked then decrypted. Thanks again!


The CriPakGui file I shared in the other post extracts the plaintext data (after decryption and CRILAYLA decompression) when you click on "extract me! (decrypted)" so you get the final files :)
You can also right click on a single bin and do click on extract (decrypted) to get the final file (again after decryption and CRILAYLA decompression) too.
  • Author
  • Localization

descatal2, posted Tue Nov 02, 2021 3:37 pm (67328)


MSQ wrote:
spiritovod, anakronus

Thank you for the script, this works perfectly on the larger CPK files! I am sorry for the confusion regarding the differences in platforms, I did not realise the files were different in this case.

Edit: The CPK containers are not encrypted, I just messed up my game files (I might have accidentally encrypted them?) not too sure, but I can confirm that after clean reinstalling, the files definitely have the CPK header by default and by no means are fully encrypted. Sorry about this!

To further my knowledge of this topic: would there be a way to create a tool that decrypts the crilayla streams while they are still inside the CPK, or is it a must that each stream must be unpacked then decrypted. Thanks again!


I am not sure if it fits your criteria, but I've made modified the CriPakTools source code to run quickbms to decrypt the blowfish encryption.

Here's the program with source code included:

https://drive.google.com/file/d/1UxyqVh ... sp=sharing

Source:
https://drive.google.com/file/d/1SgG3uv ... sp=sharing

I've added a new -q argument to take in blowfish encryption key while decrypting files. It will automatically decrypts the encrypted data using quickbms before passing it back to the original program to decrypt (thus automatically decompress CRILAYLA compression)

Usage:
CriPakTools -x -i "the_path_to_CPK_you_want_to_decrypt" -d "the_path_to_decrypted_folder" -q "blowfish_encryption_key"

e.g.
If I want to extract psg00.cpk
CriPakTools -x -i "psg00.cpk" -d "unpacked" -q "CryptedByMititei"

If you are interested in repacking the CPK files (to mod), unfortunately I don't have many luck using the original CriPakTools to have good result (the pointers are all over the place).
Due to this, I made a workaround that instead of injecting / replace the files, the program will encrypt the files inside the repacked CPK.
I've added a new argument -p for this

Usage:
CriPakTools -p -i "the_path_to_CPK_you_want_to_encrypt" -o "output_encrypted_CPK_path" -q "blowfish_encryption_key"

e.g.
CriPakTools -p -i "psg00.cpk" -o "psg00-encrypted.cpk" -q "CryptedByMititei"

However, due to the limitation of CriPakTools, there's some CPK that's going to spew out error due to wrong ITOC header reading code.
If that's the case I would suggest to manually extract the encrypted data chunk from CPK, and manually decrypt it using the bms script.
The decrypted data should have a CRILAYLA header, and if it does, copy and replace the data inside the original encrypted CPK with it, and you should be able to decrypt them normally using any cpk decompression tool.
For repack do the same step but in reverse.

Hopefully this helps with the asset extractions.
  • Author
  • Localization

MSQ, posted Sat Nov 06, 2021 1:20 pm (67402)


descatal2
Thank you for this tool, it's exactly what I was looking for and most certainly helps me with my work! Being able to have an easier time repacking the CPK is loved. :D
  • Author
  • Localization

DooshDR, posted Wed Nov 10, 2021 5:59 pm (67460)


Hi everyone and thank you so much for your great work. I tried to extract files from .cpk with CriPakGUI and some of them cannot be extracted. For example here: https://m.imgur.com/a/nECg6fC
When you try to extract files from some of the .cpk, you get an error related to "illegal characters". As you can see on the screenshot, there are a bunch of everywhere. I tried with command line and the error is "NullReferenceException".
None of the extraction tools work with these problematic cpk files.
Thanks

Edit: Here is the cpk: https://mega.nz/file/xYhGRSZT#S_F5VI6oF ... KzvCjoIIxA

Edit2: I managed to extract some files with a HEX editor. First I opened the .cpk with CriPakGUI then I selected the part corresponding to each file (offset data size) in the HEX editor. Then I decrypted the extracted file. Really tedious! But it's not efficient when there are 1500 files.
  • Author
  • Localization

descatal2, posted Fri Nov 12, 2021 3:56 am (67476)


DooshDR wrote:
Hi everyone and thank you so much for your great work. I tried to extract files from .cpk with CriPakGUI and some of them cannot be extracted. For example here: https://m.imgur.com/a/nECg6fC
When you try to extract files from some of the .cpk, you get an error related to "illegal characters". As you can see on the screenshot, there are a bunch of everywhere. I tried with command line and the error is "NullReferenceException".
None of the extraction tools work with these problematic cpk files.
Thanks

Edit: Here is the cpk: https://mega.nz/file/xYhGRSZT#S_F5VI6oF ... KzvCjoIIxA

Edit2: I managed to extract some files with a HEX editor. First I opened the .cpk with CriPakGUI then I selected the part corresponding to each file (offset data size) in the HEX editor. Then I decrypted the extracted file. Really tedious! But it's not efficient when there are 1500 files.


Yes, that's the CRIPAKGUI's problem I stated in my post above. Some of the CPK is just not supported by this tool due to ITOC header read error. Since even the CriPakTool cannot read the pointers properly, the code can't progress to the point where it can decrypt anything.

Hence, I don't have any answer to this but to ask anyone who has experience in CPK file extraction to look into this ITOC header problem. For now if you want you can write your own reader or modify the existing code to circumvent the error so that the pointers are correctly read.

Another experimental way is to try and file the file's starting pointer inside the CPK itself. It is quite recognizable since it is just a bunch of gibberish bytes. Once you found that, just copy everything from that point on until the file end, and paste it into a new binary file.
Then, decrypt the extracted byte arrays using the BMS script.
Once that is done, replace the byte you just copied inside the CPK with the newly decrypted byte arrays.
If everything is correct, the decrypted byte will have a CRILAYLA compression header, and replacing this will allow you to read the CPK file properly using official Cri extraction tools since it is not encrypted anymore.
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.