Adobe created their own proprietary solution for digital rights management (DRM) of ebooks (unless you are on the kindle / Amazon side). Adobe’s solution is also used for the ebook library service, where you can borrow ebooks for a limited time and need to “return” the ebook. Adobe implements their DRM via their software “Digital Editions”, which is only available for Windows or Mac. Their solution is also integrated directly in most ebook readers.

However, their is no official solution for Linux. If you “buy” an ebook that is locked with DRM, you also need to buy additional hardware to be able to use what you just have purchased. The reason might be, that proprietary solutions are usually incompatible with the free (open) software world.

This post shows, how you can still purchase ebooks and use them under Linux.

Tools

We use Wine which is a compatibility layer that allows you to run Windows programs under Linux. It is essentially a free reimplementation of the Windows APIs. Wine will run the Windows version of Digital Editions. With that, we can activate a new device and download the purchased ebook. The ebook however is encrypted and can then only be read with Digital Editions on that device only. A backup of the ebook is useless without the encryption key.

The next tool is the DeDRM plugin for Calibre, a free ebook reader. With that, we can extract the encryption key from our Wine-based Digital Editions installation and decrypt the purchased ebook. This works for both PDF and EPUB formats.

This plugin uses Python, so we’ll need to install python in addition under Wine. And the DeDRM plugin needs pycryptdome.

Step by step: Installation

Wine has a application database, which collects information about the supported Windows programs. And there is an entry for Digital Editions: Adobe Digital Editions 4.5. In the additional comments section, there are the commands. I’ll repeat them here, how I did it:

  1. define a new wine environment (aka prefix)
    export WINEPREFIX=$HOME/.local/share/wineprefixes/ADOBE_DIGITAL_EDITIONS
    export WINEARCH=win32
    
  2. prepare the new prefix
    wineboot -u
    
  3. configure to use virtual desktop and windows version
    a) Graphics -> Emulate a virtual desktop: 1280x1024
    b) Applications > Windows Version: Windows 10
    c) Ok
    winecfg
    
  4. Install prerequisites for ADE
    # a) install dotnet
    winetricks dotnet40
    # b) install fonts otherwise Adobe Digital Editions will not display letters but white boxes
    winetricks corefonts
    
  5. Downloads…
    # a) ADE from https://www.adobe.com/de/solutions/ebook/digital-editions/download.html
    curl -L -o "$WINEPREFIX/drive_c/users/$USER/ADE_4.5_Installer.exe" https://adedownload.adobe.com/pub/adobe/digitaleditions/ADE_4.5_Installer.exe
    # b) Python from https://www.python.org/downloads/windows/
    curl -L -o "$WINEPREFIX/drive_c/users/$USER/python-3.13.0.exe" https://www.python.org/ftp/python/3.13.0/python-3.13.0.exe
    # c) pycryptodome from https://pypi.org/project/pycryptodome/#files
    curl -L -o "$WINEPREFIX/drive_c/users/$USER/pycryptodome-3.21.0-cp36-abi3-win32.whl" https://files.pythonhosted.org/packages/14/71/4cbd3870d3e926c34706f705d6793159ac49d9a213e3ababcdade5864663/pycryptodome-3.21.0-cp36-abi3-win32.whl
    # d) lxml from https://pypi.org/project/lxml/#files
    curl -L -o "$WINEPREFIX/drive_c/users/$USER/lxml-5.3.0-cp313-cp313-win32.whl" https://files.pythonhosted.org/packages/69/68/9f7e6d3312a91e30829368c2b3217e750adef12a6f8eb10498249f4e8d72/lxml-5.3.0-cp313-cp313-win32.whl
    # e) DeDRM from https://github.com/noDRM/DeDRM_tools/archive/refs/heads/master.zip
    curl -L -o "$WINEPREFIX/drive_c/users/$USER/DeDRM_tools-master.zip" https://github.com/noDRM/DeDRM_tools/archive/refs/heads/master.zip
    
  6. Switch directly to user’s home directory under Wine
    cd "$WINEPREFIX/drive_c/users/$USER/"
    
  7. Install ADE (just use the default options, e.g. install to C:\Program Files\Adobe\Adobe Digital Editions 4.5)
    You can exit ADE after that for now.
    wine ADE_4.5_Installer.exe
    
  8. Install python (Select “Add python.exe to PATH”, ignore the crash toward the end, see notes below)
    wine python-3.13.0.exe
    
  9. Extract and install pycryptodome
    # a) extract
    unzip -d pycryptodome pycryptodome-3.21.0-cp36-abi3-win32.whl
    # b) "install"
    export PYTHONPATH="$(winepath --windows "$WINEPREFIX/drive_c/users/$USER/pycryptodome")"
    
  10. Extract and install lxml
       # a) extract
       unzip -d lxml lxml-5.3.0-cp313-cp313-win32.whl
       # b) "install"
       export PYTHONPATH="$PYTHONPATH;$(winepath --windows "$WINEPREFIX/drive_c/users/$USER/lxml")"
    
  11. Extract and install DeDRM
       # a) extract
       unzip DeDRM_tools-master.zip
       # b) "install"
       export PYTHONPATH="$PYTHONPATH;$(winepath --windows "$WINEPREFIX/drive_c/users/$USER/DeDRM_tools-master/DeDRM_plugin")"
    

