noDRM / DeDRM_tools

DeDRM tools for ebooks
7.04k stars 314 forks source link

Convert KFX to PDF error #332

Open koosd1 opened 1 year ago

koosd1 commented 1 year ago

Question / bug report

Using calibre Qt style: True calibre Debug log calibre 6.17 embedded-python: True macOS-13.3.1-arm64-arm-64bit Darwin ('64bit', '') ('Darwin', '22.4.0', 'Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000') Python 3.10.1 OSX: ('13.3.1', ('', '', ''), 'arm64') Interface language: None Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 51, 0) && DeDRM (10, 0, 3) && Package KFX (from KFX Input) (1, 51, 0) && KFX metadata reader (from KFX Input) (1, 51, 0) && KFX Input (1, 51, 0) && Set KFX metadata (from KFX Output) (1, 67, 0) && KFX Output (1, 67, 0) && Obok DeDRM (10, 0, 3) calibre 6.17 embedded-python: True macOS-13.3.1-arm64-arm-64bit Darwin ('64bit', '') ('Darwin', '22.4.0', 'Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000') Python 3.10.1 OSX: ('13.3.1', ('', '', ''), 'arm64') Interface language: None Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 51, 0) && DeDRM (10, 0, 3) && Package KFX (from KFX Input) (1, 51, 0) && KFX metadata reader (from KFX Input) (1, 51, 0) && KFX Input (1, 51, 0) && Set KFX metadata (from KFX Output) (1, 67, 0) && KFX Output (1, 67, 0) && Obok DeDRM (10, 0, 3) QPA platform: cocoa devicePixelRatio: 2.0 logicalDpi: 72.0 x 72.0 physicalDpi: 127.50000191485789 x 127.50000191485789 [0.00] Starting up... [0.05] Showing splash screen... [0.22] splash screen shown [0.22] Initializing db... [0.23] db initialized [0.23] Constructing main UI... DEBUG: 0.0 obok::utilities.py - loading translations DEBUG: 0.0 obok::dialogs.py - loading translations DEBUG: 0.0 obok::config.py - loading translations DEBUG: 0.0 obok::actionerr.py - loading translations [0.62] main UI initialized... [0.62] Hiding splash screen Starting QuickView 2023-05-12 14:35:54.248 calibre-debug[60565:4479576] +[CATransaction synchronize] called within transaction Gather KFX-ZIP (from KFX Input) 1.51.0: Importing /Users/koos/Desktop/Kyndle/documents/The Daniel Dilemma Bible Study Guide How to Stand Firm and Love Well in a Culture of Compromise_B06XFN3PLK.kfx Gather KFX-ZIP (from KFX Input): Gathered 4 file(s) as /var/folders/d7/32n675p524v2dxnlb83kzgsr0000gn/C/calibre_6.17.0_tmp_8taoi8yl/bees0qrd.kfx-zip DeDRM v10.0.3: Trying to decrypt bees0qrd.kfx-zip Using Library AlfCrypto Python Decrypting KFX-ZIP ebook: bees0qrd Found 0 keys to try after 0.1 seconds Decrypting KFX DRM voucher: voucher Traceback (most recent call last): File "/Users/koos/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 105, in decrypt_voucher voucher.decryptvoucher() File "/Users/koos/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 886, in decryptvoucher b = pkcs7unpad(b, 16) File "/Users/koos/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 762, in pkcs7unpad _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key") File "/Users/koos/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 102, in _assert raise Exception(msg) 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.1 seconds No k4Mac kindle-info/rainier/kinf2011 files have been found. DeDRM v10.0.3: Ultimately failed to decrypt after 0.1 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 book = k4mobidedrm.GetDecryptedBook(path_to_ebook,kindleDatabases,androidFiles,serials,pids,self.starttime) File "/Users/koos/Library/Preferences/calibre/plugins/DeDRM.zip/k4mobidedrm.py", line 261, in GetDecryptedBook mb.processBook(totalpids) File "/Users/koos/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 67, in processBook self.decrypt_voucher(totalpids) File "/Users/koos/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 111, 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 187, in _run_filetype_plugins File "calibre_plugins.dedrm.init", line 1056, in run decrypted_ebook = self.KindleMobiDecrypt(path_to_ebook) File "calibre_plugins.dedrm.init", line 1007, in KindleMobiDecrypt raise DeDRMError("{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime)) calibre_plugins.dedrm.DeDRMError: DeDRM v10.0.3: Ultimately failed to decrypt after 0.1 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md Package KFX (from KFX Input) 1.51.0: Packaging /var/folders/d7/32n675p524v2dxnlb83kzgsr0000gn/C/calibre_6.17.0_tmp8taoi8yl/bees0qrd.kfx-zip Processing container: CR!BMFJGPTN191CN07QGR01E3MPZ0C0.kfx Processing container: The Daniel Dilemma Bible Study Guide How to Stand Firm and Love Well in a Culture of Compromise_B06XFN3PLK.kfx Running file type plugin Package KFX (from KFX Input) failed with traceback: Traceback (most recent call last): File "calibre/customize/ui.py", line 187, 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 83, in convert_to_single_kfx self.decode_book() File "calibre_plugins.kfx_input.kfxlib.yj_book", line 210, in decode_book container = self.get_container(datafile) File "calibre_plugins.kfx_input.kfxlib.yj_book", line 317, in get_container raise KFXDRMError("Book container %s has DRM and cannot be converted" % datafile.name) calibre_plugins.kfxinput.kfxlib.utilities.KFXDRMError: Book container The Daniel Dilemma Bible Study Guide How to Stand Firm and Love Well in a Culture of Compromise_B06XFN3PLK.kfx has DRM and cannot be converted KFX metadata reader (from KFX Input) activated for /var/folders/d7/32n675p524v2dxnlb83kzgsr0000gn/C/calibre_6.17.0_tmp_8taoi8yl/24uqg3o5_addbooks/0/The Daniel Dilemma Bible Study Guide How to Stand Firm and Love Well in a Culture of Compromise_B06XFN3PLK.kfx-zip [209.89] splash screen hidden [209.89] Started up in 209.89 seconds with 0 books Added The Daniel Dilemma Bible Study Guide to db in: 0.0 Added 1 books in 0.5 seconds

