apprenticeharper / DeDRM_tools

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

DeDRM / Kindle stopped working - Mac #1690

Open Josh5A opened 3 years ago

Josh5A commented 3 years ago

Calibre 5.14.0 and DeDRM 7 (not sure exact version) were working with Kindle fine on Big Sur, and then today it didn't work. I tried with calibre 4.23 and DeDRM 6.8.1 as I saw suggested on another issue that has worked for people, but it didn't work for me. I'll include logs for both.

Calibre 5 log:

libpng warning: iCCP: known incorrect sRGB profile
calibre Debug log
calibre 5.14  embedded-python: True is64bit: True
macOS-10.16-x86_64-i386-64bit Darwin ('64bit', '')
('Darwin', '20.3.0', 'Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64')
Python 3.8.5
OSX: ('10.16', ('', '', ''), 'x86_64')
Interface language: None
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 39, 0) && DeDRM (7, 2, 1) && Package KFX (from KFX Input) (1, 39, 0) && Find Duplicates (1, 8, 5) && KFX metadata reader (from KFX Input) (1, 39, 0) && KFX Input (1, 39, 0) && Kindle hi-res covers (0, 5, 0) && Reading List (1, 7, 2) && Resize Cover (1, 1, 0)
calibre 5.14  embedded-python: True is64bit: True
macOS-10.16-x86_64-i386-64bit Darwin ('64bit', '')
('Darwin', '20.3.0', 'Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64')
Python 3.8.5
OSX: ('10.16', ('', '', ''), 'x86_64')
Interface language: None
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 39, 0) && DeDRM (7, 2, 1) && Package KFX (from KFX Input) (1, 39, 0) && Find Duplicates (1, 8, 5) && KFX metadata reader (from KFX Input) (1, 39, 0) && KFX Input (1, 39, 0) && Kindle hi-res covers (0, 5, 0) && Reading List (1, 7, 2) && Resize Cover (1, 1, 0)
devicePixelRatio: 2.0
logicalDpi: 72.0 x 72.0
physicalDpi: 110.50000165954353 x 110.50000165954353
Using calibre Qt style: True
[0.00] Starting up...
[0.02] Showing splash screen...
[0.25] splash screen shown
[0.25] Initializing db...
[0.90] db initialized
[0.90] Constructing main UI...
{'width': 450, 'height': 680, 'default': True}
Resize Covers::rebuild_menus - size_data={'width': 450, 'height': 680, 'default': True}
[2.42] main UI initialized...
[2.42] Hiding splash screen
Starting QuickView
Gather KFX-ZIP (from KFX Input) 1.39.0: Importing /Users/josh/Library/Application Support/Kindle/My Kindle Content/B00EH0JTTC_EBOK/B00EH0JTTC_EBOK.azw
Gather KFX-ZIP (from KFX Input): Gathered 8 file(s) as /var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/rtihymos.kfx-zip
DeDRM v7.2.1: Trying to decrypt rtihymos.kfx-zip
Using Library AlfCrypto Python
Using Library AlfCrypto Python
Decrypting KFX-ZIP ebook: rtihymos
Found 0 keys to try after 0.1 seconds
Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.ca5c663a-5807-42e0-862f-bd2e766de3f7.voucher
Traceback (most recent call last):
  File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher
    voucher.decryptvoucher()
  File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/5lpfwudtplugin_unzip/ion.py", line 879, in decryptvoucher
    b = pkcs7unpad(b, 16)
  File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/5lpfwudtplugin_unzip/ion.py", line 758, in pkcs7unpad
    _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key")
  File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/5lpfwudtplugin_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/josh/Library/Application Support/Kindle/storage/.kinf2018
trying username  b'josh'  on file  /Users/josh/Library/Application Support/Kindle/storage/.kinf2018
trying IDString: b'99b067471dc3'
[4.59] splash screen hidden
[4.59] Started up in 4.59 seconds with 6042 books
Decrypted key file using IDString '99b067471dc3' and UserName 'josh'
DeDRM v7.2.1: Found 1 new key
Decrypting KFX-ZIP ebook: rtihymos
Got SerialNumber from database default_key_1
Got UsernameHash from database default_key_1
Found 1 keys to try after 0.6 seconds
Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.ca5c663a-5807-42e0-862f-bd2e766de3f7.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/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/5lpfwudtplugin_unzip/ion.py", line 879, in decryptvoucher
    b = pkcs7unpad(b, 16)
  File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/5lpfwudtplugin_unzip/ion.py", line 758, in pkcs7unpad
    _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key")
  File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/5lpfwudtplugin_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/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/5lpfwudtplugin_unzip/ion.py", line 879, in decryptvoucher
    b = pkcs7unpad(b, 16)
  File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/5lpfwudtplugin_unzip/ion.py", line 758, in pkcs7unpad
    _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key")
  File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/5lpfwudtplugin_unzip/ion.py", line 98, in _assert
    raise Exception(msg)