Keep your shell/terminal open… it contains 3 important environment variables: WINEPREFIX, WINEARCH and PYTHONPATH … These environment variables are necessary so that the wine command works correctly later on.

Notes:

Step by Step: Usage

All commands described are need to be executed in the same terminal as the installation steps above.

  1. Start ADE:
    wine "$WINEPREFIX/drive_c/Program Files/Adobe/Adobe Digital Editions 4.5/DigitalEditions.exe"
    
  2. Activate the device (menu Help > Authorize Computer) using your Adobe ID (or create a new one)
  3. Exit ADE
  4. Extract your key:
    cd "$WINEPREFIX/drive_c/users/$USER/DeDRM_tools-master"
    wine python -m DeDRM_plugin.adobekey
    
  5. You should have now a keyfile in the current directory named adobekey1_uuid_xxxxxxxxx_AdobeID_yyyy.der. This is the encryption key used for any DRM ebook you download via ADE.
  6. Purchase the DRM-locked ebook you want. You’ll receive a download link to an “ACMS”-file. Download this file and save it e.g. to “$WINEPREFIX/drive_c/users/$USER/” (the home directory under Wine).
  7. Start ADE again:
    wine "$WINEPREFIX/drive_c/Program Files/Adobe/Adobe Digital Editions 4.5/DigitalEditions.exe"
    

    Menu File > Add to Library. In the open file dialog, select file type “Adobe Content Server Message” and choose the ACMS file. ADE will now download your ebook and store it under in your documents (“$WINEPREFIX/drive_c/users/$USER/Documents/My Digital Editions”).

  8. Do the cleanup now (just so that you don’t forget to do it): Help > Erase Authorization… You only need the authorization for two things: get the decryption key and get the ebook.
    Exit ADE afterwards.
  9. Decrypt your ebook:

    cd "$WINEPREFIX/drive_c/users/$USER/DeDRM_tools-master"
    # for PDFs
    wine python -m DeDRM_plugin.ineptpdf
    # or for EPUBs
    wine python -m DeDRM_plugin.ineptepub
    

    Use the GUI to select the key file, the input file (PDF or EPUB) and the decrypted output file.

  10. Copy the decrypted ebook to your backup and to your reader.
  11. (Optional) You can delete the whole folder “$HOME/.local/share/wineprefixes/ADOBE_DIGITAL_EDITIONS” afterwards to save space/cleanup. Just make sure, you have already deauthorized your ADE, as otherwise you might run into the 6 devices limit, when trying to authorize a new installation in the future.

