Jump to content

Encrypted mix file reading


Blade

Recommended Posts

I don't know really, without knowing what the algorithm is its hard to say what information we would need to construct a working encryption system. I have a gut feeling it must be something like RSA with a Westwood twist, but who knows. It also seems that the game checks the recovered key somehow since the game won't read mix files encrypted with a randomly generated 80byte block but XCC will implying there is some signature or pattern in the key that the game wants.

Link to comment
Share on other sites

  • 2 months later...

Okay, I believe I have an understanding now of exactly how decryption of a mix header works. The 80byte block in the header is handled as two 40 byte little endian BigIntegers that are decrypted by a raw RSA transform using the WW public key from keys.ini (after a few transforms) strangely the keys are stored as encoded big endian BigIntegers and are swapped to little endian in the XCC code (which is probably what the game does as well). For those familiar with RSA or capable of reading up on it, the public key in keys.ini is actually the modulus. You also need the public exponent which is 65537 (or 0x10001 if you are looking for it in the XCC code) to compose the full public key. The private key is the private exponent and is only needed to encode the blowfish key.

 

After decryption you have two 40byte big ints that are concatenated together, but only 56 bytes are ever none zero and infact the XCC code just chops those off when it composes the final temp buffer to copy to the destination provided to the function. This is then set as the blowfish key and used to decrypt the header as described in the XCC documentation. Hopefully this will let me create a mix reader that doesn't rely on the XCC code and also create a mix creator that can generate its own encryption keys that the game will accept, rather than copying them from other mix files.

 

The blowfish keys themselves are strange, they follow a pattern of two 28byte sequences composed of a short (3 - 11 bytes) random sequence padded to 28bytes with their last random byte.

Link to comment
Share on other sites

Well, if XCC or the game can't open them I've not got the encryption right ;) There are two points to this, 1. it means that you could use any standard crypto library to read encrypted mix files, XCC code has some issues building as 64bit with gcc when optimization is used so it allows it to be more cross platform. 2. it means that in theory we can generate encrypted headers rather than having to specify one from an existing mix file (I need to write an implementation to do it to test it first).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...