Exception: Incorrect padding - Wrong key
DeDRM v7.2.1: Ultimately failed to decrypt after 0.6 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
Package KFX (from KFX Input) 1.39.0: Packaging /var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/rtihymos.kfx-zip
Processing container: B00EH0JTTC_EBOK.azw
KFX metadata reader (from KFX Input) activated for /var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/v53h94w5_add_books/0/B00EH0JTTC_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 172, 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 0.6 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 172, 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 85, in convert_to_single_kfx
    self.decode_book()
  File "calibre_plugins.kfx_input.kfxlib.yj_book", line 212, in decode_book
    container = self.get_container(datafile)
  File "calibre_plugins.kfx_input.kfxlib.yj_book", line 319, 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 B00EH0JTTC_EBOK.azw has DRM and cannot be converted
Added THE KEMETIC TREE OF LIFE: Newly Revealed Ancient Egyptian Cosmology Mysticism to db in: 0.1
Added 1 books in 1.6 seconds
Worker Launch took: 0.04 seconds
Job: 0 Convert book 1 of 1 (THE KEMETIC TREE OF LIFE: Newly Revealed Ancient Egyptian Cosmology Mysticism) finished
Convert book 1 of 1 (THE KEMETIC TREE OF LIFE: Newly Revealed Ancient Egyptian Cosmology Mysticism)
    DeDRM v7.2.1: Trying to decrypt vatb78ws.kfx-zip
    Using Library AlfCrypto Python
    Using Library AlfCrypto Python
    Decrypting KFX-ZIP ebook: vatb78ws
    Found 0 keys to try after 0.1 seconds
    Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.ca5c663a-5807-42e0-862f-bd2e766de3f7.voucher
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher
        voucher.decryptvoucher()
      File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_unzip/ion.py", line 879, in decryptvoucher
        b = pkcs7unpad(b, 16)
      File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_unzip/ion.py", line 758, in pkcs7unpad
        _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key")
      File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_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/josh/Library/Application Support/Kindle/storage/.kinf2018
    trying username  b'josh'  on file  /Users/josh/Library/Application Support/Kindle/storage/.kinf2018
    trying IDString: b'99b067471dc3'
    Decrypted key file using IDString '99b067471dc3' and UserName 'josh'
    DeDRM v7.2.1: Found 1 new key
    Decrypting KFX-ZIP ebook: vatb78ws
    Got SerialNumber from database default_key_1
    Got UsernameHash from database default_key_1
    Found 1 keys to try after 0.6 seconds
    Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.ca5c663a-5807-42e0-862f-bd2e766de3f7.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/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_unzip/ion.py", line 879, in decryptvoucher
        b = pkcs7unpad(b, 16)
      File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_unzip/ion.py", line 758, in pkcs7unpad
        _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key")
      File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_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/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_unzip/ion.py", line 879, in decryptvoucher
        b = pkcs7unpad(b, 16)
      File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_unzip/ion.py", line 758, in pkcs7unpad
        _assert(paddinglen > 0 and paddinglen <= blocklen, "Incorrect padding - Wrong key")
      File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_unzip/ion.py", line 98, in _assert
        raise Exception(msg)
    Exception: Incorrect padding - Wrong key
    DeDRM v7.2.1: Ultimately failed to decrypt after 0.6 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
    Conversion options changed from defaults:
      cover: '/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/qeybmnwh.jpeg'
      read_metadata_from_opf: '/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/wnr1ulkx.opf'
      output_profile: 'generic_eink'
      verbose: 2
    Resolved conversion options
    calibre version: 5.14.0
    {'allow_conversion_with_errors': False,
     'asciiize': False,
     'author_sort': None,
     'authors': None,
     'base_font_size': 0.0,
     'book_producer': None,
     'change_justification': 'original',
     'chapter': "//*[((name()='h1' or name()='h2') and re:test(., "
                "'\\s*((chapter|book|section|part)\\s+)|((prolog|prologue|epilogue)(\\s+|$))', "
                "'i')) or @class = 'chapter']",
     'chapter_mark': 'pagebreak',
     'comments': None,
     'cover': '/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/qeybmnwh.jpeg',
     'debug_pipeline': None,
     'dehyphenate': True,
     'delete_blank_paragraphs': True,
     'disable_font_rescaling': False,
     'dont_split_on_page_breaks': False,
     'duplicate_links_in_toc': False,
     'embed_all_fonts': False,
     'embed_font_family': None,
     'enable_heuristics': False,
     'epub_flatten': False,
     'epub_inline_toc': False,
     'epub_toc_at_end': False,
     'epub_version': '2',
     'expand_css': False,
     'extra_css': None,
     'extract_to': None,
     'filter_css': '',
     'fix_indents': True,
     'flow_size': 260,
     'font_size_mapping': None,
     'format_scene_breaks': True,
     'html_unwrap_factor': 0.4,
     'input_encoding': None,
     'input_profile': <calibre.customize.profiles.InputProfile object at 0x11c62cd00>,
     'insert_blank_line': False,
     'insert_blank_line_size': 0.5,
     'insert_metadata': False,
     'isbn': None,
     'italicize_common_cases': True,
     'keep_ligatures': False,
     'language': None,
     'level1_toc': None,
     'level2_toc': None,
     'level3_toc': None,
     'line_height': 0.0,
     'linearize_tables': False,
     'margin_bottom': 5.0,
     'margin_left': 5.0,
     'margin_right': 5.0,
     'margin_top': 5.0,
     'markup_chapter_headings': True,
     'max_toc_links': 50,
     'minimum_line_height': 120.0,
     'no_chapters_in_toc': False,
     'no_default_epub_cover': False,
     'no_inline_navbars': False,
     'no_svg_cover': False,
     'output_profile': <calibre.customize.profiles.GenericEink object at 0x11c62cfd0>,
     'page_breaks_before': '/',
     'prefer_metadata_cover': False,
     'preserve_cover_aspect_ratio': False,
     'pretty_print': True,
     'pubdate': None,
     'publisher': None,
     'rating': None,
     'read_metadata_from_opf': '/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/wnr1ulkx.opf',
     'remove_fake_margins': True,
     'remove_first_image': False,
     'remove_paragraph_spacing': False,
     'remove_paragraph_spacing_indent_size': 1.5,
     'renumber_headings': True,
     'replace_scene_breaks': '',
     'search_replace': '[]',
     'series': None,
     'series_index': None,
     'smarten_punctuation': False,
     'sr1_replace': None,
     'sr1_search': None,
     'sr2_replace': None,
     'sr2_search': None,
     'sr3_replace': None,
     'sr3_search': None,
     'start_reading_at': None,
     'subset_embedded_fonts': False,
     'tags': None,
     'timestamp': None,
     'title': None,
     'title_sort': None,
     'toc_filter': None,
     'toc_threshold': 6,
     'toc_title': None,
     'transform_css_rules': '[]',
     'unsmarten_punctuation': False,
     'unwrap_lines': True,
     'use_auto_toc': False,
     'verbose': 2}
    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 172, 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 0.6 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
    DeDRM v7.2.1: Trying to decrypt vatb78ws.kfx-zip
    Decrypting KFX-ZIP ebook: vatb78ws
    Found 0 keys to try after 0.0 seconds
    Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.ca5c663a-5807-42e0-862f-bd2e766de3f7.voucher
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher
        voucher.decryptvoucher()
      File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_unzip/ion.py", line 879, in decryptvoucher
      File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_unzip/ion.py", line 758, in pkcs7unpad
      File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_unzip/ion.py", line 98, in _assert
    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.0 seconds
    Found k4Mac kinf2018 file: /Users/josh/Library/Application Support/Kindle/storage/.kinf2018
    trying username  b'josh'  on file  /Users/josh/Library/Application Support/Kindle/storage/.kinf2018
    trying IDString: b'99b067471dc3'
    Decrypted key file using IDString '99b067471dc3' and UserName 'josh'
    DeDRM v7.2.1: Found 1 new key
    Decrypting KFX-ZIP ebook: vatb78ws
    Got SerialNumber from database default_key_1
    Got UsernameHash from database default_key_1
    Found 1 keys to try after 0.5 seconds
    Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.ca5c663a-5807-42e0-862f-bd2e766de3f7.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/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_unzip/ion.py", line 879, in decryptvoucher
      File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_unzip/ion.py", line 758, in pkcs7unpad
      File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_unzip/ion.py", line 98, in _assert
    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/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_unzip/ion.py", line 879, in decryptvoucher
      File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_unzip/ion.py", line 758, in pkcs7unpad
      File "/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/jswv6kneplugin_unzip/ion.py", line 98, in _assert
    Exception: Incorrect padding - Wrong key
    DeDRM v7.2.1: Ultimately failed to decrypt after 0.5 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/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 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 172, 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 0.5 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
    InputFormatPlugin: KFX Input running
    on /var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/vatb78ws.kfx-zip
    Software versions: KFX Input 1.39.0, calibre 5.14, macOS-10.16-x86_64-i386-64bit
    KFX Input plugin help is available at https://www.mobileread.com/forums/showthread.php?t=291290
    Converting /var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_5.14.0_tmp_e1xxamav/vatb78ws.kfx-zip
    Processing container: B00EH0JTTC_EBOK.azw
    Traceback (most recent call last):
      File "calibre_plugins.kfx_input.__init__", line 105, in convert
      File "calibre_plugins.kfx_input.kfxlib.yj_book", line 212, in decode_book
      File "calibre_plugins.kfx_input.kfxlib.yj_book", line 319, in get_container
    calibre_plugins.kfx_input.kfxlib.utilities.KFXDRMError: Book container B00EH0JTTC_EBOK.azw has DRM and cannot be converted

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "runpy.py", line 194, in _run_module_as_main
      File "runpy.py", line 87, in _run_code
      File "site.py", line 39, in <module>
      File "site.py", line 35, in main
      File "calibre/utils/ipc/worker.py", line 216, in main
      File "calibre/gui2/convert/gui_conversion.py", line 41, in gui_convert_override
      File "calibre/gui2/convert/gui_conversion.py", line 28, in gui_convert
      File "calibre/ebooks/conversion/plumber.py", line 1105, in run
      File "calibre/customize/conversion.py", line 245, in __call__
      File "calibre_plugins.kfx_input.__init__", line 125, in convert
    calibre.ebooks.DRMError: This book has DRM!

