Decrypting a ZIP file with a hex key

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

  1. SifJar
    OP

    SifJar Not a pirate

    Member
    6,022
    892
    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:

    Code:
    (DyE?3tGer>Rj#_\8;gZY^iok!8%~Z3c
    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:

    Code:
    284479453f33744765723e526a235f5c383b675a595e696f6b2138257e5a3363
    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.

    Thanks.
     
  2. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    18,586
    8,925
    Oct 27, 2002
    France
    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?

    http://www.epubee.com/remove-drm-from-epub-on-adobe.html

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