noDRM / DeDRM_tools

DeDRM tools for ebooks
7.08k stars 317 forks source link

DeDRM Failed in Calibre 6.11 DeDrm 10.0.3 #265

Open ElusiveZatchmo opened 1 year ago

ElusiveZatchmo commented 1 year ago

Question / bug report

I had updated to the latest version of Kindle as some more recent releases were being blocked from downloading from Amazon unless I updated the Kindle software on my Windows 10 PC. The DeDRM has been working in the latest Kindle with the recent releases, but there have been some other books that when I tried to add them and remove the DRM, it doesn't work, I'm left with a KFX-Zip file locked with DRM.

Which version of Calibre are you running?

6.11

Which version of the DeDRM plugin are you running?

10.0.3

If applicable, which version of the Kindle software are you running?

1.39.2

Log output

ApplicationPaletteChange event ignored
Using calibre Qt style: True
calibre Debug log
calibre 6.11 Portable embedded-python: True
Windows-10-10.0.19045-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19045')
Python 3.10.1
Windows: ('10', '10.0.19045', 'SP0', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 50, 0) && DeDRM (10, 0, 3) && Package KFX (from KFX Input) (1, 50, 0) && Find Duplicates (1, 10, 7) && KFX metadata reader (from KFX Input) (1, 50, 0) && KFX Input (1, 50, 0) && Set KFX metadata (from KFX Output) (1, 65, 0) && KFX Output (1, 65, 0) && Kindle Collections (1, 7, 29)
calibre 6.11 Portable embedded-python: True
Windows-10-10.0.19045-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19045')
Python 3.10.1
Windows: ('10', '10.0.19045', 'SP0', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 50, 0) && DeDRM (10, 0, 3) && Package KFX (from KFX Input) (1, 50, 0) && Find Duplicates (1, 10, 7) && KFX metadata reader (from KFX Input) (1, 50, 0) && KFX Input (1, 50, 0) && Set KFX metadata (from KFX Output) (1, 65, 0) && KFX Output (1, 65, 0) && Kindle Collections (1, 7, 29)
QPA platform: windows
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 81.55183946488295 x 81.64285714285714
[0.00] Starting up...
[0.00] Initializing db...
[0.36] db initialized
[0.36] Constructing main UI...
Screens currently in system:
{'depth': 32,
 'device_pixel_ratio': 1.0,
 'geometry_in_logical_pixels': {'height': 1080, 'width': 1920, 'x': 0, 'y': 0},
 'index_in_screens_list': 0,
 'manufacturer': '',
 'model': '',
 'name': '\\\\.\\DISPLAY1',
 'serial': '',
 'size_in_logical_pixels': {'height': 1080, 'width': 1920},
 'virtual_geometry': {'height': 1080, 'width': 3840, 'x': 0, 'y': 0}}
{'depth': 32,
 'device_pixel_ratio': 1.0,
 'geometry_in_logical_pixels': {'height': 1080,
                                'width': 1920,
                                'x': 1920,
                                'y': 0},
 'index_in_screens_list': 1,
 'manufacturer': '',
 'model': '',
 'name': '\\\\.\\DISPLAY2',
 'serial': '',
 'size_in_logical_pixels': {'height': 1080, 'width': 1920},
 'virtual_geometry': {'height': 1080, 'width': 3840, 'x': 0, 'y': 0}}
Restoring geometry for: calibre_main_window_geometry
{'frame_geometry': {'height': 1048, 'width': 1920, 'x': 0, 'y': -8},
 'full_screened': False,
 'geometry': {'height': 1017, 'width': 1920, 'x': 0, 'y': 23},
 'maximized': True,
 'normal_geometry': {'height': 1017, 'width': 1920, 'x': 0, 'y': 23},
 'screen': {'depth': 32,
            'device_pixel_ratio': 1.0,
            'geometry_in_logical_pixels': {'height': 1080,
                                           'width': 1920,
                                           'x': 0,
                                           'y': 0},
            'index_in_screens_list': 0,
            'manufacturer': '',
            'model': '',
            'name': '\\\\.\\DISPLAY1',
            'serial': '',
            'size_in_logical_pixels': {'height': 1080, 'width': 1920},
            'virtual_geometry': {'height': 1080,
                                 'width': 3840,
                                 'x': 0,
                                 'y': 0}}}
Matching screen: {'depth': 32,
 'device_pixel_ratio': 1.0,
 'geometry_in_logical_pixels': {'height': 1080, 'width': 1920, 'x': 0, 'y': 0},
 'index_in_screens_list': 0,
 'manufacturer': '',
 'model': '',
 'name': '\\\\.\\DISPLAY1',
 'serial': '',
 'size_in_logical_pixels': {'height': 1080, 'width': 1920},
 'virtual_geometry': {'height': 1080, 'width': 3840, 'x': 0, 'y': 0}}