Calibre 4 log

libpng warning: iCCP: known incorrect sRGB profile
calibre Debug log
calibre 4.23  embedded-python: True is64bit: True
Darwin-20.3.0-x86_64-i386-64bit Darwin ('64bit', '')
('Darwin', '20.3.0', 'Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64')
Python 2.7.16
OSX: ('10.16', ('', '', ''), 'x86_64')
Interface language: None
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 39, 0) && DeDRM (6, 8, 0) && Package KFX (from KFX Input) (1, 39, 0) && Reading List (1, 7, 2) && Find Duplicates (1, 8, 5) && Resize Cover (1, 1, 0) && Kindle hi-res covers (0, 5, 0) && KFX metadata reader (from KFX Input) (1, 39, 0) && KFX Input (1, 39, 0)
calibre 4.23  embedded-python: True is64bit: True
Darwin-20.3.0-x86_64-i386-64bit Darwin ('64bit', '')
('Darwin', '20.3.0', 'Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64')
Python 2.7.16
OSX: ('10.16', ('', '', ''), 'x86_64')
Interface language: None
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 39, 0) && DeDRM (6, 8, 0) && Package KFX (from KFX Input) (1, 39, 0) && Reading List (1, 7, 2) && Find Duplicates (1, 8, 5) && Resize Cover (1, 1, 0) && Kindle hi-res covers (0, 5, 0) && KFX metadata reader (from KFX Input) (1, 39, 0) && KFX Input (1, 39, 0)
devicePixelRatio: 2.0
logicalDpi: 72.0 x 72.0
physicalDpi: 110.50000166 x 110.50000166
Using calibre Qt style: True
[0.00] Starting up...
[0.02] Showing splash screen...
[0.25] splash screen shown
[0.25] Initializing db...
[0.50] db initialized
[0.50] Constructing main UI...
{u'width': 450, u'default': True, u'height': 680}
Resize Covers::rebuild_menus - size_data={u'width': 450, u'default': True, u'height': 680}
[2.26] main UI initialized...
[2.26] Hiding splash screen
Gather KFX-ZIP (from KFX Input) 1.39.0: Importing /Users/josh/Library/Application Support/Kindle/My Kindle Content/B00EH0JTTC_EBOK/B00EH0JTTC_EBOK.azw
Gather KFX-ZIP (from KFX Input): Gathered 8 file(s) as /var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_4.23.0_tmp_Fwgg1Y/3xAUxm.kfx-zip
DeDRM v6.8.0: Trying to decrypt 3xAUxm.kfx-zip
Using Library AlfCrypto Python
Decrypting KFX-ZIP ebook: 3xAUxm
Found 0 keys to try after 0.0 seconds
Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.ca5c663a-5807-42e0-862f-bd2e766de3f7.voucher
DeDRM v6.8.0: Failed to decrypt with error: Failed to decrypt KFX DRM voucher with any key
DeDRM v6.8.0: Looking for new default Kindle Key after 0.0 seconds
Found k4Mac kinf2018 file: /Users/josh/Library/Application Support/Kindle/storage/.kinf2018
Decrypted key file using IDString '99b067471dc3' and UserName 'josh'
DeDRM v6.8.0: Found 1 new key
Decrypting KFX-ZIP ebook: 3xAUxm
Got DSN key from database default_key_1
Found 1 keys to try after 0.6 seconds
Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.ca5c663a-5807-42e0-862f-bd2e766de3f7.voucher
DeDRM v6.8.0: Ultimately failed to decrypt after 0.6 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
Running file type plugin DeDRM failed with traceback:
Traceback (most recent call last):
  File "site-packages/calibre/customize/ui.py", line 172, in _run_filetype_plugins
  File "calibre_plugins.dedrm.__init__", line 626, in run
  File "calibre_plugins.dedrm.__init__", line 576, in KindleMobiDecrypt
