Thursday, November 25, 2010

Apprentice Alf's DeDRM AppleScript for Mac OS X 10.5, 10.6

E-books that you buy are usually encrypted with "Digital Rights Management," or DRM. DRM is copy protection; it's intended to keep you from making a copy of your book and letting someone else have it.

But DRM can interfere with uses of the book that are legal. Some of the books I have bought in the Adobe EPUB format, for instance, can't be moved to my iPhone for reading — unless, that is, I strip off the DRM encryption first.

I showed how to do that in an earlier post, iPhone: Reading Adobe/EPUB eBooks. It's a complicated set of steps. Now there's a way that is less complicated.

Unfortunately, the new way is available only to users of Mac OS X 10.5 ("Leopard") and 10.6 ("Snow Leopard") but not to users of any Windows system. That's because DeDRM, as its author Apprentice Alf named it, is in the AppleScript scripting language.

Apprentice Alf, who wrote DeDRM, has gone into retirement, and his original blog post about it has been modified and no longer links to the DeDRM 2.6 download per se. You can instead download tools v3.8 ZIP file from here. It contains DeDRM 2.6. The link I just gave will take you to RapidShare, where you need to click on the Download button under Save File To ... your computer. A popup window will require you to wait a couple of minutes and then click on a second Download button. Then the actual download will begin. It will normally (depending on how you have your browser set up) put the tools file on your Desktop. Double clicking that file will expand the ZIP file into a tools v3.8 folder. Open the folder. A DeDRM 2.6 AppleScript "droplet" should be the top item. Option-drag it to the Desktop to make a copy of it there. You can then (after possibly doing the setup I describe below) drag the icons of e-book files that you want decrypted and drop the icons on the DeDRM 2.0 droplet to have the e-books decrypted.

After you put the DeDRM 2.6 droplet on your desktop, you will see something like:

I took that screenshot when using an older version of DeDRM; the current version is DeDRM 2.6. What I describe below pertains to version 1.1, but it remains about the same in later versions.

I'll assume you'll leave/put the DeDRM 2.6 icon on the desktop, but you can optionally move it to any folder you like.

To use DeDRM, you'll simply drag an e-book file's icon over to the DeDRM icon, and drop the e-book's icon there. You can also drag the icon of a folder that contains more than one e-book, and DeDRM will decrypt them all. The decrypted e-book(s) will show up in the same folder as the original e-book(s) are in.

Before you start dragging and dropping e-books, though, some setup may be required. (If you want to bypass it and just try your luck now, skip down to Using DeDRM.)

Optional Setup

Double-click on the DeDRM icon to see:

When you click Continue, you'll see:

You can click None for this dialog ... unless you have Kindle e-books in the Mobipocket format from In that case, you can enter the necessary PIDs (Personal IDs) for your Kindle device(s) here, clicking Add after each one. (How to learn what those PIDs are is a topic beyond the scope of this post.)

If you, like me, want to bypass Mobipocket PID specifications for now, just click None. You can always re-launch DeDRM as a standalone application, using the double-click method, and enter Mobipocket PIDs later.

You'll now see something like:

You can enter, one at a time, any Name:Credit_Card_Number "key pairs" you use to buy e-books at Barnes & Noble or, and click Add. Once you have entered them all, you will click on the No More button which has replaced the None button.

Each key pair represents:

  1. the name on your account at Barnes & Noble online or on
  2. the number on the credit card registered for that account.

These two items must be entered with a colon (':') — but with no spaces or other characters — between them. If the card number is for an eReader account, you can opt to enter just the last eight digits of the card number. If it is for a B&N account, you will need to enter the whole 16-digit card number.

If you don't want to enter any Barnes & Noble or key pairs, just click None in the dialog box above.

Next you'll see:

The intention here is for you to specify any adeptkey.der key files that you may have generated previously. These are key files that, again, you may have generated using a Python script,, as shown in Step 4 of iPhone: Reading Adobe/EPUB eBooks. If you do happen to have any previously generated adeptkey.der key files, you can use the Add... button at this point to tell DeDRM about them, one by one.

But you don't really need to specify any previously existing adeptkey.der key files! DeDRM can generate the "local" ADEPT key file you need on the fly for you.

ADEPT stands for Adobe Digital Editions Protection Technology, by the way.

The only time you'll need to specify your own existing adeptkey.der key files is in a situation where you in fact have some older Adobe EPUB e-book files lying around, ones that were downloaded when you were using a different Adobe ID/Password combination than you currently use.

For purposes of this post, I'll assume all your Adobe EPUBs were downloaded (possibly using Sony's Reader Library application) with an Adobe ID/Password combination that is still current. So all you have to do in the dialog box above is click on No More. At that point, the DeDRM script merely quits.

Using DeDRM