Which version of Calibre are you running?

6.17

Which version of the DeDRM plugin are you running?

V10.0.3

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

No response

Log output


Paste log output here.
```Using calibre Qt style: True
calibre Debug log
calibre 6.17  embedded-python: True
macOS-13.3.1-arm64-arm-64bit Darwin ('64bit', '')
('Darwin', '22.4.0', 'Darwin Kernel Version 22.4.0: Mon Mar  6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000')
Python 3.10.1
OSX: ('13.3.1', ('', '', ''), 'arm64')
Interface language: None
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 51, 0) && DeDRM (10, 0, 3) && Package KFX (from KFX Input) (1, 51, 0) && KFX metadata reader (from KFX Input) (1, 51, 0) && KFX Input (1, 51, 0) && Set KFX metadata (from KFX Output) (1, 67, 0) && KFX Output (1, 67, 0) && Obok DeDRM (10, 0, 3)
calibre 6.17  embedded-python: True
macOS-13.3.1-arm64-arm-64bit Darwin ('64bit', '')
('Darwin', '22.4.0', 'Darwin Kernel Version 22.4.0: Mon Mar  6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000')
Python 3.10.1
OSX: ('13.3.1', ('', '', ''), 'arm64')
Interface language: None
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 51, 0) && DeDRM (10, 0, 3) && Package KFX (from KFX Input) (1, 51, 0) && KFX metadata reader (from KFX Input) (1, 51, 0) && KFX Input (1, 51, 0) && Set KFX metadata (from KFX Output) (1, 67, 0) && KFX Output (1, 67, 0) && Obok DeDRM (10, 0, 3)
QPA platform: cocoa
devicePixelRatio: 2.0
logicalDpi: 72.0 x 72.0
physicalDpi: 127.50000191485789 x 127.50000191485789
[0.00] Starting up...
[0.05] Showing splash screen...
[0.22] splash screen shown
[0.22] Initializing db...
[0.23] db initialized
[0.23] Constructing main UI...
DEBUG:    0.0 obok::utilities.py - loading translations
DEBUG:    0.0 obok::dialogs.py - loading translations
DEBUG:    0.0 obok::config.py - loading translations
DEBUG:    0.0 obok::action_err.py - loading translations
[0.62] main UI initialized...
[0.62] Hiding splash screen
Starting QuickView
2023-05-12 14:35:54.248 calibre-debug[60565:4479576] +[CATransaction synchronize] called within transaction
Gather KFX-ZIP (from KFX Input) 1.51.0: Importing /Users/koos/Desktop/Kyndle/documents/The Daniel Dilemma Bible Study Guide_ How to Stand Firm and Love Well in a Culture of Compromise_B06XFN3PLK.kfx
Gather KFX-ZIP (from KFX Input): Gathered 4 file(s) as /var/folders/d7/32n675p524v2dxnlb83kzgsr0000gn/C/calibre_6.17.0_tmp_8taoi8yl/bees0qrd.kfx-zip
DeDRM v10.0.3: Trying to decrypt bees0qrd.kfx-zip
Using Library AlfCrypto Python
Decrypting KFX-ZIP ebook: bees0qrd
Found 0 keys to try after 0.1 seconds
Decrypting KFX DRM voucher: voucher
Traceback (most recent call last):
  File "/Users/koos/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 105, in decrypt_voucher
    voucher.decryptvoucher()
  File "/Users/koos/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 886, in decryptvoucher
    b = pkcs7unpad(b, 16)
  File "/Users/koos/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 762, in pkcs7unpad
    _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key")
  File "/Users/koos/Library/Preferences/calibre/plugins/DeDRM.zip/ion.py", line 102, in _assert
    raise Exception(msg)
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.1 seconds
No k4Mac kindle-info/rainier/kinf2011 files have been found.
DeDRM v10.0.3: Ultimately failed to decrypt after 0.1 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
    book = k4mobidedrm.GetDecryptedBook(path_to_ebook,kindleDatabases,androidFiles,serials,pids,self.starttime)
  File "/Users/koos/Library/Preferences/calibre/plugins/DeDRM.zip/k4mobidedrm.py", line 261, in GetDecryptedBook
    mb.processBook(totalpids)
  File "/Users/koos/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 67, in processBook
    self.decrypt_voucher(totalpids)
  File "/Users/koos/Library/Preferences/calibre/plugins/DeDRM.zip/kfxdedrm.py", line 111, 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 187, in _run_filetype_plugins
  File "calibre_plugins.dedrm.__init__", line 1056, in run
    decrypted_ebook = self.KindleMobiDecrypt(path_to_ebook)
  File "calibre_plugins.dedrm.__init__", line 1007, in KindleMobiDecrypt
    raise DeDRMError("{0} v{1}: Ultimately failed to decrypt after {2:.1f} seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md".format(PLUGIN_NAME, PLUGIN_VERSION,time.time()-self.starttime))
calibre_plugins.dedrm.DeDRMError: DeDRM v10.0.3: Ultimately failed to decrypt after 0.1 seconds. Read the FAQs at noDRM's repository: https://github.com/noDRM/DeDRM_tools/blob/master/FAQs.md
Package KFX (from KFX Input) 1.51.0: Packaging /var/folders/d7/32n675p524v2dxnlb83kzgsr0000gn/C/calibre_6.17.0_tmp_8taoi8yl/bees0qrd.kfx-zip
Processing container: CR!BMFJGPTN191CN07QGR01E3MPZ0C0.kfx
Processing container: The Daniel Dilemma Bible Study Guide_ How to Stand Firm and Love Well in a Culture of Compromise_B06XFN3PLK.kfx
Running file type plugin Package KFX (from KFX Input) failed with traceback:
Traceback (most recent call last):
  File "calibre/customize/ui.py", line 187, 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 83, in convert_to_single_kfx
    self.decode_book()
  File "calibre_plugins.kfx_input.kfxlib.yj_book", line 210, in decode_book
    container = self.get_container(datafile)
  File "calibre_plugins.kfx_input.kfxlib.yj_book", line 317, 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 The Daniel Dilemma Bible Study Guide_ How to Stand Firm and Love Well in a Culture of Compromise_B06XFN3PLK.kfx has DRM and cannot be converted
KFX metadata reader (from KFX Input) activated for /var/folders/d7/32n675p524v2dxnlb83kzgsr0000gn/C/calibre_6.17.0_tmp_8taoi8yl/24uqg3o5_add_books/0/The Daniel Dilemma Bible Study Guide_ How to Stand Firm and Love Well in a Culture of Compromise_B06XFN3PLK.kfx-zip
[209.89] splash screen hidden
[209.89] Started up in 209.89 seconds with 0 books
Added The Daniel Dilemma Bible Study Guide to db in: 0.0
Added 1 books in 0.5 seconds
ElleKayEm commented 1 year ago

Use one of the methods here to get the book in non-kfx format: https://www.mobileread.com/forums/showthread.php?t=283371