Setting widget geometry to: {'height': 1017, 'width': 1920, 'x': 0, 'y': 23}
Restoring widget to maximized
[1.58] main UI initialized...
[1.58] Started up in 1.58 seconds with 10311 books
Starting QuickView
Gather KFX-ZIP (from KFX Input) 1.50.0: Importing C:/Users/zacha/Documents/My Kindle Content/B0BSXQD76F_EBOK/B0BSXQD76F_EBOK.azw
Gather KFX-ZIP (from KFX Input): Gathered 4 file(s) as C:\Users\zacha\AppData\Local\Temp\calibre_4gvltate\758_wyg6.kfx-zip
DeDRM v10.0.3: Trying to decrypt 758_wyg6.kfx-zip
Using Library AlfCrypto DLL/DYLIB/SO
Decrypting KFX-ZIP ebook: 758_wyg6
Got DSN key from database default_key_2
Got DSN key from database default_key_3
Got DSN key from database default_key_4
Got DSN key from database new_key
Found 7 keys to try after 0.2 seconds
Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.ef0564de-4b3b-489e-a79b-017053cf45d1.voucher
Traceback (most recent call last):
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 105, in decrypt_voucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 886, in decryptvoucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 762, in pkcs7unpad
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 102, in _assert
Exception: Incorrect padding - Wrong key
Traceback (most recent call last):
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 105, in decrypt_voucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 886, in decryptvoucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 762, in pkcs7unpad
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 102, in _assert
Exception: Incorrect padding - Wrong key
Traceback (most recent call last):
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 105, in decrypt_voucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 886, in decryptvoucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 762, in pkcs7unpad
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 102, in _assert
Exception: Incorrect padding - Wrong key
Traceback (most recent call last):
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 105, in decrypt_voucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 886, in decryptvoucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 762, in pkcs7unpad
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 102, in _assert
Exception: Incorrect padding - Wrong key
Traceback (most recent call last):
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 105, in decrypt_voucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 886, in decryptvoucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 762, in pkcs7unpad
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 102, in _assert
Exception: Incorrect padding - Wrong key
Traceback (most recent call last):
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 105, in decrypt_voucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 886, in decryptvoucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 762, in pkcs7unpad
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 102, in _assert
Exception: Incorrect padding - Wrong key
Traceback (most recent call last):
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 105, in decrypt_voucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 886, in decryptvoucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 762, in pkcs7unpad
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 102, in _assert
Exception: Incorrect padding - Wrong key
Traceback (most recent call last):
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 105, in decrypt_voucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 886, in decryptvoucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 762, in pkcs7unpad
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 102, in _assert
Exception: Incorrect padding - Wrong key
DeDRM v10.0.3: Failed to decrypt with error: Failed to decrypt KFX DRM voucher with any key
DeDRM v10.0.3: Looking for new default Kindle Key after 0.2 seconds
searching for kinfoFiles in C:\Users\zacha\AppData\Local
Found K4PC 1.25+ kinf2018 file: C:\Users\zacha\AppData\Local\Amazon\Kindle\storage\.kinf2018
Decrypted key file using IDString '2827880601' and UserName 'zacha'
DeDRM v10.0.3: Found 1 new key
Decrypting KFX-ZIP ebook: 758_wyg6
Got DSN key from database key_0
Found 1 keys to try after 0.4 seconds
Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.ef0564de-4b3b-489e-a79b-017053cf45d1.voucher
Traceback (most recent call last):
  File "calibre_plugins.dedrm.__init__", line 957, in KindleMobiDecrypt
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\k4mobidedrm.py", line 261, in GetDecryptedBook
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 67, in processBook
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 111, in decrypt_voucher
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 "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 105, in decrypt_voucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 886, in decryptvoucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 762, in pkcs7unpad
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 102, in _assert
Exception: Incorrect padding - Wrong key
Traceback (most recent call last):
  File "calibre_plugins.dedrm.__init__", line 957, in KindleMobiDecrypt
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\k4mobidedrm.py", line 261, in GetDecryptedBook
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 67, in processBook
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 111, in decrypt_voucher
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 "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 105, in decrypt_voucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 886, in decryptvoucher
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 762, in pkcs7unpad
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\ion.py", line 102, in _assert
Exception: Incorrect padding - Wrong key
Traceback (most recent call last):
  File "calibre_plugins.dedrm.__init__", line 957, in KindleMobiDecrypt
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\k4mobidedrm.py", line 261, in GetDecryptedBook
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 67, in processBook
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 111, in decrypt_voucher
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.__init__", line 991, in KindleMobiDecrypt
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\k4mobidedrm.py", line 261, in GetDecryptedBook
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 67, in processBook
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 111, in decrypt_voucher
Exception: Failed to decrypt KFX DRM voucher with any key
DeDRM v10.0.3: Ultimately failed to decrypt after 0.4 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md
Running file type plugin DeDRM failed with traceback:
Traceback (most recent call last):
  File "calibre_plugins.dedrm.__init__", line 957, in KindleMobiDecrypt
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\k4mobidedrm.py", line 261, in GetDecryptedBook
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 67, in processBook
  File "E:\Ebooks\Calibre Settings\plugins\DeDRM.zip\kfxdedrm.py", line 111, in decrypt_voucher
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 178, in _run_filetype_plugins
  File "calibre_plugins.dedrm.__init__", line 1056, in run
  File "calibre_plugins.dedrm.__init__", line 1007, in KindleMobiDecrypt