Now you're ready to use the DeDRM script for real. I suggest you consider moving or copying the DeDRM "droplet" icon to a folder you've created, named something like DeDRM Folder. Alternatively, you can leave the DeDRM "droplet" icon right on your desktop.

The next step is to locate in your Mac's folder hierarchy any Adobe EPUB e-book file that you want to strip DRM from:

  • If you got the file via the Sony Reader Library application, it's in ~/Documents/My Books/Reader Library/{book title}.epub. (The '~' node stands for the Home folder of the user account you are using on the Mac.)
  • If you obtained the Adobe EPUB online in any other manner and then imported it into the Adobe Digital Reader application, you can expect to find it in ~/Documents/Digital Editions/{book title}.epub.
  • If your Adobe EPUB e-book can be found in neither of those two locations, you can probably locate it by doing a Finder filename search on the book's title.

You might want to make a copy of the Adobe EPUB in your DeDRM Folder folder (or, alternatively, on the desktop, if that's where your DeDRM "droplet" icon is) by dragging its icon to that location while holding down the option key.

Using a copy of the adobe EPUB is not, strictly speaking, necessary. However, DeDRM will produce its decrypted output copy in the same folder location (possibly the desktop) as the location of the input original Adobe EPUB that you drop onto the DeDRM icon. So if you want the decrypted version to be created in a more convenient folder location than ~/Documents/My Books/Reader Library/ or ~/Documents/Digital Editions/, it's best to work with a copy that you have previously established in the desired output location.

Now drag the copied Adobe EPUB e-book's icon onto the DeDRM icon and drop it there. DeDRM will open. After a brief delay, you should see something like:

Click Thanks. DeDRM goes away. It's that easy!

If the input file was called The Snake, the Crocodile, and the Dog.epub, as above, an output file called The Snake, the Crocodile, and the Dog_dedrmed.epub will appear in the same folder (possibly, the desktop). The filename will be that of the original file with _dedrmed added. The filename extension will continue to be .epub.

The output file is just like the input file — except that it's no longer copy-protected. It can be read in any application or on any device that can read "open" (i.e., non-DRMed) EPUB e-books:
  • Stanza for the Mac or Windows
  • Reader Library for the Mac or Windows
  • Adobe Digital Editions for the Mac or Windows
  • Any iPad/iPhone/iPod Touch app that reads EPUBs, including Stanza, Kobo, and Borders
  • etc.
You can also read it in the iBooks app on an iPad/iPhone/iPod Touch. To do that:
  • Import the open EPUB file into iTunes by dragging it into the Library portion of the main iTunes window
  • With the open EPUB now visible in the Books section of the iTunes library, sync your iPad/iPhone/iPod Touch
The open EPUB will now appear in the Library of the iBooks app on the iPad/iPhone/iPod Touch!

You can use a similar procedure to use DeDRM to remove DRM encryption from:
  • PDB files that you obtain from Barnes & Noble or online
  • Mobipocket e-books, such as those from
  • Amazon Kindle e-books — provided they're not in the dreaded Topaz format! (You can open your Kindle e-book in TextEdit and look for the characters TPZ0 near the top. If they're there, the book is Topaz and you'll need more powerful mojo to decrypt it.)
Wonderful, no?

Saturday, August 28, 2010

iPhone as eReader, Part Deux

In my earlier iPhone as eReader article I talked about four iPhone apps that let you read e-books:

  1. Kindle for iPhone
  2. Stanza
  3. eReader
  4. B&N eReader (now discontinued)

Since then a lot has changed:

B&N eReader has been replaced by the free nook for iPhone app from Barnes & Noble. This app allows owners of the Nook, B&N's rival to Amazon's Kindle — as well as non-owners of Nooks — to read Nook e-books on their iPhones.

There is a new app from Apple, iBooks for iPhone. It's the iPhone app you need to use to buy e-books from Apple's iBookstore, an arm of its iTunes Store.

Kobo is another new e-reader app. It lets the iPhone read e-books meant for the new $149.99 Kobo eReader device being sold at Borders stores in the U.S. That device supports open ePUB, open PDF, and Adobe DRM e-book formats.

The Borders iPhone app is, as far as I can tell, exactly like the Kobo app except in minor details.

All of these apps are available (often in separate versions for the two devices) for the new Apple iPad, not just the iPhone.

Thursday, August 12, 2010

Turning Amazon Kindle DRM'ed eBooks into iBooks

I have an iPhone 3GS. The iBooks app on it allows me to read e-books in the open EPUB format. In earlier posts such as Turning DRM'ed PDB eBooks into iBooks, iBooks♥B&N: Let's Get Ignoble!, iPhone: Reading Adobe/EPUB eBooks, and Breaking Adobe DRM — Tips, Tricks, Workarounds I talked about how to remove the Digital Rights Management encryption for various types of e-Books (those in the eReader PDB format; those in the Adobe-encrypted EPUB format used by Barnes & Noble; those in the Adobe-encrypted EPUB format used by Adobe Reader software) so that they can be read on an iPhone or an iPad.

Now I've discovered how to do the same for e-books from the Amazon Kindle Store.

Click on this image ...

... to read how I did it for Kindle books I'd purchased somewhat earlier for use in the Kindle app on the iPhone. They still work in that app, of course, but I want all my e-books in iBooks so I don't have to keep track of which e-books are where!

The same basic procedure should work in the future if I buy more Kindle e-books.

The procedure is geared toward Mac users. The Skindle app that decrypts the e-books runs on Windows, meaning that I have to run Windows in Parallels Desktop for the Mac, available here. As far as I know, there is no equivalent on the Mac platform to Skindle for Windows.

If you have a Windows platform, the basic procedure still works — with fewer complications! You will need Skindle (available here) and calibre (available here), to go with Amazon Kindle for PC (K4PC), available here. When you follow the procedure linked to by the image above, some of the steps which are intended to bridge between the Windows/Parallels and Mac environments drop out. Instead of running calibre in the Mac environment, you will run it in Windows. Ditto, iTunes.

Be aware that Skindle Version 06 works with K4PC Version 1.2.0 (30413) and possibly with some earlier K4PC versions. Amazon has in the past modified its DRM for new versions of K4PC such that decrypters like Skindle no longer work ... until their authors revise them for the new K4PC version!

Thursday, July 29, 2010

Turning DRM'ed PDB eBooks into iBooks

Suppose you, like me, have e-books that you've purchased and downloaded in the PDB format, also known as the eReader format, and now you'd like to read them in iBooks on your iPhone. If they're copy-protected using DRM, no dice ...

... unless you decrypt them first.

(Warning: decrypting a DRM-protected e-book, thereby removing copy protection and other forms of access control, is a violation of the law ... even if the decrypted copy is never shared with others. Sorry about that.)

eReader2html is a Python script that does exactly that. You can view and download the eReader2html Python script here. Then you can use it on your Mac OS X platform — as well as on Windows and other platforms — to turn your PDBs into HTML files. (My platform is Mac OS X 10.5.8 "Leopard.")

You can then read the HTML version in any web browser ... or you can use calibre to turn it into an EPUB for use in iBooks. More on calibre later.

Don't know how to read Python code? Never mind ... just click on the Download button. Your browser (mine is Safari) will put the downloaded script file into whatever folder it is set to put downloads into, using the filename f1fc790cb.txt. If, for you, the folder does not land on the Desktop, you should move the downloaded file manually to the Desktop. Then, for comprehensibility, you should click on the f1fc790cb filename and change it to eReader2html. (The original filename extension, .txt, remains.)

Now open Terminal (it's in the Utilities folder) and type the command python, followed by a space. Drag the icon of the eReader2html.txt file into the Terminal window and hit Return. You should see something like:

iMac:~ eric$ python ~/Desktop/eReader2html.txt 
eReader2Html v0.03. Copyright (c) 2008 The Dark Reverser
Converts eReader books to HTML
  ereader2html infile.pdb outdir "your name" credit_card_number 
  It's enough to enter the last 8 digits of the credit card number
iMac:~ eric$ 

If you get an error message indicating that the python command is unknown, you probably need to install the Python interpreter. Make sure the optionally installed Apple Developer package is present on your Mac.

If you already, at the outermost root level of your Mac's folder hierarchy, have a folder called Developer, you're fine — and something else must be wrong. Post a comment to this blog entry, and I'll try to help you.

If Developer is not there, create it by inserting your OS X 10.5 Install DVD and navigating to and then double-clicking Mac OS X Install DVD:Optional Installs:Xcode Tools:Xcode Tools.mpkg. You will be led, by the installer program which opens, through the necessary steps to install the Developer Tools package, thereby creating the Developer folder.

Once you have a Developer folder, try invoking python again in Terminal. If that works, try python ~/Desktop/eReader2html.txt again.

Now do something like:

iMac:~ eric$ cd ~/Desktop
iMac:Desktop eric$ python eReader2html.txt "The Lost Symbol.pdb" "The Lost Symbol HTML" "Eric Palmer Stewart" 4264********0937
eReader2Html v0.03. Copyright (c) 2008 The Dark Reverser
Processing... done
iMac:Desktop eric$ 


  1. Before I did this, I'd made a copy on my Desktop of my original The Lost Symbol.pdb file as downloaded from To do this, I'd dragged the icon of the original file to the Desktop with the Option key held down.
  2. I'd also created an empty folder, The Lost Symbol HTML, on my Desktop.
  3. eReader2html.txt, the Python script file, was also sitting on my Desktop.
  4. To enter commands in the Terminal command line, I simply typed them in. If I made a mistake, I used the Delete key to back up over (and erase) some or all what I'd previously typed, and then I retyped it correctly.
  5. First, I typed cd , followed by a space. (A space needed to be typed in after each part, other than the last part, of each command line.)
  6. Then I typed ~/Desktop and hit Return. That caused the first command to be executed.
  7. The first command, cd ~/Desktop, made the Desktop the "active" directory in Terminal. Later on, when I executed my main command, any non-"qualified' references to files and folders would implicitly point to the Desktop.
  8. In that first command, ~ represented the current user's (my own) Home folder, so ~/Desktop represented the Desktop of the current Mac OS X user: me.
  9. After cd ~/Desktop was executed, the prompt on the next line in the Terminal window changed to iMac:Desktop eric$. , since eric represents the short name of the current user at the time, me.)
  10. The main command line began when I typed in python, followed by a space.
  11. I then typed in eReader2html.txt, followed by a space. That was to tell Terminal to find the eReader2html.txt Python script file sitting in the currently active directory, i.e., the Desktop.
  12. I next typed "The Lost Symbol.pdb", in double quotes, followed by a space. This was the name of the input PDB file, sitting on my Desktop.
  13. The filename was enclosed in double quotes so the embedded spaces wouldn't cause confusion. If I didn't like the typing-filenames-in-double-quotes method, then instead I could simply have dragged the file's icon from the Desktop to the Terminal window at the point when I would ordinarily have typed in the argument — following the manually typed-in space character, mind you — resulting in /Users/eric/Desktop/The\ Lost\ Symbol.pdb. This is the so-called "fully specified path to the file." It has \ characters strewn within it to tame the included embedded spaces. No enclosing double quotes are necessary.
  14. I next typed "The Lost Symbol HTML", in double quotes. It pointed to the empty The Lost Symbol HTML folder, sitting on the Desktop, where I wanted the output of eReader2html.txt to go.
  15. Again, I could simply have dragged the folder's icon from the Desktop into the Terminal window, following my manually typed-in space character, to enter the fully specified path to the folder, /Users/eric/Desktop/The\ Lost\ Symbol\ HTML, into the command line.
  16. I next typed "Eric Palmer Stewart",  in double quotes. It was the name under which I had purchased the original PDB version of the original The Lost Symbol.pdb e-book from My "your name" specification had to be capitalized in the exact same way as on my account.
  17. Finally, I typed in 4264********0937. No double quotes were needed, since there were no internal spaces, dashes, etc. It was the 16-digit number on the credit card that I used to buy the The Lost Symbol.pdb e-book from I have obfuscated the middle eight digits here, but what I actually typed in in Terminal was the correct credit card number in its entirety. I could alternatively have entered just the final eight digits****0937 — without obfuscation, of course — instead of the whole 16-digit number.

It took a few minutes for Processing... done to appear in the Terminal window. Once the processing was done, my The Lost Symbol HTML folder contained:

The Lost Symbol HTML folder's contents
(click to enlarge)

The book.html file is the main item. The .png files are graphic elements, most of which are illustrations from the book. cover.png is an image of the book's cover:

The Lost Symbol Cover Image
from cover.png
as seen in Preview

I double-clicked book.html, and the whole book, graphics and all, opened for inspection in my Safari browser:

The Lost Symbol HTML folder's book.html file
open in a Safari window
(click to enlarge)

Instead of turning pages, I was able to use the scroll bar to slide vertically through the book.


Now it's time to use calibre to convert the HTML into an EPUB:

Open calibre (website here; download page here; online manual here).

(Click on this and the other screenshot images to enlarge them.)

Click on the Add Books icon.

Navigate to and open the book.html file.

Wait a minute for the Adding... window to disappear.

Make sure the e-book you just added is highlighted.

Now, since calibre won't necessarily use the cover.png file, you can give the e-book you just added a cover:

Click on the Edit Metadata icon.

Click on the Download cover button in the Edit Meta Information window, and after the cover downloads, click OK.

Verify the downloaded cover in the Edit Meta Information window, then click OK.

Verify the downloaded cover in the main window.

Now you can convert the e-book to an EPUB:

Click on the Convert Books icon.

When the Convert (your e-book name) window appears ...

... choose Output format: EPUB, then click OK to dismiss the Convert (your e-book name) window.  

In the main window, wait a minute for the spinning progress icon next to Jobs: 1 to stop spinning.

Now, with Jobs: 0 again, the main window looks like this.

Click on Click to open to reveal the EPUB file in the Finder ...

...and (in this example) the new EPUB file is shown as The Lost Symbol - Dan Brown.epub.

Next, import the EPUB file into iTunes by dragging it into the Library, as per this movie:

(You can play a larger version of the movie in QuickTime by clicking on the image above. You can also just position your mouse pointer on the image above and use the scroll wheel to move through the movie.)

The EPUB is now visible in the Books section of the iTunes library:

To copy it into iBooks on your iPhone or other iDevice, connect the iDevice to your Mac, and it will automatically sync. If it's already connected at the time you import the EPUB into iTunes, just highlight the iDevice on the left side of the iTunes window and click on the Sync button at lower right:

Now the EPUB shows up in your Library in iBooks on the iDevice:

Very neat!

Tuesday, July 20, 2010

iBooks♥B&N: Let's Get Ignoble!

ignoble is the moniker that I♥CABBAGES has chosen for his tools to decrypt e-books from Barnes & Noble that are in the EPUB format. This post by him tells generally how to use these tools. Herein, I show how to do that on a Mac running OS X 10.5 "Leopard."

First, some background information. B&N sell e-books here. For purposes of making my post more concrete, later on in this post I'm going to buy and decrypt the e-book version of Stieg Larsson's The Girl with the Dragon Tattoo, which is the first of (currently) three books in the author's Millennium Trilogy Series. The books in Larsson's series are among the most popular e-books around, and presently you cannot buy them in Apple's iBookstore. So one of the things I'll be doing in this post is showing how to use ignoble to decrypt that B&N e-book so that it can be imported into an iBooks library.

What is iBooks? It's the main e-book reader app for Apple's new iPad, and it also works on iPhones and iPods that run the new iOS 4.0 operating software. Using iBooks, you can buy e-books at the iBookstore, part of Apple's familiar iTunes Store. However, Apple has failed to line up iBookstore support from the largest publishing concern, Random House. Hence a huge number of e-book titles are missing from the iBookstore!

That's presumably why Larsson's books are absent. Their absence is not intolerable for those who are OK with, using their iDevice, switching between iBooks and the B&N eReader app, available for free at the iTunes Store. But then they have to remember which books are in which apps — not fun! In this post I'll show how to move your B&N downloads into iTunes and hence into iBooks.

Here's what you have to do to get and use ignoble:

• Get a Python interpreter

For the Mac platform, you do not need to download Python at all, as Python 2.5 (which works fine for purposes of ignoble) can be installed from the "Leopard" install DVD.

Even though Python 2.5 is part of the Mac OS X software package, in order to use it you do need to make sure the optionally installed Apple Developer package is present on your Mac. If you already, at the outermost root level of your Mac's folder hierarchy, have a folder called Developer, you're fine. If not, create it by inserting your OS X 10.5 Install DVD and navigating to and then double-clicking Mac OS X Install DVD:Optional Installs:Xcode Tools:Xcode Tools.mpkg. You will be led by the installer program which opens through the necessary steps to install the Developer Tools package.

• Get PyCrypto, the Python cryptography toolkit

Go here and click on the "Download" button for PyCrypto 2.0.1. The pycrypto-2.0.1.tar.gz file you'll receive will most likely land right on your Desktop (depending on how you have your browser configured for downloads; if it doesn't download right to the Desktop, you can just move it there). Upon being double-clicked, the pycrypto-2.0.1.tar.gz file expands into a pycrypto-2.0.1 folder, also on the Desktop. You can move this folder wherever you like, or leave it right on the Desktop.