Notes:

  • The extraction of the adobekey with DeDRM_plugin.adobekey needs to run on the same device as the Adobe Digital Editions. The reason is, that the adobekey is encrypted once again with a Windows function called crypt32.CryptProtectData. This also takes some hardware id into account (CPUID0) to encrypt the adobekey and then store it in the registry. Wine supports this method, but as the implementation of protectdata.c says: “FIXME The true Windows encryption and keying mechanisms are unknown.”. As ADE runs with Wine and also the python DeDRM runs on the same Wine installation, CryptProtectData and CryptUnprotectData works. But you can’t extract the registry keys from a real Windows installation and decrypt it with Wine. Interestingly, the adept key under the Mac installation seems to be not protected and directly available in a file called activation.dat somewhere in the directory $HOME/Library/Application Support/Adobe/Digital Editions.

  • The download of the ebook via the ACMS file can only be done once. And the ACMS file is usually only valid for a couple of hours or one day. The ACMS file does not contain the book, it contains the information for ADE, from where to download it (after verifying the permissions/license).

Alternatives

This whole procedure is a workaround and if you can, avoid it. There are shops, that sell DRM free ebooks, e.g. Beam e-Books. There you don’t need to go through the hassle of decrypting what you have just purchased.

These alternatives might just use watermarks to make it visible, that the ebook has been purchased once by a specific person. This could help to trace back the book, in case it appears “in the wild”.

But sometimes, the book you need is unfortunately only available with DRM.

This is for me a gray area (note: I’m not a lawyer). But the DRM effectively prevents you from doing a backup. Although some say, that you don’t purchase the ebook itself (like you do when you buy a real book). You rather purchase the permission to read it, but it is not owned by you. By removing the decryption, I simply exercise the right to read the book under Linux. Which the DRM prevented. So?

I guess, the main reason why the DRM was invented is to prevent users from sharing the books freely in the wild. Fair enough - this is not legal. But as you see, these technical restrictions never work (as seen, you can remove this artificial technical restriction) and they prevent eligible persons from using ebooks. So in the end, they do more harm than they prevent.

Just to emphasize this again: While you can remove the DRM for your private books, your are not allowed to share these books. Ever. Removing the DRM is only for private use. You also can’t resell the ebook after you have read it - as you probably didn’t purchase the permission to do so in the first place. You also can’t borrow the ebook. The problem is: You cannot proof, that you deleted all your private copies of the book in your backups.

To avoid all these complications, try to purchase a ebook without DRM. You might still need to read the fine-print whether you are allowed to resell/gift it to someone or not.

Problems with Adobe ID

When you purchase something, you might want to use it still in a few years time. But that might not be possible with DRM-locked ebooks. E.g. you need to move the books to your new device, because the old device broke. You got new hardware. Etc. Now it’s on you to proof, that you once purchased these books (which might not even be available on the market anymore). Maybe the vendor, you purchased the book from doesn’t exist anymore. Or sometime in the future Adobe decides to discontinue their DRM service and suddenly all your ebooks are stuck on the devices they are currently on. Until these devices are broken. Then you lost your library.

With the Adobe ID, you can authorize (activate) up to 6 devices. However, you don’t have a central overview how many devices you have activated, which devices, etc. For me, I could still authorize this Wine-based ADE. That means, I didn’t max out the device count. In order to be able to authorize the Wine-based ADE in the future, I immediately deauthorize it after I’m done with downloading a new ebook. Since I remove the DRM immediately, I could even use the DRM without an Adobe ID (anonymous mode) or just create a new Adobe ID for every purchase.

The main problem with DRM is, that it is not anymore in my control, where I can read my ebooks. I am one person only, I can only read one book at a time. There is no possibility whatsoever, that I can read the same book at the same time more than once (I’m not a multi tasker) even if I have multiple copies (backups). We don’t need a technical solution for a problem that doesn’t exist. The problem, that DRM tries to solve, arises only, if I would share my books with other persons. Which is forbidden anyways.

Other alternatives

While researching a bit and using the correct search terms (like “reverse engineering” and “ADEPT”), I found a couple of interesting resources. Since Adobe Digital Editions is not available for Linux, you need to go through the hassle as described above. But someone already implemented a linux-only version of all this that avoids to use ADE but talks to the Adobe servers directly to sign in, authorize a device, download a ebook.

Summary

It is a hassle to read DRM-locked ebooks under Linux, but there is still a way to do this. If possible, always try to find a DRM-free version of the ebook you want - it saves you the trouble.

Given the libgourou reverse engineered library, it would be interesting to re-implement this in a Java library - just for the fun of it.