calibre_plugins.dedrm.DeDRMError: DeDRM v10.0.3: Ultimately failed to decrypt after 0.4 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md
Package KFX (from KFX Input) 1.50.0: Packaging C:\Users\zacha\AppData\Local\Temp\calibre_4gvltate\758_wyg6.kfx-zip
Processing container: B0BSXQD76F_EBOK.azw
Running file type plugin Package KFX (from KFX Input) failed with traceback:
Traceback (most recent call last):
  File "calibre\customize\ui.py", line 178, in _run_filetype_plugins
  File "calibre_plugins.kfx_input.package_filetype", line 21, in run
  File "calibre_plugins.kfx_input.package_filetype", line 32, in run_kfx
  File "calibre_plugins.kfx_input.kfxlib.yj_book", line 83, in convert_to_single_kfx
  File "calibre_plugins.kfx_input.kfxlib.yj_book", line 210, in decode_book
  File "calibre_plugins.kfx_input.kfxlib.yj_book", line 317, in get_container
calibre_plugins.kfx_input.kfxlib.utilities.KFXDRMError: Book container B0BSXQD76F_EBOK.azw has DRM and cannot be converted
KFX metadata reader (from KFX Input) activated for C:\Users\zacha\AppData\Local\Temp\calibre_4gvltate\7oa_kq73_add_books\0\B0BSXQD76F_EBOK.kfx-zip
Added Rainbow Living: A Guide to Thriving as an LGBTQ+ Individual to db in: 0.5
ElleKayEm commented 1 year ago

Yup, that is the situation with books published after 3 January 2023. Only workaround is having an E-ink Kindle and getting the older format. See this post: https://www.mobileread.com/forums/showthread.php?t=283371

And more here: https://www.mobileread.com/forums/showthread.php?t=351285

ElleKayEm commented 1 year ago

There are a few books which aren't available in the KFX format and those can still be DeDRMed when downloaded with Kindle for PC 1.39 -- like comics and manga.

ElusiveZatchmo commented 1 year ago

Presently, I've had some recent purchases that won't download in older Kindle versions. All I get it a pop-up to update my Kindle of PC in order to download these books, some of which have been comics. So, I'm hoping there'll be an update soon to DeDRM that will work with more current Kindle apps.

ElleKayEm commented 1 year ago

Did you try decrypting the comics downloaded with the latest Kindle app? Those are likely in the older format.

An update to DeDRM for this is unlikely to be coming soon. There have been 2 previous updates which addressed the latest KFX DRM and Amazon broke it by the next day. They have many variations already in place in their software/devices which they can switch to without pushing any updates. They simply start delivering differently encrypted files.

extesy commented 1 year ago

Maybe @apprenticesakuya or @llrosy798 who contributed previous methods could take a look again?

BRASPO22 commented 1 year ago

KFX Begone 5 solution? Help Jhowell.

j-howell commented 1 year ago

KFX Begone 5 solution? Help Jhowell.

Older versions of Kindle for PC used the Windows registry to control the disabling of support for KFX format. KFX_begone took advantage of that, Amazon has fixed that hole in later versions of Kindle for PC.

So far no one has come up with an alternate means of disabling KFX. It may simply no longer be possible in newer K4PC versions.

BRASPO22 commented 1 year ago

VERY VERY VERY THANK YOU for your work and everyone in the group for helping us get our ebooks. I wouldn't have the countless ebooks if it weren't for you. Thank you very much. ❤

j-howell commented 1 year ago

I did some work on converting to and from KFX format but it was others who worked out the associated DRM (no longer used by Amazon) and the methods for disabling KFX in K4PC.

My contribution has mostly been in documenting what others have found.

NiQ1 commented 1 year ago

@ElleKayEm Maybe we should open an issue named "DRM cannot be removed from Amazon eBooks published after Jan 3rd 2023" so (1) people would see it and not open multiple issues regarding the same problem and (2) we could centralize the discussion instead of having to dig through multiple issues to get relevant info.

ElleKayEm commented 1 year ago

It still can be removed for most books. The link I posted above (https://www.mobileread.com/forums/showthread.php?t=283371) is updated with current known workarounds and has been for many years. The FAQs here have links to it. The discussion there is the best place I know for keeping up with the changes. Nothing stops people from opening multiple issues about the same problem. Nothing stops people from commenting on past issues that have no relation to the problem they are having. :)