DeDRMError: DeDRM v6.8.0: Ultimately failed to decrypt after 0.6 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
Package KFX (from KFX Input) 1.39.0: Packaging /var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_4.23.0_tmp_Fwgg1Y/3xAUxm.kfx-zip
Processing container: B00EH0JTTC_EBOK.azw
Running file type plugin Package KFX (from KFX Input) failed with traceback:
Traceback (most recent call last):
  File "site-packages/calibre/customize/ui.py", line 172, 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 85, in convert_to_single_kfx
  File "calibre_plugins.kfx_input.kfxlib.yj_book", line 212, in decode_book
  File "calibre_plugins.kfx_input.kfxlib.yj_book", line 319, in get_container
KFXDRMError: Book container B00EH0JTTC_EBOK.azw has DRM and cannot be converted
KFX metadata reader (from KFX Input) activated for /var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_4.23.0_tmp_Fwgg1Y/1ANcSI_add_books/0/B00EH0JTTC_EBOK.kfx-zip
[16.51] splash screen hidden
[16.51] Started up in 16.51 seconds with 6043 books
Added THE KEMETIC TREE OF LIFE: Newly Revealed Ancient Egyptian Cosmology Mysticism to db in: 0.1
Added 1 books in 1.7 seconds
Worker Launch took: 0.127543926239
Job: 0 Convert book 1 of 1 (THE KEMETIC TREE OF LIFE: Newly Revealed Ancient Egyptian Cosmology Mysticism) finished
Convert book 1 of 1 (THE KEMETIC TREE OF LIFE: Newly Revealed Ancient Egyptian Cosmology Mysticism)
    Conversion options changed from defaults:
      output_profile: u'generic_eink'
      verbose: 2
      read_metadata_from_opf: u'/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_4.23.0_tmp_Fwgg1Y/Ta_kc7.opf'
      cover: u'/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_4.23.0_tmp_Fwgg1Y/F3wPuN.jpeg'
    Resolved conversion options
    calibre version: 4.23.0
    {'allow_conversion_with_errors': False,
     'asciiize': False,
     'author_sort': None,
     'authors': None,
     'base_font_size': 0.0,
     'book_producer': None,
     'change_justification': u'original',
     'chapter': u"//*[((name()='h1' or name()='h2') and re:test(., '\\s*((chapter|book|section|part)\\s+)|((prolog|prologue|epilogue)(\\s+|$))', 'i')) or @class = 'chapter']",
     'chapter_mark': u'pagebreak',
     'comments': None,
     'cover': u'/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_4.23.0_tmp_Fwgg1Y/F3wPuN.jpeg',
     'debug_pipeline': None,
     'dehyphenate': True,
     'delete_blank_paragraphs': True,
     'disable_font_rescaling': False,
     'dont_split_on_page_breaks': False,
     'duplicate_links_in_toc': False,
     'embed_all_fonts': False,
     'embed_font_family': None,
     'enable_heuristics': False,
     'epub_flatten': False,
     'epub_inline_toc': False,
     'epub_toc_at_end': False,
     'epub_version': u'2',
     'expand_css': False,
     'extra_css': None,
     'extract_to': None,
     'filter_css': u'',
     'fix_indents': True,
     'flow_size': 260,
     'font_size_mapping': None,
     'format_scene_breaks': True,
     'html_unwrap_factor': 0.4,
     'input_encoding': None,
     'input_profile': <calibre.customize.profiles.InputProfile object at 0x1137f54d0>,
     'insert_blank_line': False,
     'insert_blank_line_size': 0.5,
     'insert_metadata': False,
     'isbn': None,
     'italicize_common_cases': True,
     'keep_ligatures': False,
     'language': None,
     'level1_toc': None,
     'level2_toc': None,
     'level3_toc': None,
     'line_height': 0.0,
     'linearize_tables': False,
     'margin_bottom': 5.0,
     'margin_left': 5.0,
     'margin_right': 5.0,
     'margin_top': 5.0,
     'markup_chapter_headings': True,
     'max_toc_links': 50,
     'minimum_line_height': 120.0,
     'no_chapters_in_toc': False,
     'no_default_epub_cover': False,
     'no_inline_navbars': False,
     'no_svg_cover': False,
     'output_profile': <calibre.customize.profiles.GenericEink object at 0x1137f58d0>,
     'page_breaks_before': u'/',
     'prefer_metadata_cover': False,
     'preserve_cover_aspect_ratio': False,
     'pretty_print': True,
     'pubdate': None,
     'publisher': None,
     'rating': None,
     'read_metadata_from_opf': u'/var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_4.23.0_tmp_Fwgg1Y/Ta_kc7.opf',
     'remove_fake_margins': True,
     'remove_first_image': False,
     'remove_paragraph_spacing': False,
     'remove_paragraph_spacing_indent_size': 1.5,
     'renumber_headings': True,
     'replace_scene_breaks': u'',
     'search_replace': '[]',
     'series': None,
     'series_index': None,
     'smarten_punctuation': False,
     'sr1_replace': None,
     'sr1_search': None,
     'sr2_replace': None,
     'sr2_search': None,
     'sr3_replace': None,
     'sr3_search': None,
     'start_reading_at': None,
     'subset_embedded_fonts': False,
     'tags': None,
     'timestamp': None,
     'title': None,
     'title_sort': None,
     'toc_filter': None,
     'toc_threshold': 6,
     'toc_title': None,
     'transform_css_rules': '[]',
     'unsmarten_punctuation': False,
     'unwrap_lines': True,
     'use_auto_toc': False,
     'verbose': 2}
    InputFormatPlugin: KFX Input running
    on /var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_4.23.0_tmp_Fwgg1Y/oRTnow.kfx-zip
    Software versions: KFX Input 1.39.0, calibre 4.23, Darwin-20.3.0-x86_64-i386-64bit
    KFX Input plugin help is available at https://www.mobileread.com/forums/showthread.php?t=291290
    Converting /var/folders/vv/7qw8hzx50d16xhs7sc0kqc1c0000gp/C/calibre_4.23.0_tmp_Fwgg1Y/oRTnow.kfx-zip
    Processing container: B00EH0JTTC_EBOK.
ZolaLa9 commented 3 years ago

See: https://www.mobileread.com/forums/showthread.php?t=283371 and https://www.mobileread.com/forums/showpost.php?p=3819708&postcount=508

ElleKayEm commented 3 years ago

For KFX format, you need no later then Kindle for Mac 1.26. Alternatively, see the links Zola gave for info on avoiding KFX format.

austinarchibald commented 2 years ago

Thanks @ElleKayEm . Re-downloaded and added KFX format ebook after loading Kindle Mac v1.26.1, and DeDRM worked.