Page 1 of 1

Stranger of Paradise: Final Fantasy Origin - SRST files

Posted: Tue Dec 27, 2022 5:25 am
by mamekoski
i need help with this description because i'm confused with the explanation :

"To determine whether a file is encrypted, the game checks offset 0x20 in the KTSR header which immediately follows the 0x10 byte SRST header. The encryption algorithm is Blowfish in ECB mode."

"The byte value stored in that offset is the encryption key length, with the key itself following from the next byte - if the value is 0, no decryption is performed."

my question within this file is, what is the encryption key? thanks~

Re: Need help with Encryption of a game file..

Posted: Tue Dec 27, 2022 12:56 pm
by ikskoks
What is name of the game this file comes from?
What is the platform? PC? XBOX?

Also please attach some samples.

Re: Need help with Encryption of a game file..

Posted: Tue Dec 27, 2022 4:42 pm
by mamekoski
ikskoks wrote: Tue Dec 27, 2022 12:56 pm What is name of the game this file comes from?
What is the platform? PC? XBOX?

Also please attach some samples.
it's a decrypted audio file(s) from SOPFFO PC which need to be re-encrypted to be played in-game. i couldn't attach a sample because that SRST file is over 500MBs..

i just need to know what is the encryption key based on my screenshot above.

Re: Stranger of Paradise: Final Fantasy Origin - SRST files

Posted: Tue Dec 27, 2022 9:14 pm
by ikskoks
i couldn't attach a sample because that SRST file is over 500MBs..
You can upload it to some hosting site like mega.nz, google drive etc. and then share a public link here.
i just need to know what is the encryption key based on my screenshot above.
That's NOT how reverse engineering works :D

Re: Stranger of Paradise: Final Fantasy Origin - SRST files

Posted: Wed Dec 28, 2022 6:28 am
by mamekoski
ikskoks wrote: Tue Dec 27, 2022 9:14 pm That's NOT how reverse engineering works :D
sorry i haven't explained before. the description i provide above is from the decryptor's github & that's what he/she provide regarding how to re-encrypt the file. since the repo has been archived, i can't comment to reply & github doesn't have private message feature.

that's why i'm asking here, so i could understand which part of the Hex is the encryption key from the decryptor's phrase: "The byte value stored in that offset is the encryption key length, with the key itself following from the next byte - if the value is 0, no decryption is performed."

Re: Stranger of Paradise: Final Fantasy Origin - SRST files

Posted: Wed Dec 28, 2022 4:37 pm
by ikskoks
Ok, thanks for explanation. Can you send a link to this archived github repositroy?
I can't find it anywhere.

EDIT: Btw, according to the logic described by you in the first post, key length is 7 and key is "77 45 D6 E5 64 13 ED" (as hex).

Re: Stranger of Paradise: Final Fantasy Origin - SRST files

Posted: Thu Dec 29, 2022 3:23 pm
by mamekoski
here's the link i've been forwarded when i asked some people in P5S modding discord regarding SOPFFO archive modding, since both utilize same format & i successfully mod weapon textures in SOPFFO (but haven't got more insight with BGMs).

https://github.com/yretenai/Cethleann/pull/36

btw, should i use openssl or quickbms to execute Blowfish ECB encryption? thanks a bunch~

Re: Stranger of Paradise: Final Fantasy Origin - SRST files

Posted: Thu Dec 29, 2022 9:43 pm
by ikskoks
btw, should i use openssl or quickbms to execute Blowfish ECB encryption?
You can use quickbms (+ reimport mode)
More info here http://aluigi.altervista.org/papers/quickbms.txt

This should be something like this in the script:

Code: Select all

encryption bf_ecb "\x77\x45\xD6\xE5\x64\x13\xED"

Re: Stranger of Paradise: Final Fantasy Origin - SRST files

Posted: Sat Jan 21, 2023 5:04 pm
by mamekoski
hello @ikskoks , sorry for the hiatus (have been busy with work). i've successfully encrypt all individual audio files, but i get a bit problem regarding how do i repack these audio files into a KTSR package before putting it into SRST file.

i provide the original KTSR file as reference, and marked the starting lines of the 1st encrypted audio.
.
d66ce491 ktsr.png

Re: Stranger of Paradise: Final Fantasy Origin - SRST files

Posted: Sat Jan 21, 2023 5:06 pm
by mamekoski

Re: Stranger of Paradise: Final Fantasy Origin - SRST files

Posted: Sat Jan 21, 2023 8:28 pm
by ikskoks
Quickbms has reimport mode (I've already mentioned it earlier).
You can import files back with the same script that was used for export.

Re: Stranger of Paradise: Final Fantasy Origin - SRST files

Posted: Sun Jan 22, 2023 3:26 pm
by mamekoski
ikskoks wrote: Sat Jan 21, 2023 8:28 pm Quickbms has reimport mode (I've already mentioned it earlier).
You can import files back with the same script that was used for export.
actually, i can't because i extracted those audios from this program https://github.com/yretenai/Cethleann/pull/36
i understand the reimport mode, but the script you provided only encrypted back each decrypted audio, so i'm a bit lost regarding to repackage them into KTSR.

Re: Stranger of Paradise: Final Fantasy Origin - SRST files

Posted: Sun Jan 22, 2023 5:40 pm
by ikskoks
I'm not an expert on Koei Tecmo formats, but I think that if encryption method is known and Cethleann source code is public, it should be possible to rewrite it's code as quickbms script (at least small part of it) and then use the same script for reimport.

But first, someone needs to write such script and make it public. :D