apprenticeharper / DeDRM_tools

DeDRM tools for ebooks
14.56k stars 1.52k forks source link

As others : Cannot remove DRM from Amazon file #2004

Open HDMW1 opened 2 years ago

HDMW1 commented 2 years ago

Hello List :

1 The Amazon book installs in calibre but will not open.

  1. Callibre cannot send the file to a Bookeen reader and cannot convert the file to ePub.
  2. Some advice on this list calls for Kindle for Mac 1,26. I’ve searched for this and found only place markers. The earliest version I can find is 1.33.0 Given how many others experience this problem I wonder if we are reaching the end of the road on this search for a way to read Amazon books on our own readers.

Regards : Hubert Wagner

Macbook Air M1 Mac OS 12.1 calibre 5.3.5, plugin installed with a problem DeDrm tool 7.2.1 Kindle 1.33.0 (620000) Book source Amazon.fr

calibre log : calibre Debug log calibre 5.35 embedded-python: True is64bit: True macOS-10.16-x86_64-i386-64bit Darwin ('64bit', '') ('Darwin', '21.2.0', 'Darwin Kernel Version 21.2.0: Sun Nov 28 20:29:10 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T8101') Python 3.8.5 OSX: ('10.16', ('', '', ''), 'x86_64') Interface language: en_GB Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 45, 0) && DeDRM (7, 2, 1) && Package KFX (from KFX Input) (1, 45, 0) && Calibre Power Search Plugin (2, 1, 1) && KFX metadata reader (from KFX Input) (1, 45, 0) && KFX Input (1, 45, 0) && KindleUnpack - The Plugin (0, 83, 0) calibre 5.35 embedded-python: True is64bit: True macOS-10.16-x86_64-i386-64bit Darwin ('64bit', '') ('Darwin', '21.2.0', 'Darwin Kernel Version 21.2.0: Sun Nov 28 20:29:10 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T8101') Python 3.8.5 OSX: ('10.16', ('', '', ''), 'x86_64') Interface language: en_GB Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 45, 0) && DeDRM (7, 2, 1) && Package KFX (from KFX Input) (1, 45, 0) && Calibre Power Search Plugin (2, 1, 1) && KFX metadata reader (from KFX Input) (1, 45, 0) && KFX Input (1, 45, 0) && KindleUnpack - The Plugin (0, 83, 0) devicePixelRatio: 2.0 logicalDpi: 72.0 x 72.0 physicalDpi: 149.00000223775552 x 149.0000022377555 Using calibre Qt style: True [0.00] Starting up... [0.02] Showing splash screen... [0.22] splash screen shown [0.22] Initializing db... [0.29] db initialized [0.29] Constructing main UI... [1.45] main UI initialized... [1.45] Hiding splash screen Starting QuickView Gather KFX-ZIP (from KFX Input) 1.45.0: Importing /Users/hubertwagner/Library/Application Support/Kindle/My Kindle Content/B09F5RGX27_EBOK/B09F5RGX27_EBOK.azw Gather KFX-ZIP (from KFX Input): Gathered 3 file(s) as /var/folders/wh/758zrb790b3b9q6zy84ztzqw0000gp/C/calibre_5.35.0_tmp_ramrvjvo/x254vwau.kfx-zip DeDRM v7.2.1: Trying to decrypt x254vwau.kfx-zip Using Library AlfCrypto Python Using Library AlfCrypto Python Decrypting KFX-ZIP ebook: x254vwau Got DSN key from database default_key Found 1 keys to try after 0.1 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.35c3a18c-2d18-40f5-b58f-23fc66b6b9ea.voucher Traceback (most recent call last): File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher voucher.decryptvoucher() File "/var/folders/wh/758zrb790b3b9q6zy84ztzqw0000gp/C/calibre_5.35.0_tmp_ramrvjvo/jtu1vknbplugin_unzip/ion.py", line 879, in decryptvoucher b = pkcs7unpad(b, 16) File "/var/folders/wh/758zrb790b3b9q6zy84ztzqw0000gp/C/calibre_5.35.0_tmp_ramrvjvo/jtu1vknbplugin_unzip/ion.py", line 758, in pkcs7unpad _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key") File "/var/folders/wh/758zrb790b3b9q6zy84ztzqw0000gp/C/calibre_5.35.0_tmp_ramrvjvo/jtu1vknbplugin_unzip/ion.py", line 98, in _assert raise Exception(msg) Exception: Incorrect padding - Wrong key Traceback (most recent call last): File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher voucher.decryptvoucher() File "/var/folders/wh/758zrb790b3b9q6zy84ztzqw0000gp/C/calibre_5.35.0_tmp_ramrvjvo/jtu1vknbplugin_unzip/ion.py", line 879, in decryptvoucher b = pkcs7unpad(b, 16) File "/var/folders/wh/758zrb790b3b9q6zy84ztzqw0000gp/C/calibre_5.35.0_tmp_ramrvjvo/jtu1vknbplugin_unzip/ion.py", line 758, in pkcs7unpad _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key") File "/var/folders/wh/758zrb790b3b9q6zy84ztzqw0000gp/C/calibre_5.35.0_tmp_ramrvjvo/jtu1vknbplugin_unzip/ion.py", line 98, in _assert raise Exception(msg) Exception: Incorrect padding - Wrong key DeDRM v7.2.1: Failed to decrypt with error: Failed to decrypt KFX DRM voucher with any key DeDRM v7.2.1: Looking for new default Kindle Key after 0.1 seconds Found k4Mac kinf2018 file: /Users/hubertwagner/Library/Application Support/Kindle/storage/.kinf2018 trying username b'hubertwagner' on file /Users/hubertwagner/Library/Application Support/Kindle/storage/.kinf2018 trying IDString: b'5b3ad73327d1' [5.87] splash screen hidden [5.87] Started up in 5.87 seconds with 1677 books trying IDString: b'5b3ad73327d0' trying IDString: b'151b2653a4e3' Decrypted key file using IDString '151b2653a4e3' and UserName 'hubertwagner' DeDRM v7.2.1: Found 1 new key Decrypting KFX-ZIP ebook: x254vwau Got SerialNumber from database default_key_1 Got UsernameHash from database default_key_1 Found 1 keys to try after 2.0 seconds Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.35c3a18c-2d18-40f5-b58f-23fc66b6b9ea.voucher Traceback (most recent call last): File "calibre_plugins.dedrm.init", line 540, in KindleMobiDecrypt book = k4mobidedrm.GetDecryptedBook(path_to_ebook,kindleDatabases,androidFiles,serials,pids,self.starttime) File "calibre_plugins.dedrm.k4mobidedrm", line 238, in GetDecryptedBook mb.processBook(totalpids) File "calibre_plugins.dedrm.kfxdedrm", line 45, in processBook self.decrypt_voucher(totalpids) File "calibre_plugins.dedrm.kfxdedrm", line 89, in decrypt_voucher raise Exception("Failed to decrypt KFX DRM voucher with any key") Exception: Failed to decrypt KFX DRM voucher with any key

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher voucher.decryptvoucher() File "/var/folders/wh/758zrb790b3b9q6zy84ztzqw0000gp/C/calibre_5.35.0_tmp_ramrvjvo/jtu1vknbplugin_unzip/ion.py", line 879, in decryptvoucher b = pkcs7unpad(b, 16) File "/var/folders/wh/758zrb790b3b9q6zy84ztzqw0000gp/C/calibre_5.35.0_tmp_ramrvjvo/jtu1vknbplugin_unzip/ion.py", line 758, in pkcs7unpad _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key") File "/var/folders/wh/758zrb790b3b9q6zy84ztzqw0000gp/C/calibre_5.35.0_tmp_ramrvjvo/jtu1vknbplugin_unzip/ion.py", line 98, in _assert raise Exception(msg) Exception: Incorrect padding - Wrong key Traceback (most recent call last): File "calibre_plugins.dedrm.init", line 540, in KindleMobiDecrypt book = k4mobidedrm.GetDecryptedBook(path_to_ebook,kindleDatabases,androidFiles,serials,pids,self.starttime) File "calibre_plugins.dedrm.k4mobidedrm", line 238, in GetDecryptedBook mb.processBook(totalpids) File "calibre_plugins.dedrm.kfxdedrm", line 45, in processBook self.decrypt_voucher(totalpids) File "calibre_plugins.dedrm.kfxdedrm", line 89, in decrypt_voucher raise Exception("Failed to decrypt KFX DRM voucher with any key") Exception: Failed to decrypt KFX DRM voucher with any key

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher voucher.decryptvoucher() File "/var/folders/wh/758zrb790b3b9q6zy84ztzqw0000gp/C/calibre_5.35.0_tmp_ramrvjvo/jtu1vknbplugin_unzip/ion.py", line 879, in decryptvoucher b = pkcs7unpad(b, 16) File "/var/folders/wh/758zrb790b3b9q6zy84ztzqw0000gp/C/calibre_5.35.0_tmp_ramrvjvo/jtu1vknbplugin_unzip/ion.py", line 758, in pkcs7unpad _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key") File "/var/folders/wh/758zrb790b3b9q6zy84ztzqw0000gp/C/calibre_5.35.0_tmp_ramrvjvo/jtu1vknbplugin_unzip/ion.py", line 98, in _assert raise Exception(msg) Exception: Incorrect padding - Wrong key DeDRM v7.2.1: Ultimately failed to decrypt after 2.0 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md Package KFX (from KFX Input) 1.45.0: Packaging /var/folders/wh/758zrb790b3b9q6zy84ztzqw0000gp/C/calibre_5.35.0_tmp_ramrvjvo/x254vwau.kfx-zip Processing container: B09F5RGX27_EBOK.azw KFX metadata reader (from KFX Input) activated for /var/folders/wh/758zrb790b3b9q6zy84ztzqw0000gp/C/calibre_5.35.0_tmp_ramrvjvo/68t3e9yu_add_books/0/B09F5RGX27_EBOK.kfx-zip Running file type plugin DeDRM failed with traceback: Traceback (most recent call last): File "calibre_plugins.dedrm.init", line 540, in KindleMobiDecrypt book = k4mobidedrm.GetDecryptedBook(path_to_ebook,kindleDatabases,androidFiles,serials,pids,self.starttime) File "calibre_plugins.dedrm.k4mobidedrm", line 238, in GetDecryptedBook mb.processBook(totalpids) File "calibre_plugins.dedrm.kfxdedrm", line 45, in processBook self.decrypt_voucher(totalpids) File "calibre_plugins.dedrm.kfxdedrm", line 89, in decrypt_voucher raise Exception("Failed to decrypt KFX DRM voucher with any key") Exception: Failed to decrypt KFX DRM voucher with any key

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "calibre/customize/ui.py", line 175, in _run_filetype_plugins File "calibre_plugins.dedrm.init", line 633, in run decrypted_ebook = self.KindleMobiDecrypt(path_to_ebook) File "calibre_plugins.dedrm.init", line 583, in KindleMobiDecrypt raise DeDRMError("{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)) calibre_plugins.dedrm.DeDRMError: DeDRM v7.2.1: Ultimately failed to decrypt after 2.0 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md Running file type plugin Package KFX (from KFX Input) failed with traceback: Traceback (most recent call last): File "calibre/customize/ui.py", line 175, in _run_filetype_plugins File "calibre_plugins.kfx_input.package_filetype", line 21, in run return self.run_kfx(path_to_ebook) File "calibre_plugins.kfx_input.package_filetype", line 32, in run_kfx kfx_data = YJ_Book(path_to_ebook).convert_to_single_kfx() File "calibre_plugins.kfx_input.kfxlib.yj_book", line 84, in convert_to_single_kfx self.decode_book() File "calibre_plugins.kfx_input.kfxlib.yj_book", line 211, in decode_book container = self.get_container(datafile) File "calibre_plugins.kfx_input.kfxlib.yj_book", line 318, in get_container raise KFXDRMError("Book container %s has DRM and cannot be converted" % datafile.name) calibre_plugins.kfx_input.kfxlib.utilities.KFXDRMError: Book container B09F5RGX27_EBOK.azw has DRM and cannot be converted

ElleKayEm commented 2 years ago

Yes, to decrypt KFX format like this, you need no later than Kindle for Mac 1.26. But you can disable KFX downloads in some later versions and get older formats which can be decrypted. See this post: https://www.mobileread.com/forums/showthread.php?t=283371

And this one: https://www.mobileread.com/forums/showpost.php?p=3819708&postcount=508