Next, click here to download, which, when unzipped — which will probably happen for you automatically — expands into an AppleScript app called PyCrypto_2.0.1_Installer. Double-click PyCrypto_2.0.1_Installer to run the installer itself. It will ask you to navigate to and "Choose" your pycrypto-2.0.1 folder, the one you created in the preceding paragraph of these instructions. Once you have clicked "Choose," PyCrypto_2.0.1_Installer will open a window in the Mac's Terminal application and execute some Unix commands in it.

The first time you use the PyCrypto_2.0.1_Installer, the Unix commands will produce a large amount of output in the Terminal window, due to the fact that the PyCrypto software is, for the first time on your computer, undergoing a full "build." Any subsequent times you use PyCrypto_2.0.1_Installer, an "install" without a preliminary "build" will be done, and you will see less output in the Terminal window. In either case, the final line of the Terminal-window output should say Writing /Library/Python/2.5/site-packages/pycrypto-2.0.1-py2.5.egg-info.

At this point you can quit Terminal. If you look in Finder — starting at the root-level directory, not at the Home folder for your user account — and navigate to /Library/Python/2.5/, you should find a site-packages folder. In it there should now be a Crypto folder and a pycrypto-2.0.1-py2.5.egg-info file.

• Get the any-platform key-generation script, ignoblekeygen

