This howto shows how to download eBooks using Adobe’s ADEPT DRM (Digital Rights Management) scheme on Linux and how to decrypt those books so that you can use your eBook viewer of choice to read them and copy them to any device you wish.
- To download content protected with ADEPT, we need the Adobe Digital Editions eBook viewer. Sadly there is no Linux version, so we need to run the Windows version with Wine. Get the Windows installer from here.
- Go to the folder where you downloaded the installer and run it with the command
wine setup.exe
After the installation, run Adobe Digital Editions straight from the installer or with the command
wine ~/.wine/drive_c/"Program Files/Adobe/Adobe Digital Editions/digitaleditions.exe"
- In order to access DRM-protected content, you need to “authorize” your computer using the Adobe ID. You can get the ID by creating an account at the Adobe website here. Then in Adobe Digital Editions select “Authorize computer…” from the Library-menu and enter the ID and password.
- Now we can actually download the book. For this we need a file with the .acsm-extension. This file contains the necessary information for Adobe Digital Editions to locate and download the book. You’ll probably get this file by clicking on the download link your eBook vendor provided. Save the file to disk. Now load the file by dragging its icon on the Adobe Digital Editions window. Adobe Digital Editions should now start downloading the book. After the download has finished, quit Adobe Digital Editions.
- The DRM-protected pdf- or ePub-file should now be located in the folder ~/My Digital Editions. Next, we decrypt the DRM scheme. For this, we’ll use two Python-scripts: the key retrieval script ineptkey.pyw and the decryption script ineptpdf.pyw or ineptepub.pyw (depending on the file format). Copy the scripts into the same folder with the book. Unfortunately, as these scripts are for Windows and OSX only, we’ll again have to use Wine. To run the scripts, we need the Windows version of Python (get it from here) and the cryptography package PyCrypto (from here). The Python version should be at least 2.6 (I use 2.7 here, newer versions might work as well). Make sure that the PyCrypto version matches the Python one. Run the installers with the commands
wine msiexec /i python-2.7.2.msi
and
wine msiexec /i pycrypto-2.3.win32-py2.7.msi
Now, go to the folder with the book and the scripts and run the first script with the command
wine ~/.wine/drive_c/Python27/python.exe ineptkey.pyw
This will create the file adeptkey.der in the same folder. Now, run the second script with
wine ~/.wine/drive_c/Python27/python.exe ineptpdf.pyw
or
wine ~/.wine/drive_c/Python27/python.exe ineptepub.pyw
In the dialogue select the book as input file and name the output file what you like. Click on “Decrypt.” - Voila! You should now have the decrypted pdf- or ePub-file in the ~/My Digital Editions folder.
one question: I have two Adobe accounts (one on MAC OS system, and one Linux system using wine, both on the same computer), is it possible to remove DRM of an epub acquired on Mac account using Linux/Wine account? or are the python srcipts somehow account specific ?
The first script retrieves the account-specific user key from the Adobe DE installation, so you need to run it on the same system you used to download the book. You should then be able to copy the keyfile (adeptkey.der) and the book over to the other system and do the actual decryption there using the second script. The same keyfile should work for all books downloaded with that account, so you only need to run the first script once per account.
not work for new pdf’s
thanks for this info. on my computer, even though I have installed
$ wine msiexec /i python-2.7.3.msi
$ wine msiexec /i pycrypto-2.3.win32-py2.7.msi
when I try
$wine ~/.wine/drive_c/Python27/python.exe ineptkey.pyw
I get the message
“This script requires PyCrypto, which must be installed separately. Read the top-of-script comments for details.”
Does that mean installing pycrypto requires something besides executing the MSI?
Note that ineptkey.pyw as written will not work with pycrypto-2.6.
To fix it, add the line
from Crypto import Random
below all of the “import” statements near the top.
Then, find the line that has the call to AES.new. Just before that line, add the following statement:
iv = Random.new().read(AES.block_size)
Then, edit the AES.new call to be:
userkey = AES.new(keykey, AES.MODE_CBC, iv).decrypt(userkey)
This is an excellent call. It fixes the key generation however on the next step launching the PDF script I get:
“Error: error decrypting book session key.”
Perhaps the ePub and PDF scripts need some tuning as well to read the generated file?
Hi rknop
Please i need your help in decryption this pdf
Thanks one trillion. Just bought 5 books and spent half an hour realising I had no way of reading them.
while decrypting it is throwing “Error: error decrypting book session key.” Please can you help?