DRM Removal Tools for eBooks

Version 7.2.1 released on 11 April, 2021

Welcome to Apprentice Alf’s blog

This blog is intended to help anyone looking for free and simple software for removing DRM from their Kindle ebooks, stripping DRM from their Adobe Digital Editions ebooks, getting rid of DRM from their Barnes and Noble ebooks, freeing their Kobo ebooks of DRM, or decrypting their Fictionwise eReader ebooks.

If you want to find out more about ebooks, DRM and why you will probably want to remove the DRM from your ebooks, see this post:  Ebook Formats, DRM and You — A Guide for the Perplexed.

If you already know that you want to strip the DRM from your ebooks, you’ve found the right place.

The Tools

To get started on removing DRM from your ebooks, just download the tools archive from the link below. Unzip the archive, and start reading.

The latest release can be found at the top of this page:
https://github.com/apprenticeharper/DeDRM_tools/releases

Getting Help with the Tools

If you have any questions about the tools, ebooks, and DRM, check the FAQs at the GitHub repository:
https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md

If you have any problems with the current tools, please ask for help in a comment on this post or in the Discussions area of Apprentice Harper’s GitHub repository.  If you would like to report a bug, please open a new issue at the GitHub repository. If you are having a problem with an older version of the tools, please first update to the current version, and see if that solves your problem.

Before commenting here, please check the ReadMe file and the FAQs (see link above).

In any bug report or help request, please include:

  • which tool was used
  • which OS you are using
  • where the ebook file came from (device or application)
  • any error messages
  • a log of the DRM-removal attempt (see the FAQs on how to get a log).

Anti-Piracy Notice

Please only use these tools for gaining full access to your own ebooks for archiving/conversion/convenience. De-drmed ebooks should not be uploaded to open servers, torrents, or other methods of mass distribution. No help will be given to people doing such things. Authors, retailers and publishers all need to make a living, so that they can continue to produce books for us to read. Don’t be a parasite.

Origin of the Tools

The tools for removing DRM from ePubs were originally posted at i♥cabbages’ blog. The tools for Kindle/Mobipocket were originally posted at The Dark Reverser’s blog.

They have since been improved by many people, but mostly some_updates, DiapDealer, Apprentice Alf, and Apprentice Harper. While there are many sites that redistribute these tools, the most up-to-date versions of the tools are currently released here.

Other Sources

Anyone trying to sell you ebook DRM removal tools for Adobe Adept ePub and PDFs, Barnes & Noble ePubs, Kindle ebooks, Kobo ebooks, or eReader ebooks has probably just repackaged (an earlier) version of the tools available here.

7,459 thoughts on “DRM Removal Tools for eBooks

  1. Hi, I read in the FAQ that the tools should work with books from any store selling ebooks that are compatible with ADE 2.0.1, but I don’t know how to tell whether the books I have are compatible or not. The individual files (10 – 20 per book) seem to be renamed pdfs – if I change the extension to pdf and open them in Acrobat reader I am prompted for a password. I can’t find any .rer files that seem to be related but then they might also have been renamed. Just wondering if there is any mileage in pursuing this.

      • Hi.
        I have a new computer and installed the latest Calibre and DRM tools. I have everything working except for Kindle library books? I used to get them OK with 4.23 and 6.8.1. I read that Library books cannot be converted. Is that something new?
        Thanks,
        Bob

        • Hi Bob are these Library eBooks Loaned or Borrowed for a period of time – in this case, read them with the Kindle app – they are not intended to be converted by removing the DRM … Removing the DRM from Loaned or Borrowed eBooks is a No-No !!!

            • Bob if you have an android device there is a trick that works on Android Devices Only – Back Up ALL of Your Apps & Photos and Anything else You Value – Then with the App that contains the eBook Loaded Already – Turn the Calendar Date back a few Days or weeks and Most of the time the eBook can still be read past the Date of say 21 days – this works with ADE on Many of My Android Devices – This will NOT WORK on any Apple Tablets or other Apple Type Devices – ie You can not Move the Date Back Period …

  2. Hi, I download a amazon book to kindle for pc, updated my /DeDRM_tools, configured the plugin and still couldn’t convert the book. Log reads:
    EpubMerge: DEBUG: 2021-09-25 11:02:12,101: calibre_plugins.epubmerge.epubmerge_plugin(158): macmenuhack file_path:C:\Users\patty\AppData\Roaming\calibre\plugins\fanficfare_macmenuhack.txt
    calibre Debug log
    calibre 5.26 embedded-python: True is64bit: False
    Windows-10-10.0.19041 Windows (’32bit’, ‘WindowsPE’)
    32bit process running on 64bit windows
    (‘Windows’, ’10’, ‘10.0.19041’)
    Python 3.8.5
    Windows: (’10’, ‘10.0.19041’, ”, ‘Multiprocessor Free’)
    Interface language: None
    Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 43, 0) && DeDRM (7, 2, 1) && Package KFX (from KFX Input) (1, 43, 0) && EpubMerge (2, 11, 0) && Find Duplicates (1, 8, 10) && KFX metadata reader (from KFX Input) (1, 43, 0) && KFX Input (1, 43, 0)
    calibre 5.26 embedded-python: True is64bit: False
    Windows-10-10.0.19041 Windows (’32bit’, ‘WindowsPE’)
    32bit process running on 64bit windows
    (‘Windows’, ’10’, ‘10.0.19041’)
    Python 3.8.5
    Windows: (’10’, ‘10.0.19041’, ”, ‘Multiprocessor Free’)
    Interface language: None
    Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 43, 0) && DeDRM (7, 2, 1) && Package KFX (from KFX Input) (1, 43, 0) && EpubMerge (2, 11, 0) && Find Duplicates (1, 8, 10) && KFX metadata reader (from KFX Input) (1, 43, 0) && KFX Input (1, 43, 0)
    Turning on automatic hidpi scaling
    devicePixelRatio: 2.0
    logicalDpi: 96.0 x 96.0
    physicalDpi: 69.96843615494979 x 69.9795918367347
    Using calibre Qt style: True
    [0.00] Starting up…
    [0.00] Showing splash screen…
    [0.33] splash screen shown
    [0.33] Initializing db…
    [0.56] db initialized
    [0.56] Constructing main UI…
    [1.20] main UI initialized…
    [1.20] Hiding splash screen
    Starting QuickView
    Gather KFX-ZIP (from KFX Input) 1.43.0: Importing H:\Documents\My Kindle Content\B00G6SK3EI_EBOK\B00G6SK3EI_EBOK.azw
    Gather KFX-ZIP (from KFX Input): Gathered 4 file(s) as C:\Users\patty\AppData\Local\Temp\calibre_qrf708kw\0qdhyn22.kfx-zip
    DeDRM v7.2.1: Trying to decrypt 0qdhyn22.kfx-zip
    Using Library AlfCrypto DLL/DYLIB/SO
    Using Library AlfCrypto DLL/DYLIB/SO
    Decrypting KFX-ZIP ebook: 0qdhyn22
    Got DSN key from database default_key
    Got DSN key from database default_key_2
    Got DSN key from database default_key_3
    Found 5 keys to try after 0.1 seconds
    Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.c0520fbb-3a92-44fc-a08b-cf2be8ac0a8e.voucher
    Traceback (most recent call last):
    File “calibre_plugins.dedrm.kfxdedrm”, line 83, in decrypt_voucher
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 879, in decryptvoucher
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 758, in pkcs7unpad
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 98, in _assert
    Exception: Incorrect padding – Wrong key
    Traceback (most recent call last):
    File “calibre_plugins.dedrm.kfxdedrm”, line 83, in decrypt_voucher
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 879, in decryptvoucher
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 758, in pkcs7unpad
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 98, in _assert
    Exception: Incorrect padding – Wrong key
    Traceback (most recent call last):
    File “calibre_plugins.dedrm.kfxdedrm”, line 83, in decrypt_voucher
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 884, in decryptvoucher
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 98, in _assert
    Exception: Expected KeySet, got
    Traceback (most recent call last):
    File “calibre_plugins.dedrm.kfxdedrm”, line 83, in decrypt_voucher
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 879, in decryptvoucher
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 758, in pkcs7unpad
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 98, in _assert
    Exception: Incorrect padding – Wrong key
    Traceback (most recent call last):
    File “calibre_plugins.dedrm.kfxdedrm”, line 83, in decrypt_voucher
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 879, in decryptvoucher
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 758, in pkcs7unpad
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 98, in _assert
    Exception: Incorrect padding – Wrong key
    Traceback (most recent call last):
    File “calibre_plugins.dedrm.kfxdedrm”, line 83, in decrypt_voucher
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 879, in decryptvoucher
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 759, in pkcs7unpad
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\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.1 seconds
    searching for kinfoFiles in C:\Users\patty\AppData\Local
    Found K4PC 1.25+ kinf2018 file: C:\Users\patty\AppData\Local\Amazon\Kindle\storage.kinf2018
    [41.48] splash screen hidden
    [41.48] Started up in 41.48 seconds with 6205 books
    stdout+stderr from file dialog helper: [b”, b”]
    piped data from file dialog helper: [b’\xe9\x929\x80\x9a\xb4\xf62q\x1c5\xca\xcb\xbd\x01\xc8\xd2\x19\xe9\x0c\x9a\x0e\xd5\n\xaa\x103I\xb7\xe5′, b’H:\Documents\My Kindle Content\B00G6SK3EI_EBOK\B00G6SK3EI_EBOK.azw’]
    Decrypted key file using IDString ‘4271640437’ and UserName ‘patty’
    DeDRM v7.2.1: Found 1 new key
    Decrypting KFX-ZIP ebook: 0qdhyn22
    Got DSN key from database default_key_1
    Found 1 keys to try after 2.6 seconds
    Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.c0520fbb-3a92-44fc-a08b-cf2be8ac0a8e.voucher
    Traceback (most recent call last):
    File “calibre_plugins.dedrm.init“, line 540, in KindleMobiDecrypt
    File “calibre_plugins.dedrm.k4mobidedrm”, line 238, in GetDecryptedBook
    File “calibre_plugins.dedrm.kfxdedrm”, line 45, in processBook
    File “calibre_plugins.dedrm.kfxdedrm”, line 89, 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.kfxdedrm”, line 83, in decrypt_voucher
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 879, in decryptvoucher
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 758, in pkcs7unpad
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\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
    File “calibre_plugins.dedrm.k4mobidedrm”, line 238, in GetDecryptedBook
    File “calibre_plugins.dedrm.kfxdedrm”, line 45, in processBook
    File “calibre_plugins.dedrm.kfxdedrm”, line 89, 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.kfxdedrm”, line 83, in decrypt_voucher
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 879, in decryptvoucher
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 758, in pkcs7unpad
    File “C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 98, in _assert
    Exception: Incorrect padding – Wrong key
    DeDRM v7.2.1: Ultimately failed to decrypt after 2.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.43.0: Packaging C:\Users\patty\AppData\Local\Temp\calibre_qrf708kw\0qdhyn22.kfx-zip
    Processing container: B00G6SK3EI_EBOK.azw
    KFX metadata reader (from KFX Input) activated for C:\Users\patty\AppData\Local\Temp\calibre_qrf708kw\sqf8pfx__add_books\0\B00G6SK3EI_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
    File “calibre_plugins.dedrm.k4mobidedrm”, line 238, in GetDecryptedBook
    File “calibre_plugins.dedrm.kfxdedrm”, line 45, in processBook
    File “calibre_plugins.dedrm.kfxdedrm”, line 89, 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 176, in _run_filetype_plugins
    File “calibre_plugins.dedrm.init“, line 633, in run
    File “calibre_plugins.dedrm.init“, line 583, in KindleMobiDecrypt
    calibre_plugins.dedrm.DeDRMError: DeDRM v7.2.1: Ultimately failed to decrypt after 2.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 176, 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 84, in convert_to_single_kfx
    File “calibre_plugins.kfx_input.kfxlib.yj_book”, line 211, in decode_book
    File “calibre_plugins.kfx_input.kfxlib.yj_book”, line 318, in get_container
    calibre_plugins.kfx_input.kfxlib.utilities.KFXDRMError: Book container B00G6SK3EI_EBOK.azw has DRM and cannot be converted
    Added Holy Poison – The Judas Pledge to db in: 0.2
    Added 1 books in 3.2 seconds
    Worker Launch took: 0.05 seconds
    Job: 0 Convert book 1 of 1 (Holy Poison – The Judas Pledge) finished
    Convert book 1 of 1 (Holy Poison – The Judas Pledge)

    DeDRM v7.2.1: Trying to decrypt bfgtj7ta.kfx-zip
    Using Library AlfCrypto DLL/DYLIB/SO
    Using Library AlfCrypto DLL/DYLIB/SO
    Decrypting KFX-ZIP ebook: bfgtj7ta
    Got DSN key from database default_key
    Got DSN key from database default_key_2
    Got DSN key from database default_key_3
    Found 5 keys to try after 0.1 seconds
    Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.c0520fbb-3a92-44fc-a08b-cf2be8ac0a8e.voucher
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 879, in decryptvoucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 758, in pkcs7unpad
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 98, in _assert
    Exception: Incorrect padding - Wrong key
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 879, in decryptvoucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 758, in pkcs7unpad
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 98, in _assert
    Exception: Incorrect padding - Wrong key
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 879, in decryptvoucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 758, in pkcs7unpad
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 98, in _assert
    Exception: Incorrect padding - Wrong key
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 879, in decryptvoucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 758, in pkcs7unpad
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 98, in _assert
    Exception: Incorrect padding - Wrong key
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 879, in decryptvoucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 759, in pkcs7unpad
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 98, in _assert
    Exception: Incorrect padding - Wrong key
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 884, in decryptvoucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 98, in _assert
    Exception: Expected KeySet, got 
    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
    searching for kinfoFiles in C:\Users\patty\AppData\Local
    Found K4PC 1.25+ kinf2018 file: C:\Users\patty\AppData\Local\Amazon\Kindle\storage\.kinf2018
    Decrypted key file using IDString '4271640437' and UserName 'patty'
    DeDRM v7.2.1: Found 1 new key
    Decrypting KFX-ZIP ebook: bfgtj7ta
    Got DSN key from database default_key_1
    Found 1 keys to try after 2.9 seconds
    Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.c0520fbb-3a92-44fc-a08b-cf2be8ac0a8e.voucher
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.__init__", line 540, in KindleMobiDecrypt
      File "calibre_plugins.dedrm.k4mobidedrm", line 238, in GetDecryptedBook
      File "calibre_plugins.dedrm.kfxdedrm", line 45, in processBook
      File "calibre_plugins.dedrm.kfxdedrm", line 89, 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.kfxdedrm", line 83, in decrypt_voucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 879, in decryptvoucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 758, in pkcs7unpad
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\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
      File "calibre_plugins.dedrm.k4mobidedrm", line 238, in GetDecryptedBook
      File "calibre_plugins.dedrm.kfxdedrm", line 45, in processBook
      File "calibre_plugins.dedrm.kfxdedrm", line 89, 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.kfxdedrm", line 83, in decrypt_voucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 879, in decryptvoucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 758, in pkcs7unpad
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 98, in _assert
    Exception: Incorrect padding - Wrong key
    DeDRM v7.2.1: Ultimately failed to decrypt after 2.9 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
    Conversion options changed from defaults:
    
      verbose: 2
    
      read_metadata_from_opf: 'C:\\Users\\patty\\AppData\\Local\\Temp\\calibre_qrf708kw\\lj2d3h1z.opf'
    
      output_profile: 'kindle_pw3'
    
      cover: 'C:\\Users\\patty\\AppData\\Local\\Temp\\calibre_qrf708kw\\uilawtgf.jpeg'
    
    Resolved conversion options
    
    calibre version: 5.26.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': 'C:\\Users\\patty\\AppData\\Local\\Temp\\calibre_qrf708kw\\uilawtgf.jpeg',
    
     'debug_pipeline': None,
    
     'dehyphenate': True,
    
     'delete_blank_paragraphs': True,
    
     'disable_font_rescaling': False,
    
     'dont_compress': False,
    
     'duplicate_links_in_toc': False,
    
     'embed_all_fonts': False,
    
     'embed_font_family': None,
    
     'enable_heuristics': False,
    
     'expand_css': False,
    
     'extra_css': None,
    
     'extract_to': None,
    
     'filter_css': '',
    
     'fix_indents': True,
    
     'font_size_mapping': None,
    
     'format_scene_breaks': True,
    
     'html_unwrap_factor': 0.4,
    
     'input_encoding': None,
    
     'input_profile': <calibre.customize.profiles.InputProfile object at 0x07823A90>,
    
     '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,
    
     'mobi_file_type': 'old',
    
     'mobi_ignore_margins': False,
    
     'mobi_keep_original_images': False,
    
     'mobi_toc_at_start': False,
    
     'no_chapters_in_toc': False,
    
     'no_inline_navbars': True,
    
     'no_inline_toc': False,
    
     'output_profile': <calibre.customize.profiles.KindlePaperWhite3Output object at 0x07823D90>,
    
     'page_breaks_before': '/',
    
     'personal_doc': '[PDOC]',
    
     'prefer_author_sort': False,
    
     'prefer_metadata_cover': False,
    
     'pretty_print': False,
    
     'pubdate': None,
    
     'publisher': None,
    
     'rating': None,
    
     'read_metadata_from_opf': 'C:\\Users\\patty\\AppData\\Local\\Temp\\calibre_qrf708kw\\lj2d3h1z.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,
    
     'share_not_sync': False,
    
     '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
    
      File "calibre_plugins.dedrm.k4mobidedrm", line 238, in GetDecryptedBook
    
      File "calibre_plugins.dedrm.kfxdedrm", line 45, in processBook
    
      File "calibre_plugins.dedrm.kfxdedrm", line 89, 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 176, in _run_filetype_plugins
    
      File "calibre_plugins.dedrm.__init__", line 633, in run
    
      File "calibre_plugins.dedrm.__init__", line 583, in KindleMobiDecrypt
    
    calibre_plugins.dedrm.DeDRMError: DeDRM v7.2.1: Ultimately failed to decrypt after 2.9 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 bfgtj7ta.kfx-zip
    Decrypting KFX-ZIP ebook: bfgtj7ta
    Got DSN key from database default_key
    Got DSN key from database default_key_2
    Got DSN key from database default_key_3
    Found 5 keys to try after 0.0 seconds
    Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.c0520fbb-3a92-44fc-a08b-cf2be8ac0a8e.voucher
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 879, in decryptvoucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 758, in pkcs7unpad
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 98, in _assert
    Exception: Incorrect padding - Wrong key
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 879, in decryptvoucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 758, in pkcs7unpad
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 98, in _assert
    Exception: Incorrect padding - Wrong key
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 879, in decryptvoucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 758, in pkcs7unpad
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 98, in _assert
    Exception: Incorrect padding - Wrong key
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 879, in decryptvoucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 758, in pkcs7unpad
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 98, in _assert
    Exception: Incorrect padding - Wrong key
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 879, in decryptvoucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 759, in pkcs7unpad
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 98, in _assert
    Exception: Incorrect padding - Wrong key
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.kfxdedrm", line 83, in decrypt_voucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 884, in decryptvoucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 98, in _assert
    Exception: Expected KeySet, got 
    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
    searching for kinfoFiles in C:\Users\patty\AppData\Local
    Found K4PC 1.25+ kinf2018 file: C:\Users\patty\AppData\Local\Amazon\Kindle\storage\.kinf2018
    Decrypted key file using IDString '4271640437' and UserName 'patty'
    DeDRM v7.2.1: Found 1 new key
    Decrypting KFX-ZIP ebook: bfgtj7ta
    Got DSN key from database default_key_1
    Found 1 keys to try after 2.8 seconds
    Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.c0520fbb-3a92-44fc-a08b-cf2be8ac0a8e.voucher
    Traceback (most recent call last):
      File "calibre_plugins.dedrm.__init__", line 540, in KindleMobiDecrypt
      File "calibre_plugins.dedrm.k4mobidedrm", line 238, in GetDecryptedBook
      File "calibre_plugins.dedrm.kfxdedrm", line 45, in processBook
      File "calibre_plugins.dedrm.kfxdedrm", line 89, 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.kfxdedrm", line 83, in decrypt_voucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 879, in decryptvoucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 758, in pkcs7unpad
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\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
      File "calibre_plugins.dedrm.k4mobidedrm", line 238, in GetDecryptedBook
      File "calibre_plugins.dedrm.kfxdedrm", line 45, in processBook
      File "calibre_plugins.dedrm.kfxdedrm", line 89, 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.kfxdedrm", line 83, in decrypt_voucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 879, in decryptvoucher
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 758, in pkcs7unpad
      File "C:\Users\patty\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py", line 98, in _assert
    Exception: Incorrect padding - Wrong key
    DeDRM v7.2.1: Ultimately failed to decrypt after 2.8 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
    
      File "calibre_plugins.dedrm.k4mobidedrm", line 238, in GetDecryptedBook
    
      File "calibre_plugins.dedrm.kfxdedrm", line 45, in processBook
    
      File "calibre_plugins.dedrm.kfxdedrm", line 89, 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 176, in _run_filetype_plugins
    
      File "calibre_plugins.dedrm.__init__", line 633, in run
    
      File "calibre_plugins.dedrm.__init__", line 583, in KindleMobiDecrypt
    
    calibre_plugins.dedrm.DeDRMError: DeDRM v7.2.1: Ultimately failed to decrypt after 2.8 seconds. Read the FAQs at Harper's repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
    
    InputFormatPlugin: KFX Input running
    
    on C:\Users\patty\AppData\Local\Temp\calibre_qrf708kw\bfgtj7ta.kfx-zip
    
    Software versions: KFX Input 1.43.0, calibre 5.26, Windows-10-10.0.19041
    
    KFX Input plugin help is available at https://www.mobileread.com/forums/showthread.php?t=291290
    
    Converting C:\Users\patty\AppData\Local\Temp\calibre_qrf708kw\bfgtj7ta.kfx-zip
    
    Processing container: B00G6SK3EI_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 211, in decode_book
    
      File "calibre_plugins.kfx_input.kfxlib.yj_book", line 318, in get_container
    
    calibre_plugins.kfx_input.kfxlib.utilities.KFXDRMError: Book container B00G6SK3EI_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 82, in <module>
    
      File "site.py", line 77, in main
    
      File "site.py", line 49, in run_entry_point
    
      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_in
    

    t.init“, line 125, in convert

    calibre.ebooks.DRMError: This book has DRM!
    
  3. Hello,
    I am trying to convert a dictionary I bought on Amazon.
    I use Windows 7 and Calibre 2.85.1. I tried updating to Calibre 5.0, but it refused due to my outdated OS.
    For this reason, I installed DeDRM_tools_6.8.1 in Calibre.
    I was not able to make Kindle 1.17 or 1.24 work for me (I couldn’t register them).
    I downloaded the book with Kindle 1.33.62002 for PC.
    I do not have a physical Kindle.
    Initially, when trying to convert the book in Calibre, I was getting this error message: “KFXError: This is an Amazon KFX book. It cannot be processed.”
    I followed the method “2 b)” listed on https://www.mobileread.com/forums/showthread.php?t=283371: “Method 2 – Disable KFX support in Kindle for PC/Mac – It is possible to prevent some versions of Kindle for PC/Mac from making use of KFX format. (…) For an alternate method that works with more recent versions of Kindle for PC see this post and this post (…) a batch file that edits registry keys”.
    Now, the conversion still fails, but I’m getting a different message: “Conversion impossible – this book is locked by DRMs.”
    The kind people at MobileRead advised me to ask for further help here.
    Is there anything I can do now?
    Thank you.

      • Thank you. Here’s the log:

        calibre Journal de débogage
        calibre 2.85.1 embedded-python: True is64bit: False
        Windows-7-6.1.7601-SP1 Windows (’32bit’, ‘WindowsPE’)
        32bit process running on 64bit windows
        (‘Windows’, ‘7’, ‘6.1.7601’)
        Python 2.7.9
        Windows: (‘7’, ‘6.1.7601’, ‘SP1’, ‘Multiprocessor Free’)
        Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 43, 0) && DeDRM (6, 8, 0) && Package KFX (from KFX Input) (1, 43, 0) && KFX metadata reader (from KFX Input) (1, 43, 0) && KFX Input (1, 43, 0)
        devicePixelRatio: 1.0
        logicalDpi: 96.0 x 96.0
        physicalDpi: 71.9842323651 x 71.9822878229
        Starting up…
        Started up in 29.02 seconds with 31 books
        stdout+stderr from file dialog helper: [”, ”]
        piped data from file dialog helper: [‘\xce\x809\x07\x96\x1c\xd6\x99\xd6\x9c\xc0\x84\x10\xaa\x02n\xa1/\x90\x8b\n\xd4\x05V\x0c\x90s-\xbcx{;’, ‘D:\ConvertKindleBooks\B0714PQMCL_EBOK_ApresBatch\B0714PQMCL_EBOK.azw’]
        Gather KFX-ZIP (from KFX Input) 1.43.0: Importing D:\ConvertKindleBooks\B0714PQMCL_EBOK_ApresBatch\B0714PQMCL_EBOK.azw
        Gather KFX-ZIP (from KFX Input): Cannot locate some files needed for the book. KFX files must remain in their original folder structure for successful import.
        Gather KFX-ZIP (from KFX Input): Gathered 1 file(s) as C:\Users\Vi\AppData\Local\Temp\calibre_dtlixj\ofqvdf.kfx-zip
        DeDRM v6.8.0: Trying to decrypt ofqvdf.kfx-zip
        Using Library AlfCrypto DLL/DYLIB/SO
        Decrypting KFX-ZIP ebook: ofqvdf
        Found 0 keys to try after 0.4 seconds
        DeDRM v6.8.0: Failed to decrypt with error: The .kfx-zip archive contains an encrypted DRMION file without a DRM voucher
        DeDRM v6.8.0: Looking for new default Kindle Key after 0.4 seconds
        searching for kinfoFiles in C:\Users\Vi\AppData\Local
        Found K4PC 1.25+ kinf2018 file: C:\Users\Vi\AppData\Local\Amazon\Kindle\storage.kinf2018
        Found K4PC 1.9+ kinf2011 file: C:\Users\Vi\AppData\Local\Amazon\Kindle\storage.kinf2011
        Decrypted key file using IDString ‘3707549200’ and UserName ‘5669’
        Decrypted key file using IDString ‘3707549200’ and UserName ‘5669’
        DeDRM v6.8.0: Found 2 new keys
        Decrypting KFX-ZIP ebook: ofqvdf
        Got DSN key from database default_key_2
        Got DSN key from database default_key_1
        Found 2 keys to try after 29.6 seconds
        DeDRM v6.8.0: Ultimately failed to decrypt after 29.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 170, 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 29.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.43.0: Packaging C:\Users\Vi\AppData\Local\Temp\calibre_dtlixj\ofqvdf.kfx-zip
        Processing container: B0714PQMCL_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 170, 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 84, in convert_to_single_kfx
        File “calibre_plugins.kfx_input.kfxlib.yj_book”, line 211, in decode_book
        File “calibre_plugins.kfx_input.kfxlib.yj_book”, line 318, in get_container
        KFXDRMError: Book container B0714PQMCL_EBOK.azw has DRM and cannot be converted
        KFX metadata reader (from KFX Input) activated for C:\Users\Vi\AppData\Local\Temp\calibre_dtlixj\vj7lsi_add_books\0\B0714PQMCL_EBOK.kfx-zip
        Traceback (most recent call last):
        File “site-packages\calibre\customize\ui.py”, line 416, in get_file_type_metadata
        File “calibre_plugins.kfx_input.metadata_reader”, line 28, in get_metadata
        File “calibre_plugins.kfx_input.kfxlib.yj_book”, line 149, in get_metadata
        Exception: Failed to locate a KFX container with metadata
        Added B0714PQMCL EBOK to db in: 0.2
        Added 1 books in 32.4 seconds

        • I just realized adding the book from a different folder might cause problems, and tried again from the normal folder:

          calibre Journal de débogage
          calibre 2.85.1 embedded-python: True is64bit: False
          Windows-7-6.1.7601-SP1 Windows (’32bit’, ‘WindowsPE’)
          32bit process running on 64bit windows
          (‘Windows’, ‘7’, ‘6.1.7601’)
          Python 2.7.9
          Windows: (‘7’, ‘6.1.7601’, ‘SP1’, ‘Multiprocessor Free’)
          Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 43, 0) && DeDRM (6, 8, 0) && Package KFX (from KFX Input) (1, 43, 0) && KFX metadata reader (from KFX Input) (1, 43, 0) && KFX Input (1, 43, 0)
          devicePixelRatio: 1.0
          logicalDpi: 96.0 x 96.0
          physicalDpi: 71.9842323651 x 71.9822878229
          Starting up…
          Started up in 7.32 seconds with 31 books
          stdout+stderr from file dialog helper: [”, ”]
          piped data from file dialog helper: [‘\xc9U\xb7\xd8\xc2\x03\x82#e2!\xef\xc8\xc0\xedA\xfe\xc73J\xd9\xd8\x8a\x1av\xbf\xf9\xf3.\x81\xf0\xf1’, ‘C:\Users\Vi\Documents\My Kindle Content\B0714PQMCL_EBOK\B0714PQMCL_EBOK.azw’]
          Gather KFX-ZIP (from KFX Input) 1.43.0: Importing C:\Users\Vi\Documents\My Kindle Content\B0714PQMCL_EBOK\B0714PQMCL_EBOK.azw
          Gather KFX-ZIP (from KFX Input): Gathered 3 file(s) as C:\Users\Vi\AppData\Local\Temp\calibre_z2j_c8\nfjdlf.kfx-zip
          DeDRM v6.8.0: Trying to decrypt nfjdlf.kfx-zip
          Using Library AlfCrypto DLL/DYLIB/SO
          Decrypting KFX-ZIP ebook: nfjdlf
          Found 0 keys to try after 0.2 seconds
          Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.21eeaceb-04ed-48a3-bbfd-522c21102885.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.2 seconds
          searching for kinfoFiles in C:\Users\Vi\AppData\Local
          Found K4PC 1.25+ kinf2018 file: C:\Users\Vi\AppData\Local\Amazon\Kindle\storage.kinf2018
          Found K4PC 1.9+ kinf2011 file: C:\Users\Vi\AppData\Local\Amazon\Kindle\storage.kinf2011
          Decrypted key file using IDString ‘3707549200’ and UserName ‘5669’
          Decrypted key file using IDString ‘3707549200’ and UserName ‘5669’
          DeDRM v6.8.0: Found 2 new keys
          Decrypting KFX-ZIP ebook: nfjdlf
          Got DSN key from database default_key_1
          Got DSN key from database default_key_2
          Found 2 keys to try after 30.8 seconds
          Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.21eeaceb-04ed-48a3-bbfd-522c21102885.voucher
          DeDRM v6.8.0: Ultimately failed to decrypt after 30.8 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 170, 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 30.8 seconds. Read the FAQs at Harper’s repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
          Package KFX (from KFX Input) 1.43.0: Packaging C:\Users\Vi\AppData\Local\Temp\calibre_z2j_c8\nfjdlf.kfx-zip
          Processing container: B0714PQMCL_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 170, 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 84, in convert_to_single_kfx
          File “calibre_plugins.kfx_input.kfxlib.yj_book”, line 211, in decode_book
          File “calibre_plugins.kfx_input.kfxlib.yj_book”, line 318, in get_container
          KFXDRMError: Book container B0714PQMCL_EBOK.azw has DRM and cannot be converted
          KFX metadata reader (from KFX Input) activated for C:\Users\Vi\AppData\Local\Temp\calibre_z2j_c8\umdc06_add_books\0\B0714PQMCL_EBOK.kfx-zip
          C:\Program Files (x86)\Calibre2\pylib.zip\dateutil\parser.py:339: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode – interpreting them as being unequal
          Added Guide anglais-français de la traduction (French Edition) to db in: 0.7
          Added 1 books in 34.2 seconds
          Worker Launch took: 0.998000144958
          Job: 1 Conversion du livre 1 sur 1 (Guide anglais-français de la traduction (French Edition)) finished
          Conversion du livre 1 sur 1 (Guide anglais-français de la traduction (French Edition))
          C:\Program Files (x86)\Calibre2\pylib.zip\dateutil\parser.py:339: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode – interpreting them as being unequal
          Conversion options changed from defaults:
          cover: u’C:\Users\Vi\AppData\Local\Temp\calibre_z2j_c8\4r7q98.jpeg’
          allow_conversion_with_errors: True
          verbose: 2
          change_justification: u’left’
          read_metadata_from_opf: u’C:\Users\Vi\AppData\Local\Temp\calibre_z2j_c8\qzrwes.opf’
          output_profile: ‘generic_eink’
          Resolved conversion options
          calibre version: 2.85.1
          {‘allow_conversion_with_errors’: True,
          ‘asciiize’: False,
          ‘author_sort’: None,
          ‘authors’: None,
          ‘base_font_size’: 0.0,
          ‘book_producer’: None,
          ‘change_justification’: u’left’,
          ‘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’C:\Users\Vi\AppData\Local\Temp\calibre_z2j_c8\4r7q98.jpeg’,
          ‘debug_pipeline’: None,
          ‘dehyphenate’: True,
          ‘delete_blank_paragraphs’: True,
          ‘disable_font_rescaling’: False,
          ‘duplicate_links_in_toc’: False,
          ’embed_all_fonts’: False,
          ’embed_font_family’: None,
          ‘enable_heuristics’: False,
          ‘expand_css’: False,
          ‘extra_css’: None,
          ‘filter_css’: u”,
          ‘fix_indents’: True,
          ‘font_size_mapping’: None,
          ‘force_max_line_length’: False,
          ‘format_scene_breaks’: True,
          ‘html_unwrap_factor’: 0.4,
          ‘inline_toc’: False,
          ‘input_encoding’: None,
          ‘input_profile’: <calibre.customize.profiles.InputProfile object at 0x0576D830>,
          ‘insert_blank_line’: False,
          ‘insert_blank_line_size’: 0.5,
          ‘insert_metadata’: False,
          ‘isbn’: None,
          ‘italicize_common_cases’: True,
          ‘keep_color’: False,
          ‘keep_image_references’: False,
          ‘keep_ligatures’: False,
          ‘keep_links’: 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_line_length’: 0,
          ‘max_toc_links’: 50,
          ‘minimum_line_height’: 120.0,
          ‘newline’: u’system’,
          ‘no_chapters_in_toc’: False,
          ‘no_inline_navbars’: False,
          ‘output_profile’: <calibre.customize.profiles.GenericEink object at 0x0576DA30>,
          ‘page_breaks_before’: u’/’,
          ‘prefer_metadata_cover’: False,
          ‘pretty_print’: False,
          ‘pubdate’: None,
          ‘publisher’: None,
          ‘rating’: None,
          ‘read_metadata_from_opf’: u’C:\Users\Vi\AppData\Local\Temp\calibre_z2j_c8\qzrwes.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,
          ‘transform_css_rules’: ‘[]’,
          ‘txt_output_encoding’: u’utf-8′,
          ‘txt_output_formatting’: u’plain’,
          ‘unsmarten_punctuation’: False,
          ‘unwrap_lines’: True,
          ‘use_auto_toc’: False,
          ‘verbose’: 2}
          InputFormatPlugin: KFX Input running
          on C:\Users\Vi\AppData\Local\Temp\calibre_z2j_c8\3vqtdl.kfx-zip
          Software versions: KFX Input 1.43.0, calibre 2.85.1, Windows-7-6.1.7601-SP1
          KFX Input plugin help is available at https://www.mobileread.com/forums/showthread.php?t=291290
          Converting C:\Users\Vi\AppData\Local\Temp\calibre_z2j_c8\3vqtdl.kfx-zip
          Processing container: B0714PQMCL_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 211, in decode_book
          File “calibre_plugins.kfx_input.kfxlib.yj_book”, line 318, in get_container
          KFXDRMError: Book container B0714PQMCL_EBOK.azw has DRM and cannot be converted
          Python function terminated unexpectedly
          This book has DRM! (Error Code: 1)
          Traceback (most recent call last):
          File “site.py”, line 132, in main
          File “site.py”, line 109, in run_entry_point
          File “site-packages\calibre\utils\ipc\worker.py”, line 195, in main
          File “site-packages\calibre\gui2\convert\gui_conversion.py”, line 33, in gui_convert_override
          File “site-packages\calibre\gui2\convert\gui_conversion.py”, line 26, in gui_convert
          File “site-packages\calibre\ebooks\conversion\plumber.py”, line 1088, in run
          File “site-packages\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!

        • You’re still getting KFX format which cannot be decrypted from the latest version of the Kindle app. Delete the book from calibre and your Kindle content folder. Start Kindle for PC with the batch file and redownload the book. Make sure there’s no md or voucher files in the folder with the azw (that would mean it’s kfx). Add that to calibre and hopefully that will work.

    • Is this a Dictionary for installing on the Kindle?
      My experience was (that maybe wrong or have changed), that these Dictionaries have different DRM that DeDRM cannot remove.
      It may be possible to buy the Dictionary in a different format – the ones I checked where also available for EPUB-readers. This may or may not solve your problem, but I can understand if you are not willing to buy that Dictionary again – although with Amazon you could give it back, if you bought it a few days ago, the timeframe is 14 days imho.

        • It is a dictionary, but it has nothing to do with the Kindle. Think a regular bilingual dictionary. It’s just a Kindle version of an existing paper dictionary, which I will later want to convert further so I can interrogate it through a dictionary app.
          Anyway, I’ll try what Laura says in the comment above. Stay tuned ^^

  4. I don’t know what’s happened. I didn’t change anything from my end, and then things just “broke”.
    Let me explain.
    I use Linux Mint. I have Adobe Digital Editions (Version 2.0.1 78765). I installed that through Lutris. For a long time, I could just drag and drop the ACSM file into ADE, and ADE would download the book (I then proceed with the next steps of adding that book into Calibre, which has Apprentice Alf files). But since about a week ago, when I drag and drop the ACSM file into ADE, I get this error message:

    Connection Error Detected

    Digital Editions could not connect to the fulfillment server. Please make sure you are connected to the Internet.

    But I am connected to the internet. I’m typing this message on the same laptop that has ADE.

    I’ve tried uninstalling ADE and then reinstalling but I still get the same error message.

    I’m authorizing with an AdobeID. (Someone reading may say there’s a problem with AdobeID authorization or there’s a probem with your AdobeID. My response is, when I use the same AdobeID on ADE on my Android phone, I can download the ebook just fine).

  5. Hi Alf,
    Thanks for all your information and the plugins. I’m not super tech savy so it’s super helpful to have all this information.

    I am trying to remove the DRM from an amazon kindle book I purchased but I can’t seem to even with the plugins installed and I’ve read all your FAQs and tried the troubleshooting instructions? Please help! Thanks!

    Here is the log
    libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
    2021-09-30 22:49:08.647 Calibre[2447:65697] deliverNotificationWithTitle()
    * Notification delivered.
    calibre Debug log
    calibre 2.3 isfrozen: True is64bit: True
    Darwin-16.7.0-x86_64-i386-64bit Darwin (’64bit’, ”)
    (‘Darwin’, ‘16.7.0’, ‘Darwin Kernel Version 16.7.0: Sun Jun 2 20:26:31 PDT 2019; root:xnu-3789.73.50~1/RELEASE_X86_64’)
    Python 2.7.8
    OSX: (‘10.12.6’, (”, ”, ”), ‘x86_64’)
    Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) && DeDRM && Package KFX (from KFX Input) && KFX metadata reader (from KFX Input) && KFX Input && Obok DeDRM
    Starting up…
    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
    Started up in 10.53 seconds with 3 books
    Worker Launch took: 0.133413076401
    Job: 1 Read metadata (0 of 1) finished
    Read metadata (0 of 1)
    DeDRM v6.8.0: Trying to decrypt Alpha Night (Psy-Changeling Trinity).azw3
    Using Library AlfCrypto DLL/DYLIB/SO
    MobiDeDrm v0.42.
    Copyright © 2008-2017 The Dark Reverser, Apprentice Harper et al.
    Decrypting Kindle Format 8 ebook: Alpha Night (Psy-Changeling Trinity)
    Found 0 keys to try after 0.1 seconds
    Crypto Type is: 2
    DeDRM v6.8.0: Failed to decrypt with error: No key found in 0 keys tried.
    DeDRM v6.8.0: Looking for new default Kindle Key after 0.1 seconds
    No k4Mac kindle-info/rainier/kinf2011 files have been found.
    DeDRM v6.8.0: Ultimately failed to decrypt after 0.1 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 154, 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.1 seconds. Read the FAQs at Harper’s repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md

    Added Alpha Night (Psy-Changeling Trinity) to db in: 0.323155879974 seconds
    Worker Launch took: 0.2537150383
    Job: 2 Convert book 1 of 1 (Alpha Night (Psy-Changeling Trinity)) finished
    Convert book 1 of 1 (Alpha Night (Psy-Changeling Trinity))
    Resolved conversion options
    calibre version: 2.3.0
    {‘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/4q/yvh7fc39769c8fjcw5b04xd80000gp/T/calibre_2.3.0_tmp_RepVrs/Cq0AGG.jpeg’,
    ‘debug_pipeline’: None,
    ‘dehyphenate’: True,
    ‘delete_blank_paragraphs’: True,
    ‘disable_font_rescaling’: False,
    ‘dont_compress’: False,
    ‘duplicate_links_in_toc’: False,
    ’embed_all_fonts’: False,
    ’embed_font_family’: None,
    ‘enable_heuristics’: False,
    ‘expand_css’: False,
    ‘extra_css’: None,
    ‘extract_to’: None,
    ‘filter_css’: u”,
    ‘fix_indents’: True,
    ‘font_size_mapping’: None,
    ‘format_scene_breaks’: True,
    ‘html_unwrap_factor’: 0.4,
    ‘input_encoding’: None,
    ‘input_profile’: <calibre.customize.profiles.InputProfile object at 0x10dc5bd90>,
    ‘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,
    ‘mobi_file_type’: u’old’,
    ‘mobi_ignore_margins’: False,
    ‘mobi_keep_original_images’: False,
    ‘mobi_toc_at_start’: False,
    ‘no_chapters_in_toc’: False,
    ‘no_inline_navbars’: False,
    ‘no_inline_toc’: False,
    ‘outp

    • Looks like you need to enter your Kindle’s serial number into DeDRM’s customization. This will work for an E-ink Kindle (not a Fire). Incidentally you could update calibre. Version 3.48 should work with Sierra.

      • Thanks Laura for replying!

        Question though, how do I enter my e-ink kindle’s serial number into de-drm customization ? Which buttons do I press in calibre to do this ? I’m not super tech savvy… I found my kindle’s serial number though so yay for that at least 😉 Please let me know! Thanks !

        -Andrea

        • Open calibre and click on the Preferences icon. If you don’t see it, hit control-P. Click on the Plugins icon in the bottom row. Type dedrm in the search box and hit enter. The DeDRM (7.2.1) item should now be highlighted. Click on the Customize plugin button. Click on the eInk Kindle ebooks button. Enter your serial number there. I would recommend getting the serial number from the Amazon Manage Your Content & Devices page to save the possibility of mistyping it. You should now be able use Download & transfer via USB to download the ebook.

  6. Any chance anyone has had any success with Nook ebooks? Had to purchase one from them as they were only source and would like to convert to dox so I can incorporate into my Logos app.

  7. calibre, version 5.29.0 (win32, embedded-python: True)
    Conversion error: Failed: Convert book 1 of 1 (Auschwitz ultima statie)

    Convert book 1 of 1 (Auschwitz ultima statie)
    DeDRM v7.2.1: Trying to decrypt 2tqq_1s_.pdf
    DeDRM v7.2.1: 2tqq_1s_.pdf is a PDF ebook
    DeDRM v7.2.1: Looking for new default Adobe Digital Editions Keys after 0.0 seconds
    Found 1 keys
    DeDRM v7.2.1: Trying a new default key
    error writing pdf: max() arg is an empty sequence
    DeDRM v7.2.1: Failed to decrypt with new default key after 0.1 seconds
    DeDRM v7.2.1: Ultimately failed to decrypt after 0.1 seconds. Read the FAQs at Harper’s repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
    Conversion options changed from defaults:
    read_metadata_from_opf: ‘C:\Users\andre\AppData\Local\Temp\calibre_lotoniiz\cnfsyqsd.opf’
    output_profile: ‘kindle_pw3’
    pdf_serif_family: ‘MS Shell Dlg 2’
    pdf_sans_family: ‘MS Shell Dlg 2’
    verbose: 2
    Resolved conversion options
    calibre version: 5.29.0
    {‘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’: None,
    ‘custom_size’: None,
    ‘debug_pipeline’: None,
    ‘dehyphenate’: True,
    ‘delete_blank_paragraphs’: True,
    ‘disable_font_rescaling’: False,
    ‘duplicate_links_in_toc’: False,
    ’embed_all_fonts’: False,
    ’embed_font_family’: None,
    ‘enable_heuristics’: False,
    ‘expand_css’: False,
    ‘extra_css’: None,
    ‘filter_css’: ”,
    ‘fix_indents’: True,
    ‘font_size_mapping’: None,
    ‘format_scene_breaks’: True,
    ‘html_unwrap_factor’: 0.4,
    ‘input_encoding’: None,
    ‘input_profile’: <calibre.customize.profiles.InputProfile object at 0x07BD6AF0>,
    ‘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,
    ‘new_pdf_engine’: False,
    ‘no_chapters_in_toc’: False,
    ‘no_images’: False,
    ‘no_inline_navbars’: False,
    ‘output_profile’: <calibre.customize.profiles.KindlePaperWhite3Output object at 0x07BD6DF0>,
    ‘page_breaks_before’: “//*[name()=’h1′ or name()=’h2′]”,
    ‘paper_size’: ‘letter’,
    ‘pdf_add_toc’: False,
    ‘pdf_default_font_size’: 20,
    ‘pdf_footer_template’: None,
    ‘pdf_header_template’: None,
    ‘pdf_hyphenate’: False,
    ‘pdf_mark_links’: False,
    ‘pdf_mono_family’: ‘Courier’,
    ‘pdf_mono_font_size’: 16,
    ‘pdf_odd_even_offset’: 0.0,
    ‘pdf_page_margin_bottom’: 72.0,
    ‘pdf_page_margin_left’: 72.0,
    ‘pdf_page_margin_right’: 72.0,
    ‘pdf_page_margin_top’: 72.0,
    ‘pdf_page_number_map’: None,
    ‘pdf_page_numbers’: False,
    ‘pdf_sans_family’: ‘MS Shell Dlg 2’,
    ‘pdf_serif_family’: ‘MS Shell Dlg 2’,
    ‘pdf_standard_font’: ‘serif’,
    ‘pdf_use_document_margins’: False,
    ‘prefer_metadata_cover’: False,
    ‘preserve_cover_aspect_ratio’: False,
    ‘pretty_print’: False,
    ‘pubdate’: None,
    ‘publisher’: None,
    ‘rating’: None,
    ‘read_metadata_from_opf’: ‘C:\Users\andre\AppData\Local\Temp\calibre_lotoniiz\cnfsyqsd.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’: ‘[]’,
    ‘uncompressed_pdf’: False,
    ‘unit’: ‘inch’,
    ‘unsmarten_punctuation’: False,
    ‘unwrap_factor’: 0.45,
    ‘unwrap_lines’: True,
    ‘use_auto_toc’: False,
    ‘use_profile_size’: False,
    ‘verbose’: 2}
    Running file type plugin DeDRM failed with traceback:
    Traceback (most recent call last):
    File “calibre\customize\ui.py”, line 176, in _run_filetype_plugins
    File “calibre_plugins.dedrm.init“, line 640, in run
    File “calibre_plugins.dedrm.init“, line 515, in PDFDecrypt
    calibre_plugins.dedrm.DeDRMError: DeDRM v7.2.1: Ultimately failed to decrypt after 0.1 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 2tqq_1s_.pdf
    DeDRM v7.2.1: 2tqq_1s_.pdf is a PDF ebook
    DeDRM v7.2.1: Looking for new default Adobe Digital Editions Keys after 0.0 seconds
    Found 1 keys
    DeDRM v7.2.1: Trying a new default key
    error writing pdf: max() arg is an empty sequence
    DeDRM v7.2.1: Failed to decrypt with new default key after 0.1 seconds
    DeDRM v7.2.1: Ultimately failed to decrypt after 0.1 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\customize\ui.py”, line 176, in _run_filetype_plugins
    File “calibre_plugins.dedrm.init“, line 640, in run
    File “calibre_plugins.dedrm.init“, line 515, in PDFDecrypt
    calibre_plugins.dedrm.DeDRMError: DeDRM v7.2.1: Ultimately failed to decrypt after 0.1 seconds. Read the FAQs at Harper’s repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
    InputFormatPlugin: PDF Input running
    on C:\Users\andre\AppData\Local\Temp\calibre_lotoniiz\2tqq_1s_.pdf
    Converting file to html…
    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 82, in
    File “site.py”, line 77, in main
    File “site.py”, line 49, in run_entry_point
    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\ebooks\conversion\plugins\pdf_input.py”, line 54, in convert
    File “calibre\ebooks\pdf\pdftohtml.py”, line 83, in pdftohtml
    calibre.ebooks.ConversionError: pdftohtml failed with return code: 1
    Syntax Error: Couldn’t find the ‘EBX_HANDLER’ security handler
    Exception ignored in:
    Traceback (most recent call last):
    File “calibre_plugins.dedrm.adobekey”, line 268, in del
    TypeError: ‘NoneType’ object is not callable
    Exception ignored in:
    Traceback (most recent call last):
    File “calibre_plugins.dedrm.adobekey”, line 268, in del
    TypeError: ‘NoneType’ object is not callable

    I bought the book, i want to read it on a kindle paperwhite, but i can’t. pls, help

  8. Hi there. I have Calibre 5.29.0 and Version 7.21 of the de-drm tools. The Calibre plugin was installed fine. However, it is not removing the DRM from some ebooks. I choose ‘download to USB’ from Amazon UK, so I can import my ebooks into Calibre and convert, sorting the formatting etc. I downloaded this book (https://www.amazon.co.uk/gp/product/B09BDHQK6H/ref=ppx_yo_dt_b_d_asin_title_o00?ie=UTF8&psc=1), and imported it into Calibre. I went to open it with the Ebook Viewer and got the message “This book is locked by DRM.” I have no idea why this is happening, as it should’ve had the DRM removed when added. I’ve deleted the book in question from Calibre and re-imported it, making sure to have the ‘Automerge’ function checked in the ‘Adding Book’s section of Calibre Preferences, just in case. Nothing seems to work, and I don’t know what else to do. Any help would be hugely appreciated.

  9. Hello.
    Thank you for your hard work on this!
    Mine seems to not be working for some reason.

    – which tool was used – DeDRM + KFX Input + Calibre
    – which OS you are using – Windows 10 Pro x64
    – where the ebook file came from (device or application) – Kindle for PC Application downloaded from Amazon’s website
    – any error messages – None
    – a log of the DRM-removal attempt (see the FAQs on how to get a log) – Please see below.

    calibre Debug log
    calibre 5.29 embedded-python: True is64bit: False
    Windows-10-10.0.19041 Windows (’32bit’, ‘WindowsPE’)
    32bit process running on 64bit windows
    (‘Windows’, ’10’, ‘10.0.19041’)
    Python 3.8.5
    Windows: (’10’, ‘10.0.19041’, ”, ‘Multiprocessor Free’)
    Interface language: None
    Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 44, 0) && DeDRM (7, 2, 1) && Package KFX (from KFX Input) (1, 44, 0) && KFX metadata reader (from KFX Input) (1, 44, 0) && KFX Input (1, 44, 0) && Set KFX metadata (from KFX Output) (1, 56, 0) && KFX Output (1, 56, 0) && Obok DeDRM (7, 2, 1)
    calibre 5.29 embedded-python: True is64bit: False
    Windows-10-10.0.19041 Windows (’32bit’, ‘WindowsPE’)
    32bit process running on 64bit windows
    (‘Windows’, ’10’, ‘10.0.19041’)
    Python 3.8.5
    Windows: (’10’, ‘10.0.19041’, ”, ‘Multiprocessor Free’)
    Interface language: None
    Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 44, 0) && DeDRM (7, 2, 1) && Package KFX (from KFX Input) (1, 44, 0) && KFX metadata reader (from KFX Input) (1, 44, 0) && KFX Input (1, 44, 0) && Set KFX metadata (from KFX Output) (1, 56, 0) && KFX Output (1, 56, 0) && Obok DeDRM (7, 2, 1)
    Turning on automatic hidpi scaling
    devicePixelRatio: 2.0
    logicalDpi: 96.0 x 96.0
    physicalDpi: 80.34266886326195 x 79.51304347826087
    Using calibre Qt style: True
    [0.00] Starting up…
    [0.00] Showing splash screen…
    [0.47] splash screen shown
    [0.47] Initializing db…
    [0.47] db initialized
    [0.47] 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.92] main UI initialized…
    [0.92] Hiding splash screen
    Starting QuickView
    Gather KFX-ZIP (from KFX Input) 1.44.0: Importing C:\Users\Saini\Documents\My Kindle Content\B087Y66C5M_EBOK\B087Y66C5M_EBOK.azw
    Gather KFX-ZIP (from KFX Input): Gathered 4 file(s) as C:\Users\Saini\AppData\Local\Temp\calibre_k9hlwfx4\kx912611.kfx-zip
    DeDRM v7.2.1: Trying to decrypt kx912611.kfx-zip
    Using Library AlfCrypto DLL/DYLIB/SO
    Using Library AlfCrypto DLL/DYLIB/SO
    Decrypting KFX-ZIP ebook: kx912611
    Found 0 keys to try after 0.1 seconds
    Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.1cd4adf9-96d9-4ef7-a322-62bd24ebc2b9.voucher
    Traceback (most recent call last):
    File “calibre_plugins.dedrm.kfxdedrm”, line 83, in decrypt_voucher
    File “C:\Users\Saini\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 879, in decryptvoucher
    File “C:\Users\Saini\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 758, in pkcs7unpad
    File “C:\Users\Saini\AppData\Roaming\calibre\plugins\DeDRM.zip\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.1 seconds
    searching for kinfoFiles in C:\Users\Saini\AppData\Local
    Found K4PC 1.25+ kinf2018 file: C:\Users\Saini\AppData\Local\Amazon\Kindle\storage.kinf2018
    [3.84] splash screen hidden
    [3.86] Started up in 3.86 seconds with 1 books
    stdout+stderr from file dialog helper: [b”, b”]
    piped data from file dialog helper: [b’\xa8\x8c\xce\xe1\x87\x84`\x10\xab\xd7\n\x86\xedwO\x07 P\xf8~\xf62\xd1\x1a\xbfO\xcd\xd3\xf4L\xa6e’, b’C:\Users\Saini\Documents\My Kindle Content\B087Y66C5M_EBOK\B087Y66C5M_EBOK.azw’]
    Decrypted key file using IDString ‘2497878320’ and UserName ‘Mani’
    DeDRM v7.2.1: Found 1 new key
    Decrypting KFX-ZIP ebook: kx912611
    Got DSN key from database default_key_1
    Found 1 keys to try after 2.8 seconds
    Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.1cd4adf9-96d9-4ef7-a322-62bd24ebc2b9.voucher
    Traceback (most recent call last):
    File “calibre_plugins.dedrm.init”, line 540, in KindleMobiDecrypt
    File “calibre_plugins.dedrm.k4mobidedrm”, line 238, in GetDecryptedBook
    File “calibre_plugins.dedrm.kfxdedrm”, line 45, in processBook
    File “calibre_plugins.dedrm.kfxdedrm”, line 89, 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.kfxdedrm”, line 83, in decrypt_voucher
    File “C:\Users\Saini\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 879, in decryptvoucher
    File “C:\Users\Saini\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 758, in pkcs7unpad
    File “C:\Users\Saini\AppData\Roaming\calibre\plugins\DeDRM.zip\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
    File “calibre_plugins.dedrm.k4mobidedrm”, line 238, in GetDecryptedBook
    File “calibre_plugins.dedrm.kfxdedrm”, line 45, in processBook
    File “calibre_plugins.dedrm.kfxdedrm”, line 89, 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.kfxdedrm”, line 83, in decrypt_voucher
    File “C:\Users\Saini\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 879, in decryptvoucher
    File “C:\Users\Saini\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 758, in pkcs7unpad
    File “C:\Users\Saini\AppData\Roaming\calibre\plugins\DeDRM.zip\ion.py”, line 98, in _assert
    Exception: Incorrect padding – Wrong key
    DeDRM v7.2.1: Ultimately failed to decrypt after 2.8 seconds. Read the FAQs at Harper’s repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
    Package KFX (from KFX Input) 1.44.0: Packaging C:\Users\Saini\AppData\Local\Temp\calibre_k9hlwfx4\kx912611.kfx-zip
    Processing container: B087Y66C5M_EBOK.azw
    KFX metadata reader (from KFX Input) activated for C:\Users\Saini\AppData\Local\Temp\calibre_k9hlwfx4\8gfwwbmu_add_books\0\B087Y66C5M_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
    File “calibre_plugins.dedrm.k4mobidedrm”, line 238, in GetDecryptedBook
    File “calibre_plugins.dedrm.kfxdedrm”, line 45, in processBook
    File “calibre_plugins.dedrm.kfxdedrm”, line 89, 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 176, in _run_filetype_plugins
    File “calibre_plugins.dedrm.init”, line 633, in run
    File “calibre_plugins.dedrm.init”, line 583, in KindleMobiDecrypt
    calibre_plugins.dedrm.DeDRMError: DeDRM v7.2.1: Ultimately failed to decrypt after 2.8 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 176, 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 84, in convert_to_single_kfx
    File “calibre_plugins.kfx_input.kfxlib.yj_book”, line 211, in decode_book
    File “calibre_plugins.kfx_input.kfxlib.yj_book”, line 318, in get_container
    calibre_plugins.kfx_input.kfxlib.utilities.KFXDRMError: Book container Added BeMo’s Ultimate Guide to Medical School Interview: How to Ace Your Med School Interview without Memorizing any Sample Questions to db in: 0.1
    Added 1 books in 3.3 seconds

  10. Hi all.

    I need to install PyCrypto under Windows 7, but the site pointed in the “DeDRM_App_ReadMe.txt” file from the DeDRM_tools_6.6.3 zip does not exist. I would thank very much any information about installing that without compiling: I need the binaries.

      • Because I would prefer to keep my EPUBs clean & tidy. Although I do not like Calibre at all, under Windows 7, what Calibre version would I need?

        Better yet: is there anyway to ddrm Adobe ePub files under 64bits MacOS?

          • As far as I know, Adobe Digital Editions version 2.0 is required to ddrm Adobe ePubs and it can not run in 64 bits OSs. Please, explained me how to do it.

        • Looks like the calibre folks recommend 3.48 for Windows 7. You would need DeDRM 6.8.1 for that. Whether you can DeDRM Adobe epubs downloaded with ADE 4.5 depends on whether the ebookstore is using the hardened DRM. And that seems to be pretty rare. You can certainly use calibre and DeDRM on the latest MacOS.

  11. I use to ddrm my ebooks using the standalone app: that way warrants that the original styles in the css file are not replaced and the original structure of the ePub is also conserved. Years ago I tried Calibre, but was impossible for me to set it to no altere the original ebook aside the ddrm thing…

  12. I purchased an ebook that is a study guide – when I purchased I didn’t realize I wouldn’t actually own the file. I am only able to view it in browser, by going to the website that sole it to me (passthease dot motoragetraining dot com). I was hoping to print some pages on topics I don’t know as well to take notes on – but I can’t even save the file to then remove the DRM to print. Any advice?

  13. I own an artbook from Amazon that I am trying to download in the highest-quality format for use on my PC.

    When using Kindle for PC (latest version, 1.26, or 1.17), it always downloads the book in azw format, and the total folder size is about 290 MB.

    When using Kindle for Android (latest version), it downloads a much larger set of files (KFX files and a few others), totaling about 2.6 GB.

    I’d like to save off the highest-quality images so I can make a full-resolution PDF.

    I understand that KFX are not currently working with DeDrm tools, and I also know that it is currently problematic or impossible to extract keys from Kindle for Android. I also don’t own a physical Kindle device, so I can’t download the files for USB transfer.

    What is the best course of action? Is there any way to dump the images from the Android KFX files, perhaps directly from the Android phone? Is there any way to force Kindle for PC to download a higher-quality version of the books, even if they are KFX format? Are there any scripts that will allow me to download the files directly from the Amazon site without owning a physical device? Are there other websites that offer super high-resolution comic book files that may be easier to deal with than Amazon?

    Thanks for your help!

    • Just FYI, the file that you would get from the website if you did have a Kindle would likely have lower-res images and they might even be greyscale.

  14. I’m having trouble removing DRM from a Nook ebook I purchased a few days ago. I have my hash code, which doesn’t appear to have changed, and I never had a problem doing this before. The last Nook book I imported into Calibre was in July 2021, and it worked fine. I’m using Calibre 5.31.1 and DeDRM 7.2.1. Does anyone know what the problem might be?

      • Yes, I used the same rooted Android tablet that I’ve always used. I will be able to post my log file tomorrow (I’m not at that computer this evening).

      • Here is my log file:

        calibre Debug log
        calibre 5.31.1 [64bit] embedded-python: True is64bit: True
        Windows-10-10.0.19041 Windows (’64bit’, ‘WindowsPE’)
        (‘Windows’, ’10’, ‘10.0.19041’)
        Python 3.8.5
        Windows: (’10’, ‘10.0.19041’, ”, ‘Multiprocessor Free’)
        Interface language: None
        Successfully initialized third party plugins: DeDRM (7, 2, 1)
        calibre 5.31.1 [64bit] embedded-python: True is64bit: True
        Windows-10-10.0.19041 Windows (’64bit’, ‘WindowsPE’)
        (‘Windows’, ’10’, ‘10.0.19041’)
        Python 3.8.5
        Windows: (’10’, ‘10.0.19041’, ”, ‘Multiprocessor Free’)
        Interface language: None
        Successfully initialized third party plugins: DeDRM (7, 2, 1)
        Turning on automatic hidpi scaling
        devicePixelRatio: 2.0
        logicalDpi: 96.0 x 96.0
        physicalDpi: 127.66492146596858 x 128.18691588785046
        Using calibre Qt style: True
        [0.00] Starting up…
        [0.00] Showing splash screen…
        [0.48] splash screen shown
        [0.48] Initializing db…
        [0.48] db initialized
        [0.48] Constructing main UI…
        [0.95] main UI initialized…
        [0.95] Hiding splash screen
        Starting QuickView
        DeDRM v7.2.1: Trying to decrypt 9781328880017_epub.v8 (1).epub
        DeDRM v7.2.1: Verifying zip archive integrity
        DeDRM v7.2.1: “9781328880017_epub.v8 (1).epub” is a secure Barnes & Noble ePub
        DeDRM v7.2.1: Trying Encryption key hash
        Could not decrypt _rpccsl9.epub because of an exception:
        Traceback (most recent call last):
        File “calibre_plugins.dedrm.ignobleepub”, line 266, in decryptBook
        File “calibre_plugins.dedrm.ignobleepub”, line 197, in init
        File “calibre_plugins.dedrm.ignobleepub”, line 168, in init
        File “Crypto\Cipher\AES.py”, line 232, in new
        File “Crypto\Cipher__init__.py”, line 79, in _create_cipher
        File “Crypto\Cipher_mode_cbc.py”, line 274, in _create_cbc_cipher
        File “Crypto\Cipher\AES.py”, line 93, in _create_base_cipher
        ValueError: Incorrect AES key length (0 bytes)

        DeDRM v7.2.1: Failed to decrypt with key hash after 0.1 seconds
        DeDRM v7.2.1: Looking for new NOOK Study Keys after 0.1 seconds
        No nook Study log files have been found.
        DeDRM v7.2.1: Ultimately failed to decrypt after 0.1 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\customize\ui.py”, line 175, in _run_filetype_plugins
        File “calibre_plugins.dedrm.init“, line 644, in run
        File “calibre_plugins.dedrm.init“, line 313, in ePubDecrypt
        calibre_plugins.dedrm.DeDRMError: DeDRM v7.2.1: Ultimately failed to decrypt after 0.1 seconds. Read the FAQs at Harper’s repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
        [30.14] splash screen hidden
        [30.16] Started up in 30.16 seconds with 116 books
        stdout+stderr from file dialog helper: [b”, b”]
        piped data from file dialog helper: [b'[\xb4J\xa4a\xdd\xf7f\r”\xc8\x0f\xbd/\x81\xbb\xee\xd7Y\xf0\xea\x9c\xed\xf5$$\x98\x0bB\x97\xbe\x03′, b’C:\Users\Zhanna (Standard)\Downloads\9781328880017_epub.v8 (1).epub’]
        Added Infinite Powers to db in: 0.1
        Added 1 books in 0.5 seconds

          • It was an earlier version, but I don’t know which one-may have been 7.1.0. It was not version 6. Should I try going back to an earlier version of DeDRM and/or Calibre?

            • I was only going to suggest that if it was 6.8. This key doesn’t seem to work for this book though. I’d try extracting the cchash again. See if it has changed. Beyond that I don’t know.

  15. DeDrm Problem:
    Environment: Windows 10, Calibre 5.31.1, DeDrm Plugin 7.2.1, PDF from a local Library
    Some PDF from same Library work some others not.

    Details from Konvert PDF to EPUB

    calibre, version 5.31.1 (win32, embedded-python: True)
    Konvertierungsfehler: Fehlgeschlagen: Buch 1 von 1 (DuMont direkt Reiseführer Norderney) konvertieren

    Buch 1 von 1 (DuMont direkt Reiseführer Norderney) konvertieren
    DeDRM v7.2.1: Trying to decrypt k0uneak3.pdf
    DeDRM v7.2.1: k0uneak3.pdf is a PDF ebook
    DeDRM v7.2.1: Trying Encryption key default_key
    error writing pdf: max() arg is an empty sequence
    DeDRM v7.2.1: Failed to decrypt with key default_key after 0.3 seconds
    DeDRM v7.2.1: Looking for new default Adobe Digital Editions Keys after 0.3 seconds
    Found 1 keys
    DeDRM v7.2.1: Trying a new default key
    error writing pdf: max() arg is an empty sequence
    DeDRM v7.2.1: Failed to decrypt with new default key after 0.4 seconds
    DeDRM v7.2.1: Ultimately failed to decrypt after 0.4 seconds. Read the FAQs at Harper’s repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
    Conversion options changed from defaults:
    read_metadata_from_opf: ‘C:\Users\mz\AppData\Local\Temp\calibre_6b_2thqq\53xowajw.opf’
    verbose: 2
    Resolved conversion options
    calibre version: 5.31.1
    {‘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’: None,
    ‘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 0x076B2D18>,
    ‘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,
    ‘new_pdf_engine’: False,
    ‘no_chapters_in_toc’: False,
    ‘no_default_epub_cover’: False,
    ‘no_images’: False,
    ‘no_inline_navbars’: False,
    ‘no_svg_cover’: False,
    ‘output_profile’: <calibre.customize.profiles.OutputProfile object at 0x076B2E80>,
    ‘page_breaks_before’: “//*[name()=’h1′ or name()=’h2′]”,
    ‘prefer_metadata_cover’: False,
    ‘preserve_cover_aspect_ratio’: False,
    ‘pretty_print’: True,
    ‘pubdate’: None,
    ‘publisher’: None,
    ‘rating’: None,
    ‘read_metadata_from_opf’: ‘C:\Users\mz\AppData\Local\Temp\calibre_6b_2thqq\53xowajw.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_factor’: 0.45,
    ‘unwrap_lines’: True,
    ‘use_auto_toc’: False,
    ‘verbose’: 2}
    Running file type plugin DeDRM failed with traceback:
    Traceback (most recent call last):
    File “calibre\customize\ui.py”, line 175, in _run_filetype_plugins
    File “calibre_plugins.dedrm.init“, line 640, in run
    File “calibre_plugins.dedrm.init“, line 515, in PDFDecrypt
    calibre_plugins.dedrm.DeDRMError: DeDRM v7.2.1: Ultimately failed to decrypt after 0.4 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 k0uneak3.pdf
    DeDRM v7.2.1: k0uneak3.pdf is a PDF ebook
    DeDRM v7.2.1: Trying Encryption key default_key
    error writing pdf: max() arg is an empty sequence
    DeDRM v7.2.1: Failed to decrypt with key default_key after 0.1 seconds
    DeDRM v7.2.1: Looking for new default Adobe Digital Editions Keys after 0.1 seconds
    Found 1 keys
    DeDRM v7.2.1: Trying a new default key
    error writing pdf: max() arg is an empty sequence
    DeDRM v7.2.1: Failed to decrypt with new default key after 0.3 seconds
    DeDRM v7.2.1: Ultimately failed to decrypt after 0.3 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\customize\ui.py”, line 175, in _run_filetype_plugins
    File “calibre_plugins.dedrm.init“, line 640, in run
    File “calibre_plugins.dedrm.init“, line 515, in PDFDecrypt
    calibre_plugins.dedrm.DeDRMError: DeDRM v7.2.1: Ultimately failed to decrypt after 0.3 seconds. Read the FAQs at Harper’s repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
    InputFormatPlugin: PDF Input running
    on C:\Users\mz\AppData\Local\Temp\calibre_6b_2thqq\k0uneak3.pdf
    Converting file to html…
    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 82, in
    File “site.py”, line 77, in main
    File “site.py”, line 49, in run_entry_point
    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 244, in call
    File “calibre\ebooks\conversion\plugins\pdf_input.py”, line 54, in convert
    File “calibre\ebooks\pdf\pdftohtml.py”, line 83, in pdftohtml
    calibre.ebooks.ConversionError: pdftohtml failed with return code: 1
    Syntax Error: Couldn’t find the ‘EBX_HANDLER’ security handler
    Exception ignored in:
    Traceback (most recent call last):
    File “calibre_plugins.dedrm.adobekey”, line 268, in del
    TypeError: ‘NoneType’ object is not callable
    Exception ignored in:
    Traceback (most recent call last):
    File “calibre_plugins.dedrm.adobekey”, line 268, in del
    TypeError: ‘NoneType’ object is not callable

  16. I may not be in the right forum, but am not certain which is best, so if you all will forgive me, I’ll start here.

    I have an ebook that I have downloaded directly from Amazon onto my Kindle. I have also downloaded via USB for import into Calibre. I note that when being read in Kindle, it has very nice ligatures, but in Calibre it has no ligatures.

    Since Calibre’s conversion dialog has a checkbox for retain ligatures, I’m assuming that Calibre can handle books with ligatures.

    However after import (it subsequently is AZW3) there are no visible ligatures.

    I am using an old Centos-7 system (kept up to date, even though C8 is available) with Calibre 3.48 and DeDRM 6.6.3 which has worked for me for a long time (later versions of Calibre are claimed by the author to no longer work on Centos-7, so I haven’t tried them).

    So, I wonder if any of you can clue me in on whether this lack of ligatures is caused by:
    1. Calibre
    2. DeDRM (old version)
    3. or Amazon’s book formats for “download via USB” don’t contain ligatures?

    Thanks in advance!

    Fred

    • Kindle books do not normally contain ligatures. Books with Enhanced Typesetting will show ligatures, but they are rendered on-the-fly, not in the actual file format.

      • and since “download for transfer using USB” gives a different file format, we do not get the enhanced typesetting? Perhaps if I was still using Kindle for PC to download the books, and if I had a version of DeDRM that supported KF8, I might get the enhanced typesetting features….

        • You are not going to get ligatures in calibre by converting a book from a Kindle format, even KFX format. The ligatures are not in the book file. They are added by the Kindle software when you read the book.

          If you want to add ligatures to a book so that they show in the calibre viewer that is something you should ask about in the calibre forums on MobileRead.

          • Alright, thanks. I guess I won’t beat my head on that wall any further.

            On a related topic, more of an interesting thing that something I can fix: I note that when my Kindle hyphenates a word in the middle of a ligature (e.g., afford or effort) there is an ‘f’ before the hyphen and another at the start of the next line, BUT… it hasn’t properly unhooked the ligature, turning it back into an ordinary f, hyphen, ordinary f, it appears to have taken the ligature symbol and chopped the graphic in two. result is that the f before the hyphen is clearly the first half of the ligature (the curve at the top of the first f of an ff ligature isn’t quite the same shape as a normal f) and the next line starts with an f that still has a portion of the initial f attached to it. As a former typographer (and a trainer and programmer for a company that built and sold typographic systems) I choose to call that a bug, or at least a negative feature.

            • I have been unable to duplicate your findings. I created a book containing the repeated words “afford” and “effort”, converted to KFX format, and sideloaded it only my Kindle. When using a font with an ff ligature (Bookerly) those words were never hyphenated at any font size. Only when a switched to a font without an ff ligature (Palatino) were those words split across lines and the results looked normal to me.

              Can you post a screen shot with an example?

              • Um, it seems that my memory has failed me. It wasn’t my Kindle that exhibited that strange ligature behavior, it was Amazon’s online (in your browser) tool used for the “Look Inside” feature.

                Sorry!

    • My first guess would be that the issue is with the calibre ebook viewer. How does the DRM-free version look if you sideload it onto the Kindle?

  17. Hi, im using a macbook and i downloaded this book from my online library. This is the debug code

    calibre Debug log
    calibre 5.32 embedded-python: True is64bit: True
    macOS-10.16-x86_64-i386-64bit Darwin (’64bit’, ”)
    (‘Darwin’, ‘20.1.0’, ‘Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:10 PDT 2020; root:xnu-7195.50.7~2/RELEASE_ARM64_T8101’)
    Python 3.8.5
    OSX: (‘10.16’, (”, ”, ”), ‘x86_64′)
    Interface language: en_GB
    Successfully initialized third party plugins: DeDRM (7, 2, 1)
    calibre 5.32 embedded-python: True is64bit: True
    macOS-10.16-x86_64-i386-64bit Darwin (’64bit’, ”)
    (‘Darwin’, ‘20.1.0’, ‘Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:10 PDT 2020; root:xnu-7195.50.7~2/RELEASE_ARM64_T8101’)
    Python 3.8.5
    OSX: (‘10.16’, (”, ”, ”), ‘x86_64’)
    Interface language: en_GB
    Successfully initialized third party plugins: DeDRM (7, 2, 1)
    devicePixelRatio: 2.0
    logicalDpi: 72.0 x 72.0
    physicalDpi: 127.50000191485789 x 127.50000191485789
    Using calibre Qt style: True
    [0.00] Starting up…
    [0.03] Showing splash screen…
    [0.26] splash screen shown
    [0.26] Initializing db…
    [0.28] db initialized
    [0.28] Constructing main UI…
    [0.87] main UI initialized…
    [0.87] Hiding splash screen
    Starting QuickView
    DeDRM v7.2.1: Trying to decrypt Public Health and Epidemiology at a Glance.pdf
    DeDRM v7.2.1: Public Health and Epidemiology at a Glance.pdf is a PDF ebook
    DeDRM v7.2.1: Looking for new default Adobe Digital Editions Keys after 0.1 seconds
    DeDRM v7.2.1: Trying a new default key
    error writing pdf: max() arg is an empty sequence
    DeDRM v7.2.1: Failed to decrypt with new default key after 0.1 seconds
    DeDRM v7.2.1: Ultimately failed to decrypt after 0.1 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/customize/ui.py”, line 175, in _run_filetype_plugins
    File “calibre_plugins.dedrm.init“, line 640, in run
    decrypted_ebook = self.PDFDecrypt(path_to_ebook)
    File “calibre_plugins.dedrm.init“, line 515, in PDFDecrypt
    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.1 seconds. Read the FAQs at Harper’s repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
    Traceback (most recent call last):
    File “calibre/customize/ui.py”, line 432, in get_file_type_metadata
    File “calibre/customize/builtins.py”, line 318, in get_metadata
    File “calibre/ebooks/metadata/pdf.py”, line 124, in get_metadata
    ValueError: Could not read info dict from PDF
    Syntax Error: Couldn’t find the ‘EBX_HANDLER’ security handler
    pdfinfo errored out with return code: 1
    [9.02] splash screen hidden
    [9.03] Started up in 9.03 seconds with 1 books
    Added Public Health and Epidemiology at a Glance to db in: 0.0
    Added 1 books in 0.6 seconds

  18. I hope someone can help me here. For a long time I have been running Calibre 0.9 42 on Windows xp with the apprentice alf drm removal tool that I got a long time ago installed. When I move to a “new” XP laptop I can set that up again although it takes every IQ point I have to install the Alf stuff.

    Now the problem: I am bringing up a Windows 7 laptop that came with Calibre 3.48 installed, which I gather is the correct Calibre version for Windows 7, but I have no clue as to where to find the appropriate version on the Alf stuff or how to install it. I have rummaged around in the sea of new information and am baffled.

    Thank you for any pointers.

  19. I haven’t bought a Nook book in quite a while, but now I’d like to (if I can DeDRM them). I have a working setup with Calibre 5.32 and macOS Monterey that handles Kindle books just fine. My problem is that I can’t track down my old B&N key for the DeDRM plug-in (assuming that it still works). I tried to generate a new one using my email address and password but that didn’t work. Are there any other options I could pursue? I’ll wait on buying Nook books in the meantime. Thanks for your help!

  20. I’ve begun using DeDRM again after many months of not having used it. Installation went ok (Windows 10 system) within Calibre. A crash and o.s. reinstall months back wiped out a number of settings and by now I have totally forgotten how to find the various keys needed for customizing the plug-in so that it can remove DRM—and within the last couple of years I now have .kepub books in addition to B&N books (that are at least two years old, if not older). IOW…much guidance needed. Is there a “for the complete idiot”-level documentation site giving instructions on how to locate the necessary key files for B&N and Kobo? Much obliged for assistance…

    • Replying to Laura:

      Re: “Getting B&N keys really isn’t easy these days. But here are a couple writeups of the process:”

      Thank you for this information. Whew. Mighty convoluted. I will try this (along with the Obok plugin). Before my drive crash I had a (now-deprecated) version of the Nook app for Windows. I wonder if I can install it again. Using it, I was able to download the ePub files themselves.

      I have a fairly new ‘incarnation’ of the Nook app on an Android phone, and I wonder: When you use that app, are you reading the books only online? Or is the app downloading the ePub files to the mobile phone first?

      I think the instructions (in this blog) for using DeDRM at the command line should be updated or perhaps removed. They mention requiring a decryption library for Python—a separate download from another web site. The link to that site no longer works (404 error). Then again if there are newer instructions for using DeDRM at the command line, could they be added to the blog?

      Thanks.

      • The epub files are downloaded to the Android Nook app. But they aren’t in a user accessible area unless the device is rooted.

        I’m not familiar with using DeDRM from the command line. Don’t know what instructions you’re referring to here at the blog. Or is it over at GitHub?

        • Laura — I can’t seem to locate both of your latest replies to me but I could at least see their contents in an email notification. I’ll combine my replies in this one.

          • I found that the obok_plugin worked like a charm. Grateful for your advice about that.

          • In the past I had a key for DeDRM, for B&N books, but I no longer have it. I might have to live with being stuck with the Nook app for Android.

          • DeDRM at the command line is discussed here in the blog. The post is “DeDRM Application for Windows XP and above” — the link is https://apprenticealf.wordpress.com/2011/01/14/windows-python-ebooks-and-drm/ … That page was last updated some years ago. Step 2 in its instructions tells you to install something called PyCrypto and gives you a link for that. But the PyCrypto web site cannot be reached. Perhaps the run-DeDRM-at-the-command-line approach is no longer possible.

          Or perhaps having DeDRM installed in ‘calibre’ and then running calibre itself at the command line will do the trick. I’ll have to read up on that; I haven’t ever run calibre that way yet. It would certainly be handy to call these routines from a simple .cmd or .btm shell script.

          • Your B&N key has probably changed so your best bet would be new copies of books and retrieving the new key.

            Okay, the blog page talking about the stand alone Windows app. Both it and the stand alone Mac app were dropped several versions ago. You could probably get something working by switching in the python scripts from the current version. Those apps and the plugin always used the same underlying scripts. I think there is some info at the GitHub repo about running the calibre plugin from the command line.

            • your B&N key has probably changed so your best bet would be new copies of books and retrieving the new key.

              Retrieving the key sounds difficult enough nowadays that I might just have to take my chances with the Nook app for Android (though de-drm’ing the .kepub files was another story).

              the blog page talking about the stand alone Windows app. Both it and the stand alone Mac app were dropped several versions ago.

              It’d be worth adding a note to that effect to the post in question and advising that the encryption “library” is no longer available (at least, at the URL shown in the blog post). It turned into a bit of a wild-goose chase to find out (including an attempt at installing ActivePython using a PowerShell script supplied by ActiveState—a script that, as far as I can tell, failed to install Python correctly). I’ll pursue the calibre-at-the-command-line approach. Thanks again.

  21. (Hi, please forgive me for any grammar errors, for English is not my native language)
    I’m having trouble using deDRM on an e-book.

    My computer system is Mac OS Catalina 10.15.7
    DeDRM v7.2.1
    Calibre 5.32.0
    Ebook was purchased on Amazon yesterday (Nov. 20th, 2021)

    Log:
    calibre 偵錯記錄
    calibre 5.32 embedded-python: True is64bit: True
    macOS-10.15.7-x86_64-i386-64bit Darwin (’64bit’, ”)
    (‘Darwin’, ‘19.6.0’, ‘Darwin Kernel Version 19.6.0: Mon Apr 12 20:57:45 PDT 2021; root:xnu-6153.141.28.1~1/RELEASE_X86_64’)
    Python 3.8.5
    OSX: (‘10.15.7’, (”, ”, ”), ‘x86_64′)
    Interface language: zh_TW
    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) && KFX metadata reader (from KFX Input) (1, 45, 0) && KFX Input (1, 45, 0)
    calibre 5.32 embedded-python: True is64bit: True
    macOS-10.15.7-x86_64-i386-64bit Darwin (’64bit’, ”)
    (‘Darwin’, ‘19.6.0’, ‘Darwin Kernel Version 19.6.0: Mon Apr 12 20:57:45 PDT 2021; root:xnu-6153.141.28.1~1/RELEASE_X86_64’)
    Python 3.8.5
    OSX: (‘10.15.7’, (”, ”, ”), ‘x86_64′)
    Interface language: zh_TW
    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) && KFX metadata reader (from KFX Input) (1, 45, 0) && KFX Input (1, 45, 0)
    devicePixelRatio: 2.0
    logicalDpi: 72.0 x 72.0
    physicalDpi: 128.00000192236715 x 127.50000191485789
    Using calibre Qt style: True
    [0.00] Starting up…
    [0.02] Showing splash screen…
    [0.32] splash screen shown
    [0.32] Initializing db…
    [0.33] db initialized
    [0.33] Constructing main UI…
    [1.20] main UI initialized…
    [1.20] Hiding splash screen
    Starting QuickView
    2021-11-22 03:18:23.071 calibre-debug[96979:11425039] -[NSNull length]: unrecognized selector sent to instance 0x7fff8c68e030
    2021-11-22 03:18:23.072 calibre-debug[96979:11425039] Exception calling directoryDidChange: on delegate exception=-[NSNull length]: unrecognized selector sent to instance 0x7fff8c68e030
    2021-11-22 03:18:23.077 calibre-debug[96979:11425039] -[NSNull length]: unrecognized selector sent to instance 0x7fff8c68e030
    2021-11-22 03:18:23.077 calibre-debug[96979:11425039] Exception calling directoryDidChange: on delegate exception=-[NSNull length]: unrecognized selector sent to instance 0x7fff8c68e030
    2021-11-22 03:18:23.090 calibre-debug[96979:11425039] -[NSNull length]: unrecognized selector sent to instance 0x7fff8c68e030
    2021-11-22 03:18:23.090 calibre-debug[96979:11425039] Exception calling directoryDidChange: on delegate exception=-[NSNull length]: unrecognized selector sent to instance 0x7fff8c68e030
    2021-11-22 03:18:23.090 calibre-debug[96979:11425039] -[NSNull length]: unrecognized selector sent to instance 0x7fff8c68e030
    2021-11-22 03:18:23.091 calibre-debug[96979:11425039] Exception calling directoryDidChange: on delegate exception=-[NSNull length]: unrecognized selector sent to instance 0x7fff8c68e030
    2021-11-22 03:18:24.089 calibre-debug[96979:11425039] -[NSNull length]: unrecognized selector sent to instance 0x7fff8c68e030
    2021-11-22 03:18:24.089 calibre-debug[96979:11425039] Exception calling directoryDidChange: on delegate exception=-[NSNull length]: unrecognized selector sent to instance 0x7fff8c68e030
    2021-11-22 03:18:24.295 calibre-debug[96979:11425039] -[NSNull length]: unrecognized selector sent to instance 0x7fff8c68e030
    2021-11-22 03:18:24.295 calibre-debug[96979:11425039] Exception calling directoryDidChange: on delegate exception=-[NSNull length]: unrecognized selector sent to instance 0x7fff8c68e030
    2021-11-22 03:18:24.778 calibre-debug[96979:11425039] -[NSNull length]: unrecognized selector sent to instance 0x7fff8c68e030
    2021-11-22 03:18:24.778 calibre-debug[96979:11425039] Exception calling directoryDidChange: on delegate exception=-[NSNull length]: unrecognized selector sent to instance 0x7fff8c68e030
    Gather KFX-ZIP (from KFX Input) 1.45.0: Importing /Users/itinghsieh/Library/Containers/com.amazon.Kindle/Data/Library/Application Support/Kindle/My Kindle Content/B07KW7NPGF_EBOK/B07KW7NPGF_EBOK.azw
    Gather KFX-ZIP (from KFX Input): Gathered 18 file(s) as /var/folders/py/cr946phs5l71ws6b6bx8kjp00000gn/C/calibre_5.32.0_tmp_8tn5hup1/tbwfvzrg.kfx-zip
    DeDRM v7.2.1: Trying to decrypt tbwfvzrg.kfx-zip
    Using Library AlfCrypto Python
    Using Library AlfCrypto Python
    Decrypting KFX-ZIP ebook: tbwfvzrg
    Found 0 keys to try after 0.1 seconds
    Decrypting KFX DRM voucher: amzn1.drm-voucher.v1.4f0e03c9-1a58-43c5-a522-8ce65b4b0e7e.voucher
    Traceback (most recent call last):
    File “calibre_plugins.dedrm.kfxdedrm”, line 83, in decrypt_voucher
    voucher.decryptvoucher()
    File “/var/folders/py/cr946phs5l71ws6b6bx8kjp00000gn/C/calibre_5.32.0_tmp_8tn5hup1/0ilfmzmfplugin_unzip/ion.py”, line 879, in decryptvoucher
    b = pkcs7unpad(b, 16)
    File “/var/folders/py/cr946phs5l71ws6b6bx8kjp00000gn/C/calibre_5.32.0_tmp_8tn5hup1/0ilfmzmfplugin_unzip/ion.py”, line 758, in pkcs7unpad
    _assert(paddinglen > 0 and paddinglen <= blocklen, “Incorrect padding – Wrong key”)
    File “/var/folders/py/cr946phs5l71ws6b6bx8kjp00000gn/C/calibre_5.32.0_tmp_8tn5hup1/0ilfmzmfplugin_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/itinghsieh/Library/Containers/com.amazon.Kindle/Data/Library/Application Support/Kindle/storage/.kinf2018
    trying username b’itinghsieh’ on file /Users/itinghsieh/Library/Containers/com.amazon.Kindle/Data/Library/Application Support/Kindle/storage/.kinf2018
    trying IDString: b’99875ea4088a’
    [6.76] splash screen hidden
    [6.76] Started up in 6.76 seconds with 1 books
    Decrypted key file using IDString ‘99875ea4088a’ and UserName ‘itinghsieh’
    DeDRM v7.2.1: Found 1 new key
    Decrypting KFX-ZIP ebook: tbwfvzrg
    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.4f0e03c9-1a58-43c5-a522-8ce65b4b0e7e.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/py/cr946phs5l71ws6b6bx8kjp00000gn/C/calibre_5.32.0_tmp_8tn5hup1/0ilfmzmfplugin_unzip/ion.py”, line 879, in decryptvoucher
    b = pkcs7unpad(b, 16)
    File “/var/folders/py/cr946phs5l71ws6b6bx8kjp00000gn/C/calibre_5.32.0_tmp_8tn5hup1/0ilfmzmfplugin_unzip/ion.py”, line 758, in pkcs7unpad
    _assert(paddinglen > 0 and paddinglen <= blocklen, “Incorrect padding – Wrong key”)
    File “/var/folders/py/cr946phs5l71ws6b6bx8kjp00000gn/C/calibre_5.32.0_tmp_8tn5hup1/0ilfmzmfplugin_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/py/cr946phs5l71ws6b6bx8kjp00000gn/C/calibre_5.32.0_tmp_8tn5hup1/0ilfmzmfplugin_unzip/ion.py”, line 879, in decryptvoucher
    b = pkcs7unpad(b, 16)
    File “/var/folders/py/cr946phs5l71ws6b6bx8kjp00000gn/C/calibre_5.32.0_tmp_8tn5hup1/0ilfmzmfplugin_unzip/ion.py”, line 758, in pkcs7unpad
    _assert(paddinglen > 0 and paddinglen <= blocklen, “Incorrect padding – Wrong key”)
    File “/var/folders/py/cr946phs5l71ws6b6bx8kjp00000gn/C/calibre_5.32.0_tmp_8tn5hup1/0ilfmzmfplugin_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.5 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/py/cr946phs5l71ws6b6bx8kjp00000gn/C/calibre_5.32.0_tmp_8tn5hup1/tbwfvzrg.kfx-zip
    Processing container: B07KW7NPGF_EBOK.azw
    KFX metadata reader (from KFX Input) activated for /var/folders/py/cr946phs5l71ws6b6bx8kjp00000gn/C/calibre_5.32.0_tmp_8tn5hup1/6qxkixrf_add_books/0/B07KW7NPGF_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 0.5 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 B07KW7NPGF_EBOK.azw has DRM and cannot be converted

    Thank you so much for taking the time!!

  22. A further reply to Laura, regarding the Obok plug-in: Does this plug-in also require obtaining a decryption key for the .kepub files? If so, how might I go about getting the key? Thanks again.

  23. Thank you in advance.

    calibre Registro de depuración
    calibre 5.32 [64bit] embedded-python: True is64bit: True
    Windows-10-10.0.19041 Windows (’64bit’, ‘WindowsPE’)
    (‘Windows’, ’10’, ‘10.0.19041’)
    Python 3.8.5
    Windows: (’10’, ‘10.0.19041’, ”, ‘Multiprocessor Free’)
    Interface language: es
    Successfully initialized third party plugins: DeDRM (7, 2, 1) && Actualizador Biblioteca EPG (1, 7, 0) && Find Duplicates (1, 8, 10) && Obok DeDRM (7, 2, 1)
    calibre 5.32 [64bit] embedded-python: True is64bit: True
    Windows-10-10.0.19041 Windows (’64bit’, ‘WindowsPE’)
    (‘Windows’, ’10’, ‘10.0.19041’)
    Python 3.8.5
    Windows: (’10’, ‘10.0.19041’, ”, ‘Multiprocessor Free’)
    Interface language: es
    Successfully initialized third party plugins: DeDRM (7, 2, 1) && Actualizador Biblioteca EPG (1, 7, 0) && Find Duplicates (1, 8, 10) && Obok DeDRM (7, 2, 1)
    Turning on automatic hidpi scaling
    devicePixelRatio: 1.0
    logicalDpi: 96.0 x 96.0
    physicalDpi: 105.21682847896439 x 105.71098265895952
    Using calibre Qt style: True
    [0.00] Starting up…
    [0.00] Showing splash screen…
    [0.48] splash screen shown
    [0.48] Initializing db…
    [0.48] db initialized
    [0.48] 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
    [1.05] main UI initialized…
    [1.05] Hiding splash screen
    Starting QuickView
    DeDRM v7.2.1: Trying to decrypt Supuestos prácticos de contabilidad general.pdf
    DeDRM v7.2.1: Supuestos prácticos de contabilidad general.pdf is a PDF ebook
    DeDRM v7.2.1: Trying Encryption key default_key
    error writing pdf: max() arg is an empty sequence
    DeDRM v7.2.1: Failed to decrypt with key default_key after 0.1 seconds
    DeDRM v7.2.1: Looking for new default Adobe Digital Editions Keys after 0.1 seconds
    Found 1 keys
    DeDRM v7.2.1: Trying a new default key
    error writing pdf: max() arg is an empty sequence
    DeDRM v7.2.1: Failed to decrypt with new default key after 0.1 seconds
    DeDRM v7.2.1: Ultimately failed to decrypt after 0.1 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\customize\ui.py”, line 175, in _run_filetype_plugins
    File “calibre_plugins.dedrm.init“, line 640, in run
    File “calibre_plugins.dedrm.init“, line 515, in PDFDecrypt
    calibre_plugins.dedrm.DeDRMError: DeDRM v7.2.1: Ultimately failed to decrypt after 0.1 seconds. Read the FAQs at Harper’s repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md
    Traceback (most recent call last):
    File “calibre\customize\ui.py”, line 432, in get_file_type_metadata
    File “calibre\customize\builtins.py”, line 318, in get_metadata
    File “calibre\ebooks\metadata\pdf.py”, line 124, in get_metadata
    ValueError: Could not read info dict from PDF
    Syntax Error: Couldn’t find the ‘EBX_HANDLER’ security handler

    pdfinfo errored out with return code: 1
    Exception ignored in:
    Traceback (most recent call last):
    File “calibre_plugins.dedrm.adobekey”, line 268, in del
    TypeError: ‘NoneType’ object is not callable
    Exception ignored in:
    Traceback (most recent call last):
    File “calibre_plugins.dedrm.adobekey”, line 268, in del
    TypeError: ‘NoneType’ object is not callable
    [6.05] splash screen hidden
    [6.05] Started up in 6.05 seconds with 13 books
    Added Supuestos prácticos de contabilidad general to db in: 0.1
    Added 1 books in 0.6 seconds

  24. Hi, I’d appreciate any help or advice you might have
    Mac OS 10.15.7
    calibre 5.32
    DeDRM 7.2.1

    Tried your advice to deregister and uninstall kindle for Mac. Didn’t see any Kindle app preferences to delete in either directory location. Reinstalled, reregistered, downloaded new ebook file.

    Thanks in advance

    calibre Debug log
    calibre 5.32 embedded-python: True is64bit: True
    macOS-10.15.7-x86_64-i386-64bit Darwin (’64bit’, ”)
    (‘Darwin’, ‘19.6.0’, ‘Darwin Kernel Version 19.6.0: Thu Sep 16 20:58:47 PDT 2021; root:xnu-6153.141.40.1~1/RELEASE_X86_64’)
    Python 3.8.5
    OSX: (‘10.15.7’, (”, ”, ”), ‘x86_64′)
    Interface language: None
    Successfully initialized third party plugins: DeDRM (7, 2, 1)
    calibre 5.32 embedded-python: True is64bit: True
    macOS-10.15.7-x86_64-i386-64bit Darwin (’64bit’, ”)
    (‘Darwin’, ‘19.6.0’, ‘Darwin Kernel Version 19.6.0: Thu Sep 16 20:58:47 PDT 2021; root:xnu-6153.141.40.1~1/RELEASE_X86_64’)
    Python 3.8.5
    OSX: (‘10.15.7’, (”, ”, ”), ‘x86_64′)
    Interface language: None
    Successfully initialized third party plugins: DeDRM (7, 2, 1)
    devicePixelRatio: 2.0
    logicalDpi: 72.0 x 72.0
    physicalDpi: 128.00000192236715 x 127.50000191485789
    Using calibre Qt style: True
    [0.00] Starting up…
    [0.03] Showing splash screen…
    [0.31] splash screen shown
    [0.31] Initializing db…
    [0.32] db initialized
    [0.32] Constructing main UI…
    [1.03] main UI initialized…
    [1.03] Hiding splash screen
    Starting QuickView
    DeDRM v7.2.1: Trying to decrypt Why We Get Sick.azw3
    Using Library AlfCrypto Python
    Using Library AlfCrypto Python
    MobiDeDrm v1.0.
    Copyright © 2008-2020 The Dark Reverser, Apprentice Harper et al.
    Decrypting Kindle Format 8 ebook: Why We Get Sick
    Found 0 keys to try after 0.1 seconds
    Crypto Type is: 2
    DeDRM v7.2.1: Failed to decrypt with error: No key found in 0 PIDs tried.
    DeDRM v7.2.1: Looking for new default Kindle Key after 0.1 seconds
    Found k4Mac kinf2018 file: /Users/vidyasrinivasan/Library/Containers/com.amazon.Kindle/Data/Library/Application Support/Kindle/storage/.kinf2018
    Found k4Mac kinf2018 file: /Users/vidyasrinivasan/Library/Application Support/Kindle/storage/.kinf2018
    trying username b’vidyasrinivasan’ on file /Users/vidyasrinivasan/Library/Containers/com.amazon.Kindle/Data/Library/Application Support/Kindle/storage/.kinf2018
    trying IDString: b’3539ef4e1caf’
    Decrypted key file using IDString ‘3539ef4e1caf’ and UserName ‘vidyasrinivasan’
    trying username b’vidyasrinivasan’ on file /Users/vidyasrinivasan/Library/Application Support/Kindle/storage/.kinf2018
    trying IDString: b’3539ef4e1caf’
    [4.54] splash screen hidden
    [4.54] Started up in 4.54 seconds with 6 books
    Decrypted key file using IDString ‘3539ef4e1caf’ and UserName ‘vidyasrinivasan’
    DeDRM v7.2.1: Found 2 new keys
    MobiDeDrm v1.0.
    Copyright © 2008-2020 The Dark Reverser, Apprentice Harper et al.
    Decrypting Kindle Format 8 ebook: Why We Get Sick
    Got SerialNumber from database default_key_1
    Got UsernameHash from database default_key_1
    Got SerialNumber from database default_key_2
    Got UsernameHash from database default_key_2
    Found 5 keys to try after 0.9 seconds
    Crypto Type is: 2
    DeDRM v7.2.1: Ultimately failed to decrypt after 0.9 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.mobidedrm”, line 484, in processBook
    raise DrmException(“No key found in {0:d} PIDs tried.”.format(len(goodpids)))
    calibre_plugins.dedrm.mobidedrm.DrmException: No key found in 0 PIDs tried.

    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 0.9 seconds. Read the FAQs at Harper’s repository: https://github.com/apprenticeharper/DeDRM_tools/blob/master/FAQs.md

    • This book isn’t from Kindle for Mac. If it’s from or for an E-ink Kindle (not a Fire), then you need to enter the Kindle’s serial number into DeDRM’s customization.

  25. In light of the fact that development of these tools has moved on, I am closing comments here. For now I will leave the site otherwise unchanged. Thank you to Apprentice Harper and everyone else who has helped with this project.

    — Alf.

Comments are closed.