Decrypting a ZIP file with a hex key

Discussion in 'Computer Programming, Emulation, and Game Modding' started by SifJar, Apr 19, 2014.

  1. SifJar

    SifJar Not a pirate

    Apr 4, 2009
    I am currently attempting to remove the DRM from an ebook I purchased from a relatively new, UK only ebook store, so that I can read said ebook on my Kindle.

    Now, the store in question uses EPUB files (which are simply ZIP files with a particular structure), and the EPUBs are encrypted as their DRM. I have extracted a database file from the store's app on my (rooted) Android tablet, which has given me both the (HTTP) URL from which I can download the EPUB file, and also an HTTPS URL for the "key" (although it being HTTPS, that URL doesn't work on my computer so I can't download the key that way). However, the database also has a field called "book_enc_key", which contains the following string:

    This is a 32-byte string, represented here in ASCII. So I attempted to extract the EPUB (as a ZIP) using 7zip, supplying that string as the password. This failed. I converted the key to hex and tried again with this:

    and also with the letters converted to upper case. I even tried adding "0x" to the beginning, not expecting it to make a difference - and I was right.

    So basically I'm wondering if there's any other way to do this that might have better results, or if the encryption must be "non standard" in some way, or if perhaps that isn't even the real key, but perhaps some key to decrypt the real key (obtained from the HTTPS URL, perhaps?). Any suggestions from anyone would be great.

  2. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    Oct 27, 2002
    Engine room, learning
    I don't know if that key is the zip key, or a global key to generate the one in your epub.
    I found a python scrypt to extract the keys from epub and then use it to remove the inept drm, which requires a global key stored in windows regedit after installing Adobe Digital Editions. Maybe on tablet it's the key you need to provide?

    Maybe you can find the python sources helpful. (though, you probably already know it, it was the first search result)