ignoblekeygen is a Python script that will generate, and save to a file, a Barnes & Noble EPUB user key derived from your name and credit card number.

Before you download this script, create a folder on your Desktop called ignoble. In Finder, click on the Desktop and type Command-Shift-N. A new folder appears with the name untitled folder highlighted for editing. Type ignoble to replace that generic name, and hit Return.

Open the Safari web browser and type Command-, (Command-comma). In the Preferences window that opens, click on General at top left. In the Save downloaded files: popup, choose Other... . In the File Open dialog which appears, navigate to and select the ignoble folder you just created. Click on the red close button at the upper left of the Preferences window.

Now, go here to download the ignoblekeygen script. This is a page at, and in the upper right corner is a Download link. Click on it. A downloaded file called will appear in your ignoble folder. (If Safari's Downloads window remains open at this point, click on the red close button at the upper left of the window to close it.)

Rename the file To do that, double-click on the ignoble folder to open it in Finder, then click twice (but do not do the second click too fast, or it will cause a double-click) on the filename The main part of the filename, pastie-753985, will be highlighted. Type ignoblekeygen in its place and hit Return. This will cause the name of the file to become

Now right-click on the file. In the resulting popup menu, select Open With: Build Applet (default).

If you do not see that option in the popup menu, chances are you do not in fact have Python installed on your Mac. Go back to the first step of this post to see how to install it.

If you see multiple Build Applet choices, choose the one whose version number begins with 2.5.

When you select Build Applet, you may see a warning dialog, "" is a script application which was downloaded from the Internet. Are you sure you want to open it? Click Open.

After you have run Build Applet — which takes only a second, after which Build Applet disappears — an application file called ignoblekeygen appears in your ignoble folder.

• Run ignoblekeygen

Double-click the ignoblekeygen application file (not itself). You will see:

Click on the ... button to the right of the Output file field. Type bnepubkey.b64 (or use any other filename you prefer, but make sure you use the .b64 extension) into the Save As: field of the window that appears, then navigate to your ignoble folder and click Save. The Output file field will now contain a fully qualified path name to the key file that is about to be created in your ignoble folder.

Now type your name and credit card number into the appropriate fields. The name should be the one on your account at Barnes & (If you don't yet have a B&N account, click here to set one up.) Likewise, the credit card number you enter should be the one you are using for your B&N account.

Forgotten those details? If you sign in at B&N and then click on the My Account link, you'll see, under PERSONAL INFORMATION just above your e-mail address, the name you specified for your B&N account. You need to make sure that you use that name exactly in Ignoble EPUB Keyfile Generator. For example, if it contains your middle initial on the B&N website, then be sure to use the middle initial for Ignoble EPUB Keyfile Generator.

Under PAYMENT SETTINGS on the website you'll see Default Payment and, beneath that, ****nnnn, with nnnn representing the last four digits of your credit card number. Type the name on your account into the Name field of Ignoble EPUB Keyfile Generator, and the full 16-digit number of your credit card (without spaces or dashes) into the CC# field. Then click on the Generate button to generate the key file (by whatever name you have chosen to give it).

After you have done that, click on the Quit button. You only have to run the Ignoble EPUB Keyfile Generator once ... unless you have multiple B&N accounts, that is, in which case you should generate one key file for each, and the filename you enter in the the Output file field should be different for each — for example, bob's B&N key.b64 and mary's B&N key.b64.

The Ignoble EPUB Keyfile Generator saves your name and credit card number in its output key file in encrypted form, so no one who inspects the contents of the key file will be able to steal the information.

• Get the any-platform book-decryption script, ignobleepub

ignobleepub is a Python script that will use the key file just generated to decrypt any encrypted B&N EPUB e-book.

Go here to download the ignobleepub script. This is a page at, and in the upper right corner is a Download link. Click on it. A downloaded file called will appear in your ignoble folder. (If Safari's Downloads window remains open at this point, click on the red close button at the upper left of the window to close it.)

Rename the file To do that, double-click on the ignoble folder to open it in Finder, then click twice (but do not do the second click too fast, or it will cause a double-click) on the filename The main part of the filename, pastie-751366, will be highlighted. Type ignobleepub in its place and hit Return. This will cause the name of the file to become

Now right-click on the file. In the resulting popup menu, select Open With: Build Applet (default).

If you do not see that option in the popup menu, chances are you do not in fact have Python installed on your Mac. Go back to the first step of this post to see how to install it.

If you see multiple Build Applet choices, choose the one whose version number begins with 2.5.

When you select Build Applet, you may see a warning dialog, "" is a script application which was downloaded from the Internet. Are you sure you want to open it? Click Open.

After you have run Build Applet — which takes only a second, after which Build Applet disappears — an application file called ignobleepub appears in your ignoble folder.

• Buy and download a Barnes & Noble EPUB e-book

I'm going to buy Stieg Larsson's The Girl with the Dragon Tattoo, which at the moment of this writing costs a reasonable $7.16 as a B&N e-book. To do that, I go to the webpage for that book and (having already signed in) click on the BUY NOW button. A dialog box appears in which I need to confirm my order. I click on the Confirm button. A "Thank You for Your Order" page appears, on which I click the Go to Your eBooks Library link.

On my My eBooks Library page there now appears:

I click on the  Download Now  .   button. That causes Safari to download the file 9780307272119_Stie_TheGirl.epub into my ignoble folder. (Close the Safari Downloads window manually at this point if you desire.)

The filename extension, .epub, indicates that this file is indeed an EPUB. B&N used to sell e-books with a .pdb filename extension. That outdated so-called "eReader format" does not work with ignoble. It cannot easily be converted for use with iBooks.

Tip: If you have e-books that you downloaded some time ago from B&N, go to your e-books library and re-download the books. Click here, then sign in, then click on the  Download Now   button next to each e-book you want to re-download in turn. The newly downloaded copy of each book will very likely have an .epub extension and will therefore work with ignoble. If you like, you can trash the old .pdb versions. Likewise, if you are using a Nook or any mobile device (such as an iPhone) with the B&N eReader app, you can and probably should re-download your legacy .pdb e-books that are already on that device, so that you will have up-to-date .epub versions on the device instead.

• Decrypt your e-book

To convert 9780307272119_Stie_TheGirl.epub, I just double-click on ignobleepub (not the original script, in my ignoble folder, and I see:

Using the ... button next to the Key file field, I navigate to and select the bnepubkey.b64 key file I generated earlier, using ignoblekeygen.

Using the ... button next to the Input file field, I navigate to and open 9780307272119_Stie_TheGirl.epub from my ignoble folder.

Using the ... button next to the Output file field, I navigate to my ignoble folder and enter Girl Decrypted.epub as the output filename. It does not really matter what output filename I use ... but I must be sure to specify the .epub filename extension.

To see what the full contents of the three fields are, I drag the resize corner at lower right of the window rightward, to see:

Now I click the Decrypt button and quickly see:

Unless I want to buy and decrypt another e-book, I click Quit to exit the ignobleepub application. At any future time I can buy more B&N e-books, download them, and use ignobleepub all over again to decrypt them. I do not have to run ignoblekeygen again, unless of course I have misplaced my bnepubkey.b64 file.

At this point, I have a file called Girl Decrypted.epub that is no longer encrypted, so iBooks can use it. I now have to ...

• Import the Decrypted E-Book into iTunes

I simply drag the Girl Decrypted.epub file onto the LIBRARY area at the top left of my main iTunes window (click image to enlarge it):

This causes The Girl with the Dragon Tattoo to be imported into the Books area of iTunes (click image to enlarge it):

Behind the scenes, iTunes has copied the e-book into a /Books/StiegLarsson/ folder it creates in the folder structure of my iTunes library (click image to enlarge it):

The filename is The Girl with the Dragon Tattoo.epub. iTunes has figured out what the actual title of the book is, along with the author's name!

This all happens in part because I have used the following iTunes Advanced Preferences (click image to enlarge it):

You may need to type Command-, (Command-comma) while in iTunes, click on the Advanced icon at top right, and click on the check marks for Keep iTunes Media folder organized and Copy files to iTunes Media folder when adding to library, if you haven't already done so.

Notice that after I imported my e-book into iTunes, its cover image showed up automatically in Cover Flow view. That doesn't always happen. If you end up with a missing cover image, you can ...

• Manually Give the E-Book a Cover Image

First, go back to the B&N page from which you purchased your e-book. In my case, it was The Girl with the Dragon Tattoo.

Now, click on the cover image you see there, bringing up a new window with a larger version of the cover image.

Right click on the larger cover image and choose Copy Image from the pop-up menu that appears.

Now, switch to iTunes and, with the new e-book selected in the Books portion of the Library (here, my e-book already shows its cover image, but never mind )...

... type Command-I to bring up its Get Info window. Then click on the Artwork tab, to see:

Now, click in the empty artwork box — it's empty even though my cover image was already visible in my main iTunes window — and type Command-V to paste into it the cover artwork that presently is residing on the Clipboard, in order to see:

Click OK to dismiss the iTunes Get Info window. A few seconds later, the new cover artwork appears in the main Tunes window (replacing the cover image, if any, that was already visible there).

Now you're ready to ...

• Sync your iDevice to iTunes

Your iPad, iPhone, or iPod Touch will generally be synced to iTunes automatically, each time you connect it to your Mac. Syncing books requires iTunes version 9.2 or later. But syncing doesn't necessarily include e-books, unless you (click image to enlarge it) ...

... have Sync Books checkmarked in the iDevice's Books tab, as I do here. I've likewise checked Selected books rather than All books, so only the e-books that I've put individual checkmarks by are going to get synced to my iDevice. Notice The Girl with the Dragon Tattoo is shown at lower left of the Books pane, and it does have a checkmark by it. So when I click on the Sync button, at lower right of the window, I expect it (and all other checkmarked books) to be synced to my iDevice.

And that is exactly what happens in iBooks on my iPhone:

Here's my e-book actually being read in iBooks:

You can read more about iBooks, the free app from Apple that runs on iOS 4.0 iDevices — iPad, iPhone 3GS, iPod Touch — in my iBooks Cook! post.

The iBooks app itself can be downloaded here.

Apple offers this iBooks: Frequently Asked Questions (FAQ) to fill you in on the basic capabilities of iBooks.

If you read that FAQ, notice that there is no mention of any ability to read iBooks e-books right on your Mac, in iTunes or in any other app, even though the e-books reside within the iTunes library. For B&N books that you have decrypted according to the procedure herein given, you can just open them in the B&N eReader app for your Mac, available here.

Unfortunately, I know of no way to read, on your Mac, e-books (other than those that are not DRM-encrypted) from the iBookstore.

• What about Windows?

Windows users can also use ignoble, but installing Python and PyCrypto requires a different strategy.


If you use Windows you can currently get Python version 2.6, which you can download and install in Windows by going to the
 Python download page and then clicking on (as of this writing) the hotlink to Python 2.6.4 Windows installer. (There is also a version 3.1, but I can't guarantee it will work with this procedure.) You'll download a file called python-2.6.4.msi which you'll proceed to double-click, and then you'll follow the installer's on-screen prompts that allow you to install the Python 2.6 package in a directory the installer creates,C:\Python26. The actual app within that folder is called python.


Windows users can obtain PyCrypto
 here (on that page, click on the link to pycrypto-2.0.1.win32-py2.6.exe). After downloading the .exe file, double-click on it to run the Setup Wizard. As long as you have already downloaded and installed Python as detailed above, the Wizard (after you click "Next >" on the introductory panel) will indicate Python 2.6 has been duly found in the Windows Registry, in C:\Python26\. The Wizard will accordingly use the subfolder C:\Python26\Lib\site-packages\ as its installation directory. After you click on "Next >" once more, you will see a "Ready to install" panel. Click "Next >" yet again to actually perform the installation. Then click "Finish" to exit the Wizard. You should now be able to locate a Crypto folder and also a pycrypto-2.0.1-py2.6.egg-info file in C:\Python26\Lib\site-packages\.

Notice that Windows users are going to be using Python version 2.6, not 2.5 as on a Mac. As far as I know, this is not a problem.

There will also be different OS-dependent mechanics involved with downloading, installing, and using ignoblekeygen and ignobleepub. I'm not going to go into detail on all of those mechanics, but I will give some hints.

After downloading the two Python scripts, you need to arrange for them to have the filenames ignoblekeygen.pyw and ignobleepub.pyw, respectively. Notice that the filename extensions in each case are .pyw, with a "w" at the end. The "w" stands for "Windows." It allows you to do the following ...

When you want to run, say, ignoblekeygen, you right-click on ignoblekeygen.pyw and select Open With: python to designate the python.exe app (which in turn is "hosted" by the cmd.exe interface, whose window, though empty, appears behind that of the Python script's user interface). Or, if you instead select Open With: Choose Program ... , you can check "Always use the selected program to open this kind of file," and then select python and click "OK." From then on, you will be able to double-click any Python script file whose filename extension is .pyw, and it will automatically open in python.exe.

• What about Mac OS X 10.6 "Snow Leopard"?

I myself have yet to upgrade to Mac OS X 10.6, so I don't have hands-on experience with "Snow Leopard." You will have to take what I say with a grain of salt ...

Based on comments that users have made to my iPhone: Reading Adobe/EPUB eBooks post, which involves using similar Python scripts from I♥CABBAGES to decrypt e-books that have Adobe DRM, it is my understanding that the instructions I gave above basically work on Snow Leopard, except ...

... some Snow Leopard users have had trouble with installing PyCrypto, the Python Cryptography Toolkit. The basic problem has to do with Snow Leopard's use of two Python versions. Version 2.5 is the one that you need to use to run the two Python scripts, ignoblekeygen and ignobleepub, that my instructions call for.

Some users of Snow Leopard have been finding that the PyCrypto installer is putting PyCrypto in


That is the wrong place! The right place for it is


Solution: after installing PyCrypto as per the procedure above, simply copy all of the contents of the


folder to


In Finder, you can do this by highlighting all of the items contained in the Python 2.6 /site-packages/ folder and dragging them with the option key held down to the Python 2.5 /site-packages/ folder. (Be aware that you may have to create the latter folder manually in the /Library/Python/2.5/ folder.) This option-drag procedure makes a copy in the destination /site-packages/ folder of all of the highlighted items.

Among the items that need to be highlighted and copied in this way are a folder called Crypto, along with all of its contents, and a file called pycrypto-2.0.1-py2.5.egg-info. You should check to make sure that these items and (in the case of the Crypto folder) their contained items get properly copied. If the latter file is named pycrypto-2.0.1-py2.6.egg-info, you should change the name to pycrypto-2.0.1-py2.5.egg-info manually.

Once you have manually copied the PyCrypto installation folder/files to where they need to be, I believe the remaining steps in the procedure above should work.

Well, that's about it for now. Happy iBooking, everyone!