default encryption key for Kindle for Mac/PC could not be found #25

Closed
tristan-k opened this Issue Aug 5, 2015 · 4 comments

Comments

Projects
None yet
3 participants

I'm running Ubuntu 15.04 with Calibre 2.31 and DeDRM 6.3.1. I installed Kindle For PC 1.11.0 (40.617) with PlayOnLinux and Wine 1.7.39. My wineprefix (~/.PlayOnLinux/wineprefix/amazonkindle/) is configured properly and I followed the instructions given in DeDRM_plugin_ReadMe.txt. pycrypto-2.6.win32-py2.7.exe and ActivePython-2.7.8.10-win32-x86.msi are installed. Yet kindlekey.py is unable to decrypt the kindlekey because wine canont find the python installation.

Any suggestion what went wrong?

$ calibre
Unable to open ~/.mtpz-data for reading, MTPZ disabled.
    DeDRM v6.3.1: Running kindlekey.py under Wine
DeDRM v6.3.1: Command line: “wine python.exe "/home/tristank/.config/calibre/plugins/DeDRM/libraryfiles/kindlekey.py" "/home/tristank/.config/calibre/plugins/DeDRM/libraryfiles/winekeysdir"”
wine: cannot find L"C:\\windows\\system32\\python.exe"
DeDRM v6.3.1: Found and decrypted 0 key files
Traceback (most recent call last):
  File "calibre_plugins.dedrm.config", line 772, in __init__
IndexError: list index out of range
fixme:ole:RemUnknown_QueryInterface No interface for iid {00000019-0000-0000-c000-000000000046}

dedrm 6 3 1 getting default kindle for mac-pc key_021

dedrm 6 3 1 manage kindle for mac and pc keys_020

@tristan-k tristan-k changed the title from unable to decrypt kindlekey to default encryption key for Kindle for Mac/PC could not be found Aug 5, 2015

Owner

apprenticeharper commented Aug 5, 2015

Commentators at Alf's blog have mentioned that there seems to be a problem with the current Ubuntu and wine. The python executable should be on the Windows PATH (or whatever the wine equivalent is) but appears not to be. Either the PATH needs to be updated, or python needs installing in the place mentioned in the error message. I don't know how to do either.

I found a workaround to decrypt the kindlekey, but now I'm unable to open or convert the amazon azw ebook. I manually added the WINEPREFIX to the command.

$ WINEPREFIX=/home/tristank/.PlayOnLinux/wineprefix/amazonkindle/ wine python.exe "/home/tristank/.config/calibre/plugins/DeDRM/libraryfiles/kindlekey.py" "/home/tristank/.config/calibre/plugins/DeDRM/libraryfiles/winekeysdir/"
fixme:ole:RemUnknown_QueryInterface No interface for iid {00000019-0000-0000-c000-000000000046}
fixme:ole:RemUnknown_QueryInterface No interface for iid {00000019-0000-0000-c000-000000000046}
fixme:ole:RemUnknown_QueryInterface No interface for iid {00000019-0000-0000-c000-000000000046}
err:winediag:schan_imp_init Failed to load libgnutls, secure connections will not be available.
fixme:iphlpapi:NotifyIpInterfaceChange (family 0, callback 0x69e6d901, context 0x713de0, init_notify 0, handle 0xfde7b4): stub
fixme:iphlpapi:CancelMibChangeNotify2 (handle (nil)): stub
wine: configuration in '/home/tristank/.PlayOnLinux/wineprefix/amazonkindle' has been updated.
kindlekey.py v1.9
Copyright ? 2010-2013 some_updates and Apprentice Alf
searching for kinfoFiles in C:\users\tristank\Local Settings\Application Data
Found K4PC 1.9+ kinf2011 file: C:\users\tristank\Local Settings\Application Data\Amazon\Kindle\storage\.kinf2011
Decrypted key file using IDString '0' and UserName 'BLACKED'
Saved a key to Z:\home\tristank\.config\calibre\plugins\DeDRM\libraryfiles\winekeysdir\kindlekey1.k4i

The error message when converting or opening the azw:

InputFormatPlugin: MOBI Input running
on /path/to/ebook.azw
Found KF8 MOBI of type 'standalone'

The same ebook can be converted or open without flaws on a windows machine.

Owner

apprenticeharper commented Aug 6, 2015

It looks like you've generated the k4i key file. Now import that into the plugin's preferences, and delete the book from calibre and re-import it. As it says in the readme, DRM removal happens on import, not on conversion.

I found this thread very useful – thank you. I used PlayOnLinux to install Python 2.7 for Windows in the amazonkindle wine prefix, using the .msi installer from https://www.python.org/ftp/python/2.7.13/python-2.7.13.msi. One of the options in the installation wizard is to add python.exe to the PATH, which I left selected – much easier than updating the PATH afterwards. I was then able to run tristank's command (the one beginning WINEPREFIX= above) to generate the kindlekey1.k4i file. From there it was plain sailing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment