Category Archives: Books

Calibre, Amazon Books, DeDRM

I’ve been a big reader since I was a kid, all kinds of books from many sources. I was an early Kindle adopter, but as Android tablets came out I found them better for reading:

  • Configurable: you can set a wider variety of fonts, sizes, margins, colors, layouts.
  • Open: you can install any number of reading apps for every eBook format available. You’re not locked into any single book ecosystem.
  • Graphics: books with pictures, diagrams, etc. are much better on a tablet. Even a large eInk reader lacks color and renders slower.

Due to the variety of books I read, no single ecosystem would do the job. Plus, I take a principled opposition to any company that tries to lock customers into its ecosystem. When I buy a book I don’t believe I’ve bought it to read on a particular device, in a particular format, to access whenever some corporation thinks I should be able to. I’ve bought the right to read it on any device, in any format, whenever I want to, forever. Just like a real book. Indeed, eBooks often cost as much as real books even though the marginal cost of the next eBook sold is zero. And, I run native Linux on all my computers.

All of this all led me to start using Calibre to manage my eBooks. Calibre is simply great – it meets all these needs and more. It’s a great organizer, supports all devices, all formats, can convert between them, and has many plugins with an active open source development community.

Without owning a Kindle, how does one buy books from Amazon, store them on your own computer and read them on any device in any format? Here’s how:

Even though I run Linux, I have a VM running Windows. I don’t use it for much, only those few apps that I can run natively on Linux or in a browser. Unfortunately, Amazon Kindle is one of those. In this VM I have the Kindle for PC app registered to my Amazon account.

I’ll assume you already have Calibre running and you’ve installed Apprentice Alf’s DeDRM plug-in.

Next, do a one-time configuration step: capture the Kindle key from your Windows PC and copy it to Calibre so it can DeDRM Kindle books.

  • On Windows
    • Install Python 2.7 and Pycrypto 2.6 for Python 2.7.
    • Unzip the Calibre DeDRM plug-in ZIP file
    • In this zip, find the file
      • This zip file has several directories and files in it. In DeDRM_6.6.0, this file is here: \DeDRM_Windows_Application\DeDRM_App\DeDRM_lib\lib
    • Open a command prompt and run this file:
    • You’ll see something like this:
      • Using Library AlfCrypto DLL/DYLIB/SO
        searching for kinfoFiles in C:\Users\USERNAME\AppData\Local
        Found K4PC 1.9+ kinf2011 file: C:\Users\USERNAME\AppData\Local\Amazon\Kindle\storage\.kinf2011
        Decrypted key file using IDString ‘406xxxxxxx’ and UserName ’63xxxxxx’
    • It creates a new file: kindlekey1.k4i
    • Copy this file to a directory your Linux Calibre app can see
  • On Linux
    • Run Calibre
    • Click Configure, Plugins, File type plugins, DeDRM
    • Click Customize plugin
    • Click Kindle for Mac/PC ebooks
    • Click Import Existing Keyfiles
    • In the file dialog that pops up, pick your kindlekey1.k4i file

You’re done: Calibre DeDRM is configured to be able to DeDRM ebooks you drop on it, so long as they come from your Kindle for PC reader.

After I buy a book on Amazon, I deliver it to my Kindle for PC device.

  • In Windows:
    • Open Kindle for PC, refresh your library. The book should appear.
    • Double-click it to download it.
    • After the book opens, close it and the Kindle for PC app.
    • Open folder Users\USERNAME\Documents\My Kindle Content
    • Your book will be one of these folders named B….._EBOK
    • Sort by date to put the most recent files on top
    • Open the folder and you’ll see an azw file having the same filename as the folder.
    • Copy this azw file to a directory that your Linux Calibre can see.
  • In Linux
    • Run Calibre and drag/drop the azw file on it.
    • Calibre will strip the DRMs and add it to your library

You now own the book. It’s stored on your own hard drive, you can read it on your PC, convert it to any format you want, copy it to any device or app you want to use to read it.