View Full Version : ePub & PDF decryption on Mac OSX


edembowski
08-22-2009, 01:05 PM
I did a test today to see if this is possible, and I was very pleased with the results. I've looked around and I haven't seen anyone post about this, so I thought I would mention it in case there are other Mac users who need to do this. You won't need to install python (it's already there) but you will need to install PyCrypto. Here are the steps:

Prerequisites:
A Windows PC
A Mac PC
inept[epub|pdf] on each platform, with PyCrypto installed
Adobe Digital editions on each platform, authorized to your email address

1. From the Windows PC (It can be a virtual machine) setup Adobe DE, and extract the 'adeptkey.der' using ineptkey.pyw. I tested this with the current version and 'ineptkey_v3.pyw'.
2. Copy the key to your Mac, into your 'Documents' folder.
3. Rename the '*.pyw' files to '*.py'.
4. Double-click the python script, it will create an applet. Open the applet and use the key from your Windows box. I've tested using 'ineptepub_v2'.

From this point, it's exactly like using the inept tools under windows. The only thing missing on a Mac is the key extraction. This will let you buy ePub books from stores like Sony and use it on your PRS500.

- Ed

Abecedary
08-23-2009, 11:01 AM
Thanks for getting me to revisit this. I took a few stabs at it before, but didn't get very far. I installed the pycrypto modules on OS X (had to install the developer tools first, natch), and I can get the ineptepub.py script to run, but I have to do it from the command line ('python ineptepub.py'). For some reason I can't get it to simply be a clickable applet/script. I've fiddled with the settings in the Python Launcher, but no go. Did you change any of the settings there, or did it all just work right once you had the necessary components? It seems to work fine once I get it launched, but getting it launched is a minor nuisance (better than firing up the VM, though). Again, thanks for the tips!

Abecedary
08-23-2009, 11:20 AM
I take that back. Everything isn't working fine after I decrypt. For some reason, after unzipping all the files come out with 000 permissions on all of them. Easy enough to fix, but it's still one more thing that needs to be done. Are you running into this, edembowski?

adullday
08-23-2009, 06:11 PM
You can run shell scripts by double clicking them by using the .command extension.

Make sure that the first line of the script points to the proper interpreter. e.g. for python on the Mac it would look like:

#!/usr/bin/python

Then change the extension (for a gui'd python it would probably be .pyw) to .command. Run

chmod +x mypythonscript.command

just to make sure it's executable. Now you should be able to run it by double clicking.

Dragging and dropping files on the icon are a wee bit more complicated, and might require the use of an applescript.

edembowski
08-23-2009, 06:58 PM
@Abecedary
After unzipping them, you may have to fix the permissions from the command line, I didn't have that problem. You can always `chmod rwx`the file. The shebang is probably correct on it already, it's easy to put there. (the shebang is the first line adullday pointed out starting with #!)

@adullday
I usually change the extension to .py, not .command. It avoids a few problems:
- If you change it to .py, you don't need to worry about the execute bit being set.
- If you use .command, it will launch in a terminal window.
- It will not create an applet package.

Both methods certainly work, I just think using .py is easier for non-unix types.

- Ed

new
08-23-2009, 08:46 PM
Thanks for getting me to revisit this. I took a few stabs at it before, but didn't get very far. I installed the pycrypto modules on OS X (had to install the developer tools first, natch), and I can get the ineptepub.py script to run, but I have to do it from the command line ('python ineptepub.py'). For some reason I can't get it to simply be a clickable applet/script. I've fiddled with the settings in the Python Launcher, but no go. Did you change any of the settings there, or did it all just work right once you had the necessary components? It seems to work fine once I get it launched, but getting it launched is a minor nuisance (better than firing up the VM, though). Again, thanks for the tips!
developer tools? Which version of python do you have? pycrypto which version? This is confusing to me :D

adullday
08-23-2009, 09:51 PM
@Abecedary
Both methods certainly work, I just think using .py is easier for non-unix types.

- Ed

You're right. .py is much easier.... I hadn't realized that python scripts would start from the gui. I've been spending way too much time on the command line. :smack:

pthwaite
08-24-2009, 09:39 AM
Hmm,
I can't seem to get pycrypto to install & because I have Windows in a VM environment, the .py or .pyw always tries to start windows. I can't get it to stop the latter and I don't quite see why pycrypto doesn't install. It gets upset with something called gcc.:chinscratch:

Still, it'l give me something to play with. It took a while to get it working on the VM machine.

Howard

adullday
08-24-2009, 10:10 AM
What's the error message you're getting when you try to build the package?

And... you've probably tried this already... but if you open up the info window in the Finder for the .py and .pyw files, what comes up as the default application? (I'm guessing here.... I'm an avid VMware user on Linux and Windows, but my Mac is a powerbook so I'm not familiar with the workings of MacIntel virtualization.)

adullday
08-24-2009, 10:11 AM
Hey pthwaite... just a thought.... have you installed the Developer Tools from your MacOS X dvd's?

Abecedary
08-24-2009, 10:20 AM
Yep, first step before installing pycrypto is to install the OS X Developer Tools off the DVD. After doing that, pycrypto builds and installs just fine. I was able to change some of the preferences for Python Launcher to get the ineptepub.py file to launch with a double-click (but it now has a white console window behind the ineptepub GUI). Still, it's working! I'm sure I'll sort out the few minor issues with time.

pthwaite
08-24-2009, 02:16 PM
Adullday et al,
Thanks, I've just installed the tools so we shall see what happens now.
WRT the .py association, yes its the VM Windows one. However I have modified that to the MAC Python launcher but am unsure as to whether that is the right one.

pthwaite
08-24-2009, 02:37 PM
Okay, minor update.
Tools installed.
I think the pycrypto has now installed, the test programme doesn't appear to leave any errors.

Now I still have my file association issue. The launcher does indeed open the terminal which I then have to drop all the bits into to get it to run. Irritating really as before I involved windows it used to work quite happily but I cannot seem to get the Mac python to just run the flipping script.


Ah, to coin a phrase, "Peace and love everyone". DRM goes fizz. Now if only I can get the script to associate properly

new
08-24-2009, 04:10 PM
Since Pycrypto looks like .exe only on the install website, does this mean I can't use it? I have a Windows computer, and a Mac computer. I do not have Windows on my Mac. Does this mean I can't do this?

JSWolf
08-24-2009, 04:46 PM
Since Pycrypto looks like .exe only on the install website, does this mean I can't use it? I have a Windows computer, and a Mac computer. I do not have Windows on my Mac. Does this mean I can't do this?
http://mac.softpedia.com/get/Development/Libraries/PyCrypto.shtml

http://tmrc.mit.edu/mirror/twisted/Dependencies/Mac/PyCrypto-2.0.1_py2.5_osx10.5.pkg PyCrypto 2.0.1 for OS X 10.5

Try either one of those.

new
08-24-2009, 05:11 PM
http://mac.softpedia.com/get/Development/Libraries/PyCrypto.shtml

http://tmrc.mit.edu/mirror/twisted/Dependencies/Mac/PyCrypto-2.0.1_py2.5_osx10.5.pkg PyCrypto 2.0.1 for OS X 10.5

Try either one of those.

Thanks JSWolf! I did install the second one. Do I still need to install the developer tools? Supposedly this is on my original disks? Also Python is an older version on the Mac. I hope this will still work, as I read it is really a challenge to uninstall Python and install a newer version on the Mac.

I did install the Pycrypto (2nd link, I was going to just look at it, but it downloaded it, so I went ahead and installed). If this doesn't work with my Python, can I uninstall Pycrypto without problems?

Sorry I am new to using Mac for installing programs. :D

Thanks, and what is my next step I have the key from my Windows computer already.

JSWolf
08-24-2009, 06:37 PM
I would think you could uninstall PyCrypto. But I am not familiar with the MAC implementation.

edembowski
08-24-2009, 10:36 PM
I have the developer tools installed, but python should be there without them. If you open a whell and type `which python` you'll see.

new
08-25-2009, 02:16 AM
I have the developer tools installed, but python should be there without them. If you open a whell and type `which python` you'll see.
Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

pthwaite
08-25-2009, 09:25 AM
Yes, you need to install the developer tools.
I installed the tools then re-installed the pycrypto package as per the readme file instructions.
(ie from the Terminal, change to the directory where you downloaded the pycrypto files and type:
python (drag the setup file here without these brackets) install

That should the do it. You can then run it's test.

Howard

edembowski
08-25-2009, 01:18 PM
If you don't have your install media handy, you can always download the dev tools from Apple. You might need a 'Developer Connection' account, but that's free also.

- Ed

new
08-25-2009, 06:40 PM
This is all over my head. I have never done programming and don't understand dragging something to the terminal.

Can you please write instructions for dummies?

When I double click on the ineptpdf.py it just opens the file, it doesn't make an applelet. I am soooo lost.:help:

pthwaite
08-25-2009, 07:04 PM
I don't know what you mean by "just opens the file".

So far I generally:
1) open the terminal programme.
2) Open the Finder and get to where the inept???.py script is.
3) n the terminal programme, type the word "python"
4) Then from the open Finder window, select your inept???.py script and drag it into the terminal, immediately after the word "python " you just typed so you'd end up with something like:

Alpha:~ Alpha$ python /Users/Howard/Documents/ineptepub.py

That then runs the programme which will ask you for
where your key file is located (the .der file)
where the book you need to free up is located
where you wish to save the result and what you wish to call it

Howard

pthwaite
08-25-2009, 07:04 PM
Deleted duplicate

AprilHare
09-06-2009, 11:34 AM
Tiger users had better upgrade Python to the latest (2.6.2 worked here) http://www.python.org/
Note: latest Python needs to be installed before Pycrypto.

BookLoverToo
09-23-2009, 01:22 PM
Since upgrading to Snow Leopard, my pycrypto module no longer works, so I can't run the ineptepub.py script. When I do, I get an error stating that pycrypto needs to be installed, even though I have reinstalled it. I also reinstalled the developer tools. Anyone have any suggestions? Thanks in advance.

edembowski
09-23-2009, 03:30 PM
I haven't upgraded my machine yet, but if you recompile pycrypto you shouldn't have a problem. You can get the source from pycrypto.org.

- Ed

BookLoverToo
09-23-2009, 10:34 PM
I haven't upgraded my machine yet, but if you recompile pycrypto you shouldn't have a problem. You can get the source from pycrypto.org.

- Ed

Sorry, but I'm relatively new to Mac. How would I recompile it? Thanks again.

edembowski
09-25-2009, 09:00 AM
Sorry, but I'm relatively new to Mac. How would I recompile it? Thanks again.

Remember, Mac == Unix.

EDIT: Source tar ball available at http://www.amk.ca/python/code/crypto.html


Download the source using git:

git clone git://git.pycrypto.org:9419/crypto/pycrypto-2.x.git
(more information on git here: http://git-scm.com/)

From the readme:

Installation
============

PyCrypto is written and tested using Python version 2.1 through 2.6,
though support for Python 2.1 will be dropped soon. Python 1.5.2 is
not supported.

The modules are packaged using the Distutils, so you can simply run
"python setup.py build" to build the package, and "python setup.py
install" to install it.

If the setup.py script crashes with a DistutilsPlatformError
complaining that the file /usr/lib/python2.2/config/Makefile doesn't
exist, this means that the files needed for compiling new Python
modules aren't installed on your system. Red Hat users often run into
this because they don't have the python2-devel RPM installed. The fix
is to simply install the requisite RPM. On Debian/Ubuntu, you need the
python-dev package.

To verify that everything is in order, run "python setup.py test". It
will test all the cryptographic modules, skipping ones that aren't
available. If the test script reports an error on your machine,
please report the bug using the bug tracker (URL given above). If
possible, track down the bug and include a patch that fixes it,
provided that you are able to meet the eligibility requirements at
http://www.pycrypto.org/submission-requirements/.

To install the package under the site-packages directory of
your Python installation, run "python setup.py install".

If you have any comments, corrections, or improvements for this
package, please report them to our mailing list, accessible via the
PyCrypto website:

http://www.pycrypto.org/

You just need to `python setup.py build` and then `python setup.py install`.

- Ed

MelC
09-26-2009, 09:32 PM
Is there any chance the key extraction will ultimately be retrievable using Mac only? My mac is MS free and I don't have a separate windows computer.

Mel

BookLoverToo
09-27-2009, 08:40 PM
Ta Da!! Got it. Didn't use git in the end though. Problem was related to not having the directory set properly in terminal. Thanks for your help Ed!!

JSWolf
09-27-2009, 11:32 PM
Is there any chance the key extraction will ultimately be retrievable using Mac only? My mac is MS free and I don't have a separate windows computer.

Mel
In order to do that, the key retreval program would have to be rewritten to pull the key from OS X instead of Windows.

edembowski
09-29-2009, 08:35 AM
If you take a look at "$HOME/Library/Application Support/Adobe/Digital Editions/activation.dat" you'll find a very interesting file. It seems to hold keys in clear text and is not obfuscated in any way.

- Ed

pthwaite
09-29-2009, 02:31 PM
It is an interesting file isn't it. It would be nice to know how it compares with the ".der" file that is needed at present as that is "hidden".

H

joblack
09-29-2009, 06:23 PM
For installation use the Fink Project

http://www.finkproject.org/

With that small scripts and programs you can easily install a lot of GNU programs like python or pycrypto like

# apt-get install pycrypto

It's the packaging system from Debian Linux and was ported to a lot of different systems. It's most certainly easier than compile something else.

Btw. can somebody publish the file(s) from the Digital Editions/ directory. If you have personal information like emails you can x them (like xxxx@xxxx.com - or PM me).

pthwaite
09-30-2009, 03:36 PM
Oh well, here we go again. I'm trying to recompile the pycrypto for OSX 10.6 and after I download the source and do the build I get the following:

computer: pycrypto-2.0.1 Computer$ python setup.py build
running build
running build_py
running build_ext
building 'Crypto.Hash.MD2' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -Isrc/ -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/MD2.c -o build/temp.macosx-10.6-universal-2.6/src/MD2.o
unable to execute gcc-4.2: No such file or directory
error: command 'gcc-4.2' failed with exit status 1

Obviously it doesn't like something. Any idea what. It worked okay with Leopard?

regards

Abecedary
09-30-2009, 03:47 PM
Looks like it's not able to find gcc. Do you have the developer tools installed?

pthwaite
09-30-2009, 04:09 PM
Hello Abecedary,
Well, when I upgraded I told it to do the whole shebang. What's more I can see the GCC directories, however I'm in the process of re-installing just now, so we shall see in about 5mins.

regards

pthwaite
09-30-2009, 04:23 PM
Abecedary,
Well a re-install did the trick. the build comes up with a few minor errors but it appears to work. Runs the test anyway.

And, with edembowski's note and help from another, I'm all MAC based now. No Windows needed.

Thanks again folks

dazcox
10-09-2009, 08:56 AM
Any chance of a bit of help going OSX only?

Had a nightmare trying to get my Cool-er to authorise, so hit my max auths, adobe tech help are rubbish, so made a new adobe ID after exchanging the device which now works.

Sadly have a couple of e-books attached to my other ID, which I'd like to be able to read on the device.

Can't use my work PC as it's too locked down, and I cant get pycrypto to install (need the VC2008 redist, but windows installer service is screwed) so have to use my OSX machine.

adullday
10-09-2009, 10:44 AM
Any chance of a bit of help going OSX only?

Had a nightmare trying to get my Cool-er to authorise, so hit my max auths, adobe tech help are rubbish, so made a new adobe ID after exchanging the device which now works.

Sadly have a couple of e-books attached to my other ID, which I'd like to be able to read on the device.

Can't use my work PC as it's too locked down, and I cant get pycrypto to install (need the VC2008 redist, but windows installer service is screwed) so have to use my OSX machine.


Do you have a backup of your home directory made from the time when your other ID was active? If you have one, a restore of "$HOME/Library/Application Support/Adobe/Digital Editions/" should give you access to your old ebooks. If you use Time Machine it should be tucked away on the backup drive.

:eek: Be sure to backup the current "$HOME/Library/Application Support/Adobe/Digital Editions/" before you do anything or you might have to use another one of your authorizations to restore access to your current ebooks.

It's possible for Mac users to retrieve the key for use with I♥cabbage's python scripts, in fact it's easier, but it would be a violation of forum rules (darn that pesky DMCA) to post it here.

I sympathize with your experiences with Adobe Customer Support. It's horrendous. Just reading through their support forum for ADE is a laugh a minute--if you don't happen to be one of the posters needing help. There are a couple of Adobe staff members on the forums trying to do the job of the customer support staff (issues are submitted through web tickets which are usually ignored, or closed with bewildering excuses), but I imagine they must be overwhelmed.

I suspect that a lot of people wouldn't even bother trying to circumvent the DRM if Adobe's software and support were better.

JSWolf
10-09-2009, 01:58 PM
I suspect that a lot of people wouldn't even bother trying to circumvent the DRM if Adobe's software and support were better.
I still would as I want to be able to fix formatting issues. A lot of publishers cannot format to save their lives.

epstewart
10-19-2009, 01:34 PM
I would like to get someone's expert help on this. I'm trying to use the ineptepub.py script on my Mac running Leopard 10.5.8, and I have no clue what I'm doing when it comes to Python and Crypto.

I obtained the Python 2.6.2 for the Mac package (it seems to be called MacPython) and installed it by double clicking its .mpkg installer, resulting in a Python 2.6 folder in my Applications folder. This folder has a Python Launcher app, an IDLE app, a Build Applet app, an Update Shell Profile command file, and a folder of Extras. I am not sure if the actual Python interpreter is in there???

I also obtained what seems to be PyCrypto 2.0.1. The installer, pycrypto-2.0.1.tar.gz, expanded into a pycrypto-2.0.1 folder on my desktop. Here is where I start to get lost. The included README file says:

The modules are packaged using the Distutils, so you can simply run "python setup.py build" to build the package, and "python setup.py install" to install it.


Huh? Does that mean to run those commands in Terminal? In doing so, I figured I had to use the cd command in Terminal to change my current directory to the pycrypto-2.0.1 folder on my desktop. Then I entered python setup.py build and saw a raft of messages rolling by in my Terminal window. Though there were several "warning" messages, there didn't seem to be any errors. So I entered python setup.py install and got a handful of running ... messages, a lot of copying ... messages, and then:

running install_egg_info
Removing /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pycrypto-2.0.1-py2.6.egg-info
Writing /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pycrypto-2.0.1-py2.6.egg-info


I gather that means Crypto installed properly???

But now I try to run my ineptepub.py script -- it's on my desktop -- which I copied and renamed from ineptepub.pyw. Downloaded from the Web, it's the script version that starts out:

#! /usr/bin/python

# ineptepub.pyw, version 2

# To run this program install Python 2.6 from http://www.python.org/download/
# and PyCrypto from http://www.voidspace.org.uk/python/modules.shtml#pycrypto
# (make sure to install the version for Python 2.6). Save this script file as
# ineptepub.pyw and double-click on it to run it.

# Revision history:
# 1 - Initial release
# 2 - Rename to INEPT, fix exit code

"""
Decrypt Adobe ADEPT-encrypted EPUB books.
"""



I had to use Get Info in the Mac Finder to direct that double clicking on .py files should open Python Launcher rather than IDLE, which seems to be the Python development environment. After doing that, when I double click on ineptepub.py, I see an app called Python try to run the script but instead fail on an error message:

This script requires PyCrypto, which must be installed separately. Read the top-of-script comment for details.


I also saw a new window open up in Terminal, with the contents:

Last login: Mon Oct 19 12:23:16 on ttys002
[iMac:~] eric% cd '/Users/eric/Desktop/' && '/usr/local/bin/pythonw' '/Users/eric/Desktop/ineptepub.py' && echo Exit status: $? && exit 1



OK, so at this point I'm totally lost. I thought I installed PyCrypto, but now I'm being told I need to install PyCrypto.

Can someone please help me get this working? Thanks in advance ...

pthwaite
10-19-2009, 02:15 PM
I know exactly how you feel. Been there, been baffled by that & eventually got it figured out.

Mac comes with Python installed so you may not have needed to install the Python, but I don't suppose it will make much difference.

However, what you MUST do is ensure you have the optional development tools installed that come on the setup disks.
Just shove the setup disk in and you should see an option to install other bits and pieces.

Open it up and choose to install the development tools. I installed X11 just to make sure I got everything.

Once you have the tools installed, try re-installing the pycrypto package. It sounds like you've got your head around terminal to get to the correct directory. The pycrypto package also ha a test programme for you to see if it's installed again it's listed in the readme file and that should give you some confidence that you are winning.

Try the above first and see how you get on, I'm by no means the best to give much help on Terminal and unix as I have no experience of unix and associated commands and just do a best guess with the old DOS commands

Howard

adullday
10-19-2009, 02:26 PM
Without going through your exact steps, I'm taking a wild guess here, but it looks like the pycrypto library got attached to the built-in python (which is good), but when you double click on the script it's running itself using the python you installed (/usr/local/bin/pythonw).

Try running the script from a fresh Terminal window.
e.g.
/usr/bin/python /Users/eric/Desktop/ineptepub.py

epstewart
10-19-2009, 04:31 PM
I know exactly how you feel. Been there, been baffled by that & eventually got it figured out.

Mac comes with Python installed so you may not have needed to install the Python, but I don't suppose it will make much difference.

However, what you MUST do is ensure you have the optional development tools installed that come on the setup disks.
Just shove the setup disk in and you should see an option to install other bits and pieces.

Open it up and choose to install the development tools. I installed X11 just to make sure I got everything.

Once you have the tools installed, try re-installing the pycrypto package. It sounds like you've got your head around terminal to get to the correct directory. The pycrypto package also ha a test programme for you to see if it's installed again it's listed in the readme file and that should give you some confidence that you are winning.

Try the above first and see how you get on, I'm by no means the best to give much help on Terminal and unix as I have no experience of unix and associated commands and just do a best guess with the old DOS commands

Howard

Thanks, Howard. I probably should have mentioned in my original post that (based on posts in this very thread) I already installed the Developer tools. At first I hadn't done that, but after I did I reinstalled PyCrypto in the way indicated in my OP -- i.e., to my Desktop.

I'll answer you further in the process of responding to adullday below. Thanks again.

edembowski
10-19-2009, 04:33 PM
I would like to get someone's expert help on this. I'm trying to use the ineptepub.py script on my Mac running Leopard 10.5.8, and I have no clue what I'm doing when it comes to Python and Crypto.

pthwaite and adullday are right, you probably had Python installed already, and this confused things.


I obtained the Python 2.6.2 for the Mac package (it seems to be called MacPython) and installed it by double clicking its .mpkg installer, resulting in a Python 2.6 folder in my Applications folder. This folder has a Python Launcher app, an IDLE app, a Build Applet app, an Update Shell Profile command file, and a folder of Extras. I am not sure if the actual Python interpreter is in there???
I just got Python from python.org (it's 2.6.3). Yes, the interpreter is there. Here's a sample of what happens after installation:

lizard:build ed$ which python
/usr/bin/python
lizard:build ed$ which python2.5
/usr/bin/python2.5
lizard:build ed$ which python2.6
/usr/local/bin/python2.6
lizard:build ed$ ls -l /usr/bin/python
lrwxr-xr-x 1 root wheel 72 Mar 11 2009 /usr/bin/python -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python
lizard:build ed$


That's from a command prompt. What it's showing you is that python 2.5 and 2.6 are both installed. If you navigate to a python script in Finder and hit `get info`, you'll probably see that the default is to open with IDLE. That's Python's default development environment.

...Huh? Does that mean to run those commands in Terminal?
Yes, exactly.

In doing so, I figured I had to use the cd command in Terminal to change my current directory to the pycrypto-2.0.1 folder on my desktop. Then I entered python setup.py build and saw a raft of messages rolling by in my Terminal window. Though there were several "warning" messages, there didn't seem to be any errors. So I entered python setup.py install and got a handful of running ... messages, a lot of copying ... messages, and then:

running install_egg_info
Removing /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pycrypto-2.0.1-py2.6.egg-info
Writing /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pycrypto-2.0.1-py2.6.egg-info


I gather that means Crypto installed properly???
Yes, and pay close attention to the output. It's telling you that it's installing to the 2.6 installation, not the 2.5 (we're OK so far)


But now I try to run my ineptepub.py script -- it's on my desktop
...

I had to use Get Info in the Mac Finder to direct that double clicking on .py files should open Python Launcher rather than IDLE, which seems to be the Python development environment.

That's the default behavior for 2.6.

After doing that, when I double click on ineptepub.py, I see an app called Python try to run the script but instead fail on an error message:

This script requires PyCrypto, which must be installed separately. Read the top-of-script comment for details.


I also saw a new window open up in Terminal, with the contents:

Last login: Mon Oct 19 12:23:16 on ttys002
[iMac:~] eric% cd '/Users/eric/Desktop/' && '/usr/local/bin/pythonw' '/Users/eric/Desktop/ineptepub.py' && echo Exit status: $? && exit 1



OK, so at this point I'm totally lost. I thought I installed PyCrypto, but now I'm being told I need to install PyCrypto.

Can someone please help me get this working? Thanks in advance ...

This is where I think your problem is. The laucher is probably pointing to 2.5, and you have pycrypto in your 2.6 install. Try running it from the command line and see what happens.

edit: from the command line, try running python2.6 not python.

- Ed

epstewart
10-19-2009, 05:08 PM
Without going through your exact steps, I'm taking a wild guess here, but it looks like the pycrypto library got attached to the built-in python (which is good), but when you double click on the script it's running itself using the python you installed (/usr/local/bin/pythonw).

Try running the script from a fresh Terminal window.
e.g.
/usr/bin/python /Users/eric/Desktop/ineptepub.py

Thanks, adullday. When I ran

/usr/bin/python /Users/eric/Desktop/ineptepub.py


in Terminal I again got the error I mentioned in my first post. When I followed the advice I got from Howard in his post and ran

/usr/bin/python /Users/eric/Desktop/pycrypto-2.0.1/test.py


I got

Traceback (most recent call last):
File "/Users/eric/Desktop/pycrypto-2.0.1/test.py", line 18, in <module>
from Crypto.Util import test
ImportError: No module named Crypto.Util



It seems I have too many Pythons. I used

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder


in Terminal to make all my files show up in Finder. Then I went into /usr/bin/ and found various items whose names begin with python. Most are aliases. The original of the python alias is

/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5


Meanwhile, I've been able to discover that Crypto installed itself as

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Crypto


So I'm somehow using Python 2.5 instead of 2.6, which is where Crypto is!

I note that 2.5 is in the /System/Library/ hierarchy while 2.6 is in the /Library/ hierarchy.

Can one of you experts tell me how to correct this? Many thanks in advance ...


Eric

edembowski
10-20-2009, 08:13 AM
...
So I'm somehow using Python 2.5 instead of 2.6, which is where Crypto is!

I note that 2.5 is in the /System/Library/ hierarchy while 2.6 is in the /Library/ hierarchy.

Can one of you experts tell me how to correct this? Many thanks in advance ...


Eric



run python2.6 instead of python and you'll have it! read my post above!!

- Ed

pthwaite
10-20-2009, 10:07 AM
Yes, as edembowski says, if you read his last 2 posts, I think it should work then.
cheers, H

epstewart
10-20-2009, 01:22 PM
run python2.6 instead of python and you'll have it! read my post above!!

- Ed

Ed (and the others who have so kindly offered help in this thread),

Thanks, but I am not totally sure what you mean by running python2.6 from the command line. Could you give me the exact syntax I would need to run ineptepub.py from the command line using python2.6 instead of python? Because when I try

[iMac:~] eric% python2.6 /Users/eric/Desktop/ineptepub.py


from the command line, I still get my original error message:

This script requires PyCrypto, which must be installed separately ...


I can tell by inspecting the file usage of the Python process in Activity Monitor while the message is still being displayed that

/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python


is being used, meaning I'm really using the 2.6 version I installed. Entering the where python2.6 command, I see

[iMac:~] eric% where python2.6
/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6/usr/local/bin/python2.6



To prove Crypto is installed for Python 2.6:

[iMac:~] eric% ls -l /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
total 16
drwxr-xr-x 11 eric admin 374 Oct 13 16:02 Crypto
-rw-rw-r-- 1 root admin 119 Oct 2 01:58 README
-rw-r--r-- 1 eric admin 629 Oct 19 12:10 pycrypto-2.0.1-py2.6.egg-info


I must be missing something in my understanding, but the best I can tell, my Python 2.6 has the PyCrypto package duly installed in its hierarchy, but still it is unable to find it and use it when I run the ineptepub.py script using python2.6 in Terminal.

Furthermore, when I simply double click on ineptepub.py on my desktop, I get the same error message, Activity Monitor again shows that the Python 2.6 hierarchy is being invoked (not 2.5), and I see

Last login: Tue Oct 20 11:27:32 on ttys001
cd '/Users/eric/Desktop/' && '/usr/local/bin/pythonw' '/Users/eric/Desktop/ineptepub.py' && echo Exit status: $? && exit 1
[iMac:~] eric% cd '/Users/eric/Desktop/' && '/usr/local/bin/pythonw' '/Users/eric/Desktop/ineptepub.py' && echo Exit status: $? && exit 1



appearing in a new Terminal window that opens in response to my double click, but there is no new prompt in that window. Python's icon magically appears in my Dock. When I click on it and then click OK in the Python error-message window, the withheld prompt reappears in the Terminal window that has just opened.

Summarizing: I seem to have Python 2.6 properly installed, and PyCrypto duly installed within its folder hierarchy. When I invoke python2.6 /Users/eric/Desktop/ineptepub.py from the Terminal command line interface or when I double click the ineptepub.py icon on my Desktop, it is the 2.6 version of Python that starts up ... but that version is unable to satisfy the script's desire to use PyCrypto!

Ed and all you other experts: do you have any further things for me to try? Thanks incredibly much in advance ...

pthwaite
10-20-2009, 07:30 PM
It does look like your pycrypto install hasn't worked.
I'm afraid I have 10.6 and the structure is slightly different than 10.5, I have

Computers Hard Drive, Library, Python, 2.6, site-packages, Crypto

I did have a similar problem when I tried installing initially, I unzipped the pycrypto package but didn't use all the directories. eg:
When I unzipped it I ended up with:

pycrypto2.0.1, pycrypto2.0.1 and then the files.

I then moved all the files up a level before trying to install pycrypto and it didn't work. Re-created the structure as it unzipped and re-ran the installer and it then worked.

If you can't get the test file to run, it hasn't been installed correctly. Which isn't much help I'm afraid.

Your:
[iMac:~] eric% python2.6 /Users/eric/Desktop/ineptepub.py

is correct in its usage (at least it works for me) but not having 10.5 I cannot remember what I used to have. :(

epstewart
10-21-2009, 01:08 PM
Ed, Howard, et al.:

I went back to square one and deleted /Library/Frameworks/Python.framework/Versions/2.6/ on my system and then reinstalled Python 2.6 and then PyCrypto from their respective downloaded installers ... and everything is working fine now!

I can't be sure of this, but the problem could have had to do with my having renamed one copy of my installed pycrypto-2.0.1 folder, calling it Crypto. I did that because my examining the ineptepub.py script seemed to indicate that it wanted to find PyCrypto in a folder having the name Crypto. I was floundering around trying to see why the ineptepub.py script wasn't working originally, and thought I'd try that. But maybe it wasn't working for some other reason, which I managed to fix, but then it wouldn't work because I had renamed the folder. Before I did the re-installs, I deleted that folder, so the re-installs may have been superfluous.

Anyway, thanks for all your help.

Now that I'm up and running, I'd like to ask for some clarifications about how all this works. First, I note that the original post said to rename my .pyw files and change their extensions to .py. What was that for? What is the significance of the "w" which I had to strip away?

Two, am I correct in saying that I can't run on a Mac the script that creates the adeptkey.der file, that it has to be run under Windows? Why is that? It would seem to be a major drawback, since a lot of Mac users don't have access to Windows. (I happen to be able to run Windows under Parallels Desktop, so I was able to get around this problem.)

Three, in installing PyCrypto, the associated README file suggests there is a need to run python setup.py build and python setup.py install. I find (1) only the latter is needed; (2) after a successful install of Python 2.6, invoking python from the command line in Terminal in fact uses Python 2.6, which is good; (3) I had to include the full path to setup.py, i.e., /Users/eric/Desktop/INEPT/pycrypto-2.0.1/setup.py, by dragging the Finder icon of that file to the Terminal window. Does that square with your understanding?

Also, I'd like to mention my reason for using ineptepub: I read eBooks on my iPhone in the Stanza app, and I'd like to be able to borrow eBooks from the Maryland Digital Consortium, which includes all of Maryland's public libraries. These eBooks come in ADEPT/EPUB format (also ADEPT/PDF, but I'm not interested in that) and accordingly can't be used in Stanza or any other reader app on the iPhone — unless the DRM is stripped off!

Thanks again ...


Eric

pthwaite
10-21-2009, 04:36 PM
You can't run the script as it stands to get the adeptkey as it was written to extract it from windows and it is stored differently. See my PM
Howard

edembowski
10-22-2009, 05:47 PM
Ed, Howard, et al.:

I went back to square one and deleted /Library/Frameworks/Python.framework/Versions/2.6/ on my system and then reinstalled Python 2.6 and then PyCrypto from their respective downloaded installers ... and everything is working fine now!
...
Anyway, thanks for all your help. I'm very glad to hear that you're working now!

Now that I'm up and running, I'd like to ask for some clarifications about how all this works. First, I note that the original post said to rename my .pyw files and change their extensions to .py. What was that for? What is the significance of the "w" which I had to strip away?
The .pyw extension stands for 'Python for Windows' and it goes back to Microsoft's old limitation of 3 letter file extensions. The limit is no longer there, but it's kept that way for historical reasons. Macs (and Unix in general) uses .py

Two, am I correct in saying that I can't run on a Mac the script that creates the adeptkey.der file, that it has to be run under Windows? Why is that? It would seem to be a major drawback, since a lot of Mac users don't have access to Windows. (I happen to be able to run Windows under Parallels Desktop, so I was able to get around this problem.)
The key is stored in a plain text file in clear text. Howard's PM should sort you out.

Three, in installing PyCrypto, the associated README file suggests there is a need to run python setup.py build and python setup.py install. I find (1) only the latter is needed;
A dependency for installation is the file to install. The installer knows how to build it, so if you try to install without building, it will build automagically.

(2) after a successful install of Python 2.6, invoking python from the command line in Terminal in fact uses Python 2.6, which is good;
Your mileage may vary. I've done the install and it keeps 2.5 as the default python. Maybe there's a preference pane that controls it, I haven't checked.

(3) I had to include the full path to setup.py, i.e., /Users/eric/Desktop/INEPT/pycrypto-2.0.1/setup.py, by dragging the Finder icon of that file to the Terminal window. Does that square with your understanding?
I've never tried dragging things to the terminal window, it seems fishy to me. From the shell, I just `cd` to the right directory and take it from there.

- Ed

epstewart
10-23-2009, 11:22 AM
Ed,

I'm very glad to hear that you're working now!

Thanks.

The .pyw extension stands for 'Python for Windows' and it goes back to Microsoft's old limitation of 3 letter file extensions. The limit is no longer there, but it's kept that way for historical reasons. Macs (and Unix in general) uses .py

Makes sense!

The key is stored in a plain text file in clear text. Howard's PM should sort you out.

It did. I have been PM'ing back and forth with him in an effort to get the necessary commands working in my Terminal shell, and I have also asked adullday for his permission to incorporate the commands in an AppleScript script that I would make available to one and all through a blog post. If all that works out, then the script would be capable of putting an adept_key.der file for the user in whatever folder the Mac user designates.

A dependency for installation is the file to install. The installer knows how to build it, so if you try to install without building, it will build automagically.

So that's why I found doing the build before the install was unnecessary!

Your mileage may vary. I've done the install and it keeps 2.5 as the default python. Maybe there's a preference pane that controls it, I haven't checked.

It may be desirable at some point for someone to figure this out, since it is a possible pitfall for the unwary and uninitiated. I also found that I had to manually change what gets opened for a double-click in Finder on a .py script file: Python Launcher, not IDLE. (For lurkers: this is done by doing Get Info for a .py file and selecting Open with: Python Launcher, and optionally clicking the Change All ... button if you want the behavior to apply to all .py files.) Also, the Preferences pane for Python Launcher needed to be changed to uncheck Run in a terminal window. Otherwise, every time a .py script is double-clicked, Python Launcher is invoked and in turn fires up Terminal needlessly. Of course, if you are using the command-line interface in Terminal and not Finder double-clicks, you can circumvent all such concerns.

I've never tried dragging things to the terminal window, it seems fishy to me. From the shell, I just `cd` to the right directory and take it from there.

Actually, one way to 'cd' to the right directory is to enter 'cd ' and drag the folder for the directory from Finder to the Terminal window. It is a matter of personal preference whether a user wants to pollute the purity of the CLI by doing so, admittedly.

Thanks for all your help, Ed.


Eric

kjk
10-23-2009, 12:18 PM
It did. I have been PM'ing back and forth with him in an effort to get the necessary commands working in my Terminal shell, and I have also asked adullday for his permission to incorporate the commands in an AppleScript script that I would make available to one and all through a blog post. If all that works out, then the script would be capable of putting an adept_key.der file for the user in whatever folder the Mac user designates.


This would be awesome :D

MrKrueger
10-23-2009, 12:57 PM
I'm having a problem that I haven't seen mentioned yet. It's probably something on my end not set up right, but..

I've updated Python to 2.6 and installed PyCrypto, and all of that seems to be running fine. But whenever I run the ineptepub script, it goes fine until I press the decrypt button after choosing all of the appropriate files. When I press decrypt, it pops a message saying...

Error: File name in directory "

Exactly like that. I can't seem to figure out where my problem is on this. Any ideas?

tlrowley
10-23-2009, 01:37 PM
Wow, I came here to post that exact problem. I can decrypt in my Windows VM. I've verified the .der file is the same whether created on Windows or Mac. I've re-downloaded the files on the Mac (instead of copying from the VM). But nothing works. If I use the epub file that I downloaded in the VM and the .der file I created on the Mac, but do the decrypt on the Mac, it works, but that kind of defeats the purpose in getting this running on the Mac. I'm running python 2.6.1 on Mac OSX 10.6.1.

It seems that files that are downloaded on the Mac never work for me, only the files downloaded from Windows. Looking at the files in a hex editor (one epub downloaded in the VM, one downloaded on the Mac), they differ near the very end and that's where the problem lies. ADE on the Mac will read the file, but the decrypt fails.

Suggestions?

adullday
10-23-2009, 01:59 PM
This may or may not be your problem, but I've run into similar issues with several epubs. Since I usually download my files on my Mac, I don't know whether or not this is an issue particular to the files distributed to the Mac. But what the heck... try this and see if it works....


Make a copy of your epub and rename the epub extention to zip (you might have to do a cmd-I and change it from the info window).
Double click the renamed file so that the MacOS unzips it. Do not use the unzip command in the Terminal application.
Use pdurrant's script from http://www.mobileread.com/forums/showthread.php?t=55681 (or the zip command from the same link) to recreate the epub.
Try the inetepub.py script again.


It appears that there is an issue related to the zlib library, although it may be a problem in the zip file itself since the built-in de-zippifier on Windows seems to have the same issue. If you unzip the epub (which you may know is a zip file with the epub extension) with the MacOS built-in and re-zip it should (hopefully) work fine.

MrKrueger
10-23-2009, 02:12 PM
That was exactly the problem and the fix worked wonders. Thanks for much for that.

This whole process for doing this solely on a Mac definitely needs to be streamlined, but at least it does work without needing a Windows machine(real or virtual) at all.

tlrowley
10-23-2009, 05:50 PM
Okay, MrKrueger, you've got to stop posting exactly what I was going to say :D

Thanks, very much, adullday, the unzipping/rezipping fixed my problem, too.

One more thing I can do Windows-free!

ETA - To follow-up, I just bought 2 epubs (not available in US Kindle store). One decrypted without intervention, but the second required unzipping/rezipping, then it worked fine.

Thanks!

pthwaite
10-24-2009, 04:18 AM
Oh happy days, as the song goes...

Trubu
10-24-2009, 07:37 PM
De-lurking to say thanks to everyone for a very helpful thread - especially pthwaite for timely assistance with one of the trickier bits of this whole process.

epstewart
10-25-2009, 12:40 PM
This would be awesome :D

OK, I have made an AppleScript script that can generate an ADEPT Key in an adeptkey.der file (or a file by any other name the user chooses) on a Mac OS X platform. You can download this script's .zip file from

link removed

This is a script in the form of an application called ADEPTKey_Generator_1.1a. To use it, un-zip the ADEPTKey_Generator_1.1a.app.zip file to retrieve the script app. Then double click on the script app's icon. A standard "Where should I put the ADEPT key output file?" dialog will appear. You can Save As: any file name (default is adeptkey.der) to any folder (default is Desktop).

The script then uses "shell script" UNIX code provided by one of the participants in this thread to generate a "private key" that is saved in the ADEPT key output file and then can be used by the ineptepub.py Python script to decrypt downloaded ADE books.

ADEPTKey_Generator_1.1a should not be used until the user has (1) created an Adobe account online using a web browser and then (2) authorized that account in Adobe Digital Editions on the Mac. It requires that a ~/Library/Application Support/Adobe/Digital Editions/activation.dat file be present in the user's home folder hierarchy. Activating/authorizing the ADE account causes that file to be created.

Also, if more than one user have ADE accounts, the most recent one authorized is the one ADEPTKey_Generator_1.1a will use in generating the ADEPT Key.


Edited on 12/4/2009 to refer to ADEPTKey Generator 1.1a, which is now compatible with Mac OS X 10.6 "Snow Leopard." The previous version of this script application, 1.1, generated an error condition in S.L. The reason apparently was that S.L. expects a script app to be not an "application" per se but what was called an "application bundle" by the Mac OS X 10.5 "Leopard" Script Editor. I had saved it as a plain "application." Apparently, if the same source code is saved, in Script Editor under S.L., as an "application," the result is the same as an "application bundle" under Leopard. Under S.L., there is no option to save as an "application bundle" any more. I am running Leopard at this time, not S.L., so I can't actually test that.

joblack
10-26-2009, 05:43 PM
Can you also publish the source code?

Xenophon
10-27-2009, 02:12 PM
@epstewart:

I find that your script doesn't like output folders that have spaces in their names. Can you fix?

Xenophon

epstewart
10-28-2009, 12:53 PM
Can you also publish the source code?

I have sent you a PM linking to the source code.

Cheers,
Eric

epstewart
10-28-2009, 01:00 PM
@epstewart:

I find that your script doesn't like output folders that have spaces in their names. Can you fix?

Xenophon

Thanks for pointing out the bug. Here is a link to a fixed AppleScript app:

link removed

This one lets you have spaces in the folder names in the path to the output file and in the name of the output file as well. It also defaults to putting the output file on your Desktop instead of in the Documents folder, though you can still select any folder location your prefer.

Cheers,
Eric

ChristopherTD
10-28-2009, 07:00 PM
I have run the Applescript kindly prepared here and generated a adeptkey.der file.
When I run ineptepub.pyw I get an error along the lines of:

File name in directory "OEBPS/robe_978_oeb" and header "OEBPS/xxx.jpg" differ.

Is this because the adeptkey is wrong, or a symptom of something else?

tlrowley
10-28-2009, 07:13 PM
This sounds exactly like the problem I was having a few days ago. The solution that worked for me was to unzip/rezip as described in message #60 (link here (http://www.mobileread.com/forums/showpost.php?p=635378&postcount=60))

Good luck.

ChristopherTD
10-29-2009, 02:41 AM
Outstanding! Many thanks all of you. The unzip/zip trick worked. I can now read my book in Stanza. Hooray!

epstewart
10-29-2009, 02:10 PM
Outstanding! Many thanks all of you. The unzip/zip trick worked. I can now read my book in Stanza. Hooray!

Just out of curiosity: does anyone understand the need to unzip/zip?

Eric

DaleDe
10-29-2009, 04:14 PM
Just out of curiosity: does anyone understand the need to unzip/zip?

Eric

If you need to edit the contents of the ePUB and are not using a direct ePUB editor you will need to unzip it first to reveal the contents.

Dale

epstewart
10-30-2009, 11:11 AM
If you need to edit the contents of the ePUB and are not using a direct ePUB editor you will need to unzip it first to reveal the contents.

Dale

I have to assume, then, that ePUB books are typically zipped??? I didn't know that. They don't have to be unzipped to be read, seemingly, but if you want to edit them, then they need to be unzipped ... is that right? (Why would anyone want to edit an ePUB, anyway? In case one doesn't like the ending Dan Brown gave his latest novel?)

Cheers,
Eric

Jellby
10-30-2009, 11:30 AM
I have to assume, then, that ePUB books are typically zipped??? I didn't know that. They don't have to be unzipped to be read, seemingly, but if you want to edit them, then they need to be unzipped ... is that right?

Yes, because ePUB reading software already "knows" the ePUB is zipped and can work with that, but text-editing software doesn't.

(Why would anyone want to edit an ePUB, anyway? In case one doesn't like the ending Dan Brown gave his latest novel?)

No, to change "Brown, Dan" into "Dan Brown" in the author metadata, for instance, or to remove that ugly unreadable font included in the book, or to fix the clumsy absolute font sizes it uses, or delete the blurbs or advertisements at the beginning of the book... If the book is well done, you usually won't want to change anything, but face it, books are often not well done.

adullday
10-30-2009, 11:41 AM
No, to change "Brown, Dan" into "Dan Brown" in the author metadata, for instance, or to remove that ugly unreadable font included in the book, or to fix the clumsy absolute font sizes it uses, or delete the blurbs or advertisements at the beginning of the book... If the book is well done, you usually won't want to change anything, but face it, books are often not well done.

... or to fix the R.A. Salvatore novels that have roosters on the cover (no, I'm not kidding), or to fix the Spanish textbook where tables are entered as images that are corrupted when read by Adobe DE, and of course the occasional OCR errors that turn words like "lie" into "he" and totally confuse the reader.

Honestly... don't they have any proofreaders??

wallcraft
10-30-2009, 11:41 AM
does anyone understand the need to unzip/zip? There is some incompatibility between the zip software used by ineptepub.pyw and the ZIPed ePub file. The Mac's built-in unzip works (is compatible), and pdurrant's script then produces a valid ePub that ineptepub.pyw can process.

pdurrant
10-30-2009, 11:58 AM
The file format for ePub books is that of a zip archive. An epub file can be decompressed with any unzip program. Zipping it up again requires a bit more care, as the order and compression of the files is important.

I have to assume, then, that ePUB books are typically zipped??? I didn't know that.

adullday
10-30-2009, 12:20 PM
I'm pretty sure that both the command line unzip and the python scripts use the zlib library, but the Leopard gui unzip does not.

Cygwin, which also uses zlib, also fails.

Windows Vista built-in fails, but 7-Zip succeeds.

Windows XP (on the one file I'm testing) asks for passwords for several files in the archive.

Linux unzip fails, which is no surprise since it also uses zlib, but the gui unzip succeeds (I'm using gnome... I think it's the Nautilus archive manager doing the work. I don't spend much time in the Linux gui. :) )

I'm guessing that there's either a bug in the zlib library, or more likely (especially since this is a problem on the Windows boxes too), the archiving software used by either the publisher or Adobe or whoever is responsible for the post-encryption zipping.

Has this ever been a problem with epubs downloaded from Window ADE, or is this particular on the Macs? And if so, why would we be getting different files?

epstewart
10-31-2009, 11:14 AM
Has this ever been a problem with epubs downloaded from Window ADE, or is this particular on the Macs? And if so, why would we be getting different files?

If you will provide me with a book title and source (either here in this thread, or in a PM) I will try to download it in Windows and also on a Mac. I have a Mac app called DiffMerge that can compare two files and show their differences, if any. It should be able to confirm whether the two downloads are the same.

BTW, I used DiffMerge to compare the adeptkey.der file created by ineptkey.pyw in Windows with that created by the Unix commands on a Mac (and by my AppleScript which embeds those commands). I found that the two files were identical. That should dispel any lingering doubts as to whether the need to unzip and rezip decrypted epubs on a Mac is due to any difference in the Mac adeptkey.der file.

Cheers,
Eric

pthwaite
10-31-2009, 02:11 PM
I suspect its the way the files are unzipped. I have 2 unzip programmes, Zipeg and Stuffit. When some packages are downloaded, although one programme may appear to unzip it, it gives an error when trying to run it, whereas the other will unzip it and it will work.
So, it sounds like it is a similar problem here.
Howard

mlc1
10-31-2009, 06:25 PM
Hi experts
I have an iliad reader and mac and bought an ebook in epubformat with DRM key. the problem is iliad cant read the book due to epub drm. On a windows computer we tried to decrypt the file but it gave the error

File name in directory "OEBPS/robe_978_oeb" and header "OEBPS/xxx.jpg" differ.

I read in this forum you succeeded to solve this error.
I am not familiar with OperationSystem of Mac I am only Mac user

Question; is there anybody who wants to decrypt my ebook (dutch language)

Thanks in advance

Best regards Ron

epstewart
11-01-2009, 11:33 AM
Hi experts
I have an iliad reader and mac and bought an ebook in epubformat with DRM key. the problem is iliad cant read the book due to epub drm. On a windows computer we tried to decrypt the file but it gave the error

File name in directory "OEBPS/robe_978_oeb" and header "OEBPS/xxx.jpg" differ.

I read in this forum you succeeded to solve this error.
I am not familiar with OperationSystem of Mac I am only Mac user

Question; is there anybody who wants to decrypt my ebook (dutch language)

Thanks in advance

Best regards Ron

The problem has to do with the fact that some downloaded Adobe eBook files need to be unzipped and then rezipped again before decrypting them on a Mac. eBooks in the ePub format (even if they are ADEPT-encrypted) are basically ZIP files. They've been zipped into an archive containing a signle folder that holds multiple individual files. The entire archive has been compressed to make it smaller. For some reason, the ineptepub.py decryption software on a Mac can't do the unzipping properly, preparatory to doing the decryption. But if you unzip the archive and then rezip it, you can feed the rezipped version to ineptepub.py and it will work.

The key thing to do seems to be to follow the directions in post #60 (http://www.mobileread.com/forums/showpost.php?p=635378&postcount=60).

You will work on a copy of your eBook, not the original. I suggest putting the copy on the Desktop. It has to be renamed in Get Info, in the Finder, so that it has a .zip extension replacing .epub. Then, when you double-click the renamed .zip file, the Mac will unzip it into a folder on the Desktop.

Post #60 refers to this post in another thread (http://www.mobileread.com/forums/showpost.php?p=581649&postcount=1), in which you will find a downloadable AppleScript "droplet" that you will download and unzip to become an ePub Zip 1.0.2 icon on your Desktop. Then you will drag the unzipped eBook archive, now a folder on your Desktop, to this droplet in order to rezip it. It becomes a file on the Desktop. This file has an .epub extension. You can use this file as the Input File to ineptepub.py.

pthwaite
11-01-2009, 11:41 AM
Did it give an output file?

If so, change the file extension from .epub to .zip
Expand (unzip) the zip file and see if you can read the files inside.
If you can, it suggests it's the problem may be in the final compression stages and pdurrant's epub-zip applescript may help.

If no file is created or you cannot read the data in the zip file, it suggests you haven't fully followed the decrypt procedures.
Check you have the correct python and pycrypto environment, then check again you have run the scripts using the appropriate parameters. Python does seem fussy about " ' marks, you may have to do a bit of reading in the forum to see what works in windows as you are doing it in windows.

pthwaite
11-01-2009, 11:42 AM
epstewart, you posted just before me, like minds posting at the same time eh :)

epstewart
11-01-2009, 05:26 PM
epstewart, you posted just before me, like minds posting at the same time eh :)

Indeed so! Cheers!

I would like to ask one of the participants in this thread to (either here or in a PM) give me a title and source for one of the books that needs unzip/rezip. I'd like to try to see whether it works as is on Windows but fails on the Mac. I suspect it does, but it never hurts to conduct a controlled experiment.

epstewart
11-02-2009, 01:33 PM
I obtained An Echo in the Bone by Diana Gabaldon from ShortCovers.com and ran an experiment. I found that ineptepub.py/ineptepub.pyw got an error unless I unzipped and rezipped it as per earlier posts in this thread. It happened on a Mac using Python 2.5, on a Mac using Python 2.6, and also in Windows XP!

It looks as if the problem is platform-independent. From earlier posts in this thread I gather that the source of the problem may well be a bug or incompatibility in the 'zlib' library that the Python script imports. If so, the library has the same bug/incompatibility on different platforms.

Cheers,
Eric

JSWolf
11-03-2009, 11:24 AM
I did remove the DRM from An Echo in the Bone. But it did have a problem. It had two invalid directories in the ePub. So what I have to do was unzip all the files and then put it back together so I could then strip the DRM.

epstewart
11-07-2009, 01:40 PM
I did remove the DRM from An Echo in the Bone. But it did have a problem. It had two invalid directories in the ePub. So what I have to do was unzip all the files and then put it back together so I could then strip the DRM.

I have been in touch with someone who knows more than I do about the way an ePub file is supposed to be put together. I asked him to look at An Echo in the Bone. He said:

The file is indeed an invalid epub. Two of the entries in the central directory of the epub (zip) file have had a portion of their name field set to all '\0' bytes. This is probably a bug with the software that generated the epub file.

That is exactly what JSWolf found, so I think we can conclude that some Adobe Digital Editions ePubs are improperly constructed zip files. The result is that ineptepub generates an error with them unless the files are unzipped and rezipped. The Mac's Archive Utility unzips them without error, maybe since it simply doesn't check the incorrect filenames.

whyzee
12-03-2009, 03:02 AM
Hi there,

I downloaded the app onto my snow leopard (10.6.2). But when I double-clicked on the app, nothing popped up. I also tried right clik->run, still nothing. Just want to check if the app works for snow leopard?

Thanks!

OK, I have made an AppleScript script that can generate an ADEPT Key in an adeptkey.der file (or a file by any other name the user chooses) on a Mac OS X platform. You can download this script's .zip file from

link removed

This is a script in the form of an application called ADEPTKey_Generator_1.1. To use it, un-zip the ADEPTKey_Generator_1.1.app.zip file to retrieve the script app. Then double click on the script app's icon. A standard "Where should I put the ADEPT key output file?" dialog will appear. You can Save As: any file name (default is adeptkey.der) to any folder (default is Desktop).

The script then uses "shell script" UNIX code provided by one of the participants in this thread to generate a "private key" that is saved in the ADEPT key output file and then can be used by the ineptepub.py Python script to decrypt downloaded ADE books.

ADEPTKey_Generator_1.1 should not be used until the user has (1) created an Adobe account online using a web browser and then (2) authorized that account in Adobe Digital Editions on the Mac. It requires that a ~/Library/Application Support/Adobe/Digital Editions/activation.dat file be present in the user's home folder hierarchy. Activating/authorizing the ADE account causes that file to be created.

Also, if more than one user have ADE accounts, the most recent one authorized is the one ADEPTKey_Generator_1.1 will use in generating the ADEPT Key.

pthwaite
12-03-2009, 09:34 AM
Yes it does work on Snow Leopard.
You have to have all the pycrypot etc installed though, as well as the Developer tools from the SL Instal CD if you haven't already got them installed.
H

epstewart
12-03-2009, 10:45 AM
Hi there,

I downloaded the app onto my snow leopard (10.6.2). But when I double-clicked on the app, nothing popped up. I also tried right clik->run, still nothing. Just want to check if the app works for snow leopard?

Thanks!

whyzee,

I wrote ADEPTKey_Generator_1.1, but I don't know for sure about whether it works in Snow Leopard, as I am just using Leopard.

Try downloading

link removed

and un-zip it if it doesn't unzip automatically. You'll see an ADEPTKey Generator 1.1 folder that contains the script app itself and also a .scpt file that you can open in Script Editor to see the source code. You can click on the Run button in the Script Editor window to run the script from there. When you do, it may work. If not, you may be able to tell more about why it isn't working.

Good luck,
Eric

whyzee
12-03-2009, 02:36 PM
pthwaite - Yes, I have developement kits installed (all 3 versions: 10.4u, 10.5 and 10.6). Also installed python2.6 and built/installed pycrypto2.0.1 from source (which required SDK 10.4u). Tried python test.py and ineptepdf and they all worked but had no luck running ADEPTKey_Generator_1.1.app.

Eric - thanks a lot for the source. I'll test it and post my results.

Y

pthwaite
12-03-2009, 03:34 PM
whyzee,
I tell a lie, it doesn't work on 10.6.2.
It did work on my earlier version (I've been running Snow Leopard since Sept and the script came out after that. So something has altered.

I get the following error now:

epstewart
12-03-2009, 05:04 PM
whyzee,
I tell a lie, it doesn't work on 10.6.2.
It did work on my earlier version (I've been running Snow Leopard since Sept and the script came out after that. So something has altered.

I get the following error now:

Howard,

Did the script app work in Snow Leopard before, but then stop working?

When it worked, were you running a version of Snow Leopard other than 10.6.2?

Looking at the PDF you attached, I see Code Type: PPC (Translated), making me think the app is being changed from native Intel code (which I believe it contains) to Power PC code. It's almost as if it's executing in Rosetta.

At the moment, I haven't the faintest idea what to do to correct it. If I were running Snow Leopard, I'd try saving the original script in Script Editor as an app again, just to see if that helps. Perhaps whyzee would like to try that and report back?

Cheers,
Eric

Edit: After I posted that, it occurred to me that (and I may be wrong about this) an AppleScript when saved as an app may not contain native code. It may consist of bytecodes that still have to be interpreted on the host computer.

epstewart
12-03-2009, 05:25 PM
whyzee,
I tell a lie, it doesn't work on 10.6.2.
It did work on my earlier version (I've been running Snow Leopard since Sept and the script came out after that. So something has altered.

I get the following error now:

After my last post, I discovered:

http://lists.apple.com/archives/Applescript-users/2009/Oct/msg00121.html

It seems to imply that under Snow Leopard an AppleScript can't be saved as an application, only as an "application bundle," which is what saving as an "application" does under Snow Leopard. Maybe if I save my app as an application bundle under Leopard, it'll work under S.L. I'm going to experiment and see if I can make that a reality ...

Eric

epstewart
12-03-2009, 05:40 PM
After my last post, I discovered:

http://lists.apple.com/archives/Applescript-users/2009/Oct/msg00121.html

It seems to imply that under Snow Leopard an AppleScript can't be saved as an application, only as an "application bundle," which is what saving as an "application" does under Snow Leopard. Maybe if I save my app as an application bundle under Leopard, it'll work under S.L. I'm going to experiment and see if I can make that a reality ...

Eric

OK, you guys who can't get my ADEPTKey_Generator_1.1 script app to work under Snow Leopard, would you kindly try:

link removed

It's the same source code as before, but I saved it as an "application bundle," not just an "application."

You can get the source code and the compiled app here:

link removed

Cheers,
Eric

whyzee
12-03-2009, 11:20 PM
Eric,
The app bundle works for SL.
Thx!
Y

whyzee
12-04-2009, 02:23 AM
I just installed rosseta and tried the 1.1 version of the app and it worked. The 1.1.app must have been compiled on ppc. Strangely, SL didn't prompt me to install rosseta when I ran it yesterday - must be a bug/feature of the SL.
Y

epstewart
12-04-2009, 10:22 AM
I just installed rosseta and tried the 1.1 version of the app and it worked. The 1.1.app must have been compiled on ppc. Strangely, SL didn't prompt me to install rosseta when I ran it yesterday - must be a bug/feature of the SL.
Y

As the one who wrote and compiled the 1.1 version on my Intel-based iMac, I can tell you that it was not in fact compiled on a PowerPC, though! I am curious as to whether you were allowed to check "Open in Rosetta" for the script app itself, and if you actually did so. I really don't understand this, but the problem seems to disappear with

link removed

whether or not Rosetta is installed/used.

Cheers,
Eric

epstewart
12-04-2009, 10:29 AM
I have posted to my Viva eBooks! blog this post (http://vivaebooks.blogspot.com/2009/10/iphone-reading-adobeepub-ebooks.html) giving detailed instructions as to how to use INEPT to bypass ADEPT encryption so that you can read ADEPT/EPUB books on devices such as an iPhone. I invite anyone reading this thread to make use of it. Many of you are old hands and already know the ins and outs of INEPT, but I would invite you to check my post for mistakes, omissions, lack of clarity, etc. Make any comments and suggestions you like, either here in this thread or as comments to the blog post itself. Thanks in advance...

Eric

pthwaite
12-04-2009, 02:55 PM
Eric,
as Whyzee says, you modified app works fine. However you have to be choosy as to how you unzip it, zipeg doesn't work but stuffit does.

This is a common problem related to earlier posts on the epub zipping etc

cheers, Howard

epstewart
12-05-2009, 04:24 PM
Eric,
as Whyzee says, you modified app works fine. However you have to be choosy as to how you unzip it, zipeg doesn't work but stuffit does.

This is a common problem related to earlier posts on the epub zipping etc

cheers, Howard

Howard,

You're talking about how you unzip the downloaded e-book, right? I.e., not about how you unzip my ADEPTKey_Generator_1.1a file. On my Mac running Mac OS X 10.5.8, or Leopard, just double clicking on the e-book file whose .epub extension has been changed to .zip causes Archive Utility to unzip the file, and the resulting folder can then be re-zipped with ePub Zip 1.0.2 (http://www.mobileread.com/forums/attachment.php?attachmentid=36026&d=1253223157) and then successfully input to ineptepub. I'm not sure why Stuffit or Zipeg enters the picture???

Felicitations,
Eric

pthwaite
12-06-2009, 01:42 PM
Eric,
No, I'm talking about unzipping your downloaded app.
Generally I use Zipeg for unzipping, but occasionally it runs into problems. (it appears to work but the unzipped app doesn't work. If I unzip using stuffit (the same download) it works and of course vice-versa. (The inbuilt Archive utility doesn't always work for some files which is why I have stuffit and zipeg too)
Once the app is correctly unzipped, it works fine, just like the command line tools. This problem isn't unique to your zipped file, it occurs with a number. I've just learned over the years that archiving/de-archiving packages are not all equal.

epstewart
12-06-2009, 08:20 PM
Eric,
No, I'm talking about unzipping your downloaded app.
Generally I use Zipeg for unzipping, but occasionally it runs into problems. (it appears to work but the unzipped app doesn't work. If I unzip using stuffit (the same download) it works and of course vice-versa. (The inbuilt Archive utility doesn't always work for some files which is why I have stuffit and zipeg too)
Once the app is correctly unzipped, it works fine, just like the command line tools. This problem isn't unique to your zipped file, it occurs with a number. I've just learned over the years that archiving/de-archiving packages are not all equal.

Howard,

That impresses me as quite strange behavior! I do occasionally find that some archive files, when they are double clicked, want to open in Stuffit Expander rather than Archive Utility. But even if they pick Stuffit Expander, they basically expand properly every time. Exception: as mentioned in earlier posts to this thread, certain ADE e-books that have known issues with their zip file internal formatting. Other than those, I have never had a problem with expanding zipped files, as long as they have downloaded aright, so I'm scratching my head as to what might be causing your problem.

Later!

Eric

llreader
12-12-2009, 12:08 PM
I am having trouble compiling pycrypto. I have the GCC-4.2 installed, but it gives me this error when I try sudo python setup.py build (or with python2.6):

sudo python setup.py build
running build
running build_py
running build_ext
building 'Crypto.Hash.MD2' extension
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.4u.sdk
Please check your Xcode installation
gcc-4.0 -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.6/src/MD2.o -o build/lib.macosx-10.3-fat-2.6/Crypto/Hash/MD2.so
ld: library not found for -lbundle1.o
collect2: ld returned 1 exit status
ld: library not found for -lbundle1.o
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//ccBhIbdi.out (No such file or directory)
error: command 'gcc-4.0' failed with exit status 1


There is no /Developer/SDKs/MacOSX10.4u.sdk

I have /Developer/SDKs/MacOSX10.5.sdk and /Developer/SDKs/MacOSX10.6.sdk

I think I must have something hanging around from an earlier installation of the SDK that is telling python to use the GCC-4.0

I do have macports AND fink installed, maybe that is causing problems (I had some trouble compiling some ports when I upgraded to Snow Leopard).

Any ideas? Thanks!

llreader
12-12-2009, 12:52 PM
OK, I seem to at least have figured out what is wrong. I installed version 2.6 from python.org while I was messing around trying to get everything to work, and that seems to have screwed up the configuration, calling 2.6 some of the time. It switched the "default" to python 2.6, which does not exist. I moved the whole framework to the trash temporarily and typing "python" produces an error, but "/usr/bin/python" works fine. pycrypto builds, and ineptepub.py runs fine.

"env python" runs 2.6. I need to figure out how to set it back in all the places it was changed.

I need to figure out where to set the default back

epstewart
12-12-2009, 01:14 PM
OK, I seem to at least have figured out what is wrong. I installed version 2.6 from python.org while I was messing around trying to get everything to work, and that seems to have screwed up the configuration, calling 2.6 some of the time. It switched the "default" to python 2.6, which does not exist. I moved the whole framework to the trash temporarily and typing "python" produces an error, but "/usr/bin/python" works fine. pycrypto builds, and ineptepub.py runs fine.

"env python" runs 2.6. I need to figure out how to set it back in all the places it was changed.

I need to figure out where to set the default back

llreader,

Take this with a grain of salt, but ... I had similar problems and found deleting (or, if you want to be able to undo it, moving the folder to the Desktop) the /Library/Frameworks/Python.framework/Versions/2.6/ folder and then reinstalling Python 2.6 and then PyCrypto from their respectively downloaded installers cleared things up.

See

http://www.mobileread.com/forums/showpost.php?p=632607&postcount=53

and its immediately preceding posts.

I'm using Leopard, not Snow Leopard, but maybe the magic is the same. I imagine "going back to square one" with respect to the Python 2.6 and PyCrypto installs makes sure all the needed files and libraries are present and accounted for.

Cheers,
Eric

llreader
12-12-2009, 02:59 PM
Thanks Eric,

I have had trouble with python installations like this before, going back years, when the fink version screws something up. I would just like to get back to the standard, built-in version. /usr/bin/python seems to be version 2.6.1 anyway, so it seems ok for now.

dynabook
12-12-2009, 05:34 PM
I have installed the Developer Tools and the package

http://tmrc.mit.edu/mirror/twisted/D....5_osx10.5.pkg PyCrypto 2.0.1 for OS X 10.5

I get the error:

This script requires PyCrypto, which must beinstalled separately. Read top-of-script comment for details.

Any help? New to Mac, old hand at PC.
--MH

llreader
12-12-2009, 05:59 PM
I get the error:

This script requires PyCrypto, which must beinstalled separately. Read top-of-script comment for details.

Any help? New to Mac, old hand at PC.
--MH

You could try what I did - call python using the full path /usr/bin/python, both to install the package and to run the scripts. You can have some confusion if you have multiple python instances installed (like Zope, or Plone, or something else). A lot of packages install python these days - I just found a copy in my OSGeo4W installation on BootCamp.

dynabook
12-12-2009, 07:23 PM
I tried /usr/bin/python2.5 which worked so the PyCrpyto is installed with Python 2.5 and not 2.6. Is there a way to install it under 2.6?

llreader
12-13-2009, 04:46 AM
I tried /usr/bin/python2.5 which worked so the PyCrpyto is installed with Python 2.5 and not 2.6. Is there a way to install it under 2.6?

Sure, in the pycrypto top directory, where "setup.py" is, try "sudo /usr/bin/python2.6 setup.py install" - On my Mac /usr/bin/python2.6 is a simlink to /System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 (which I deleted).

You can see what is in there with "ls -l /usr/bin/python*"

You can also try "build" before "install", just to test it, but then you have to type "install" afterward to actually install it.

What happened to me is that the 2.6 version of python, for some reason, made pycrypto try to compile with gcc-4.0 (which I don't have - I have gcc-4.2). I still haven't figured out why it did that, but I think it has something to do with the python installer.

If you are on Snow Leopard, I think the installed python is 2.6.1 (at least that is what I get if I run /usr/bin/python).

Good luck!

evdberg
12-14-2009, 03:19 PM
@epstewart,
When running ADEPTKey Generator 1.1a I get the following error:
unable to load Private Key
4386:error:0906D064:PEM routines:PEM_read_bio:bad base64 decode:pem_lib.c:757:
Any idea what is wrong? I am running OS-X 10.5

epstewart
12-15-2009, 05:59 PM
@epstewart,
When running ADEPTKey Generator 1.1a I get the following error:
unable to load Private Key
4386:error:0906D064:PEM routines:PEM_read_bio:bad base64 decode:pem_lib.c:757:
Any idea what is wrong? I am running OS-X 10.5

evdberg,

No idea. Could you tell me exactly in what form that message appears, i.e., is it in a dialog box, in Terminal, or what? Also, does it appear before or after you have been asked where to put the output ADEPT key file?

Or, try running the script from Script Editor. Download and unzip

link removed

then open the .scpt file in Script Editor and click on the Run button.

I can tell you that "unable to load Private Key" is not a message the script itself generates. But the script invokes a Unix "shell script" to do the actual work of generating the output file. I got the shell script from someone else and don't really know how it works.

You might also try de-authorizing and then re-authorizing your ADE account, which ought to generate a new ~/Library/Application Support/Adobe/Digital Editions/activation.dat file. That file contains the Private Key. My script (via the Unix shell script) accesses that Private Key within that file and puts it in the adeptkey.der file for subsequent use.

If you still need help, feel free to post whatever results you get to this thread, or else send me a private message ...

Cheers,
Eric

EDIT:

Or, try my earlier version:

link removed

I know version 1.1 works with 10.5 Leopard and has a problem with 10.6 Snow Leopard. Version 1.1a works with Snow Leopard, but maybe it sometimes fails with Leopard (even though it works on my copy of Leopard).

evdberg
12-15-2009, 06:07 PM
Hi Eric,

The error comes after the selection window to choose the destination path and file. I also tried running the script itself, but that resulted in the same error. The message states the data is not base64. My guess is that the script can not find the key and is trying to use something else as key (hence the error message). How should that activation.dat file look like and where is the key located? Maybe I can then manually see what is the problem.

Thanks,
Erwin

epstewart
12-16-2009, 09:49 AM
Hi Eric,

The error comes after the selection window to choose the destination path and file. I also tried running the script itself, but that resulted in the same error. The message states the data is not base64. My guess is that the script can not find the key and is trying to use something else as key (hence the error message). How should that activation.dat file look like and where is the key located? Maybe I can then manually see what is the problem.

Thanks,
Erwin

Ervin,

Here is my own activation.dat file:

http://epstewart.home.comcast.net/activation.dat

There are <privateLicenseKey></privateLicenseKey> tags in it. In between is the key itself, which I believe corresponds to the one that may be messed up in your case. However, be aware that this is my key and will not work on anyone else's computer, since it is tied to the computer and user log-in of the Adobe Digital Editions user — me — that created it when he authorized ADE.

You can inspect ~/Library/Application Support/Adobe/Digital Editions/activation.dat on your Mac, in the ~/ hierarchy for your log-in account. Maybe you can see what the problem is.

I can't quite imagine why there is a complaint about "not being base-64," since I believe any string of bits can be interpreted as being base-64! Perhaps the problem is one of the length of the string not being appropriate to a string of base-64 digits. I.e., base-64 digits require 6 bits per digit, so maybe your key's length in bits is not divisible by 6. (If you inspect the file in TextEdit, you should see a bunch of gobbledygook between the <privateLicenseKey></privateLicenseKey> tags. Keep in mind that TextEdit is "seeing" 8-bit bytes, i.e., ASCII code.)

Anyway, have you tried just de-activating and re-activating your account in ADE? I would trash your activation.dat file if it's still present after the de-activation, then re-activate, thus generating a new activation.dat file to use with the script. Or, create a new user account on your Mac and activate ADE under that account, and then see if the script works under that account.

Good luck ...


Eric

epstewart
12-16-2009, 01:50 PM
I have installed the Developer Tools and the package

http://tmrc.mit.edu/mirror/twisted/D....5_osx10.5.pkg PyCrypto 2.0.1 for OS X 10.5

I get the error:

This script requires PyCrypto, which must beinstalled separately. Read top-of-script comment for details.

Any help? New to Mac, old hand at PC.
--MH

Try trashing the /Library/Frameworks/Python.framework/Versions/2.6/ folder and then reinstalling Python 2.6 and PyCrypto, in that order. It worked for me ...

Eric

evdberg
12-16-2009, 05:21 PM
@Eric,
My activation.dat file is slightly different: a lot of tags have "adept:" in the tag name, for instance:
<adept:privateLicenseKey>
I will make a backup of the activation.dat file and remove the adept: part from the tag and see if it works.

You are wrong on base64: as the name suggests it encodes using 64 characters (6 bits at a time). Any other of the 64 selected characters is wrong and will give the mentioned error.

Update: Success!! I was able to extract the key and decrypt a book.

- Erwin

epstewart
12-17-2009, 11:56 AM
@Eric,
My activation.dat file is slightly different: a lot of tags have "adept:" in the tag name, for instance:
<adept:privateLicenseKey>
I will make a backup of the activation.dat file and remove the adept: part from the tag and see if it works.

You are wrong on base64: as the name suggests it encodes using 64 characters (6 bits at a time). Any other of the 64 selected characters is wrong and will give the mentioned error.

Update: Success!! I was able to extract the key and decrypt a book.

- Erwin

Erwin,

Brilliant! A very imaginative workaround on your part!

What version of Adobe Digital Editions are you using? Mine is 1.7.1.1085. I'm on Mac OS X Leopard 10.5.8. I have to believe that you must be on a different ADE version, and/or a different Mac OS X version, to account for the difference in the <privateLicenseKey></privateLicenseKey> tags between your activation.dat file and mine. If you are not already too engrossed in reading your decrypted book ;), I'd like to hear back from you about this, because I'm wondering whether I'll need to figure out how to change the "shell script" in my AppleScript to avoid others' running into this problem.

Cheers,
Eric

evdberg
12-18-2009, 09:01 AM
Eric,

I only installed the Sony Reader software, which generated the ADE license. I have not installed any software from Adobe (at least not that I know of).

I had to do a bit more to get it working than I described above. The formatting, or better said the lack thereof (no linebreaks), of the activation.dat file was also giving problems. So I decided to make a file that only consisted of the privateLicenseKey part and remove the rest. This worked.

No, I am not engrossed in reading the decrypted book. I just 'bought' the first free book I could find in the Sony store for testing purposes only. The goal was to determine whether to go through the hassle of upgrading the firmware of my PRS-500. Obviously this is not necessary.

- Erwin

epstewart
12-18-2009, 01:18 PM
Eric,

I only installed the Sony Reader software, which generated the ADE license. I have not installed any software from Adobe (at least not that I know of).

I had to do a bit more to get it working than I described above. The formatting, or better said the lack thereof (no linebreaks), of the activation.dat file was also giving problems. So I decided to make a file that only consisted of the privateLicenseKey part and remove the rest. This worked.

No, I am not engrossed in reading the decrypted book. I just 'bought' the first free book I could find in the Sony store for testing purposes only. The goal was to determine whether to go through the hassle of upgrading the firmware of my PRS-500. Obviously this is not necessary.

- Erwin

Erwin,

I imagine that we have learned something important here: the Sony Reader software generates an ADE license key whose adeptkey.dat file has a different internal structure than the one that the Adobe Digital Editions software generates. I must admit that surprises me, since one might think they would be identical ... but you never know.

I'm confused about your PRS-500 Sony Reader: if the Sony Reader software generates the adeptkey.dat license key file on your Mac, why is the PRS-500 itself unable to read the DRM-encrypted e-books, unless you remove the DRM encryption first. I am using the Stanza reader software on an iPhone and have to strip off the DRM for that. But I am surprised you need to do so also.

Cheers,
Eric

evdberg
12-18-2009, 01:47 PM
My PRS-500 needs a firmware upgrade to support ePub files. However, for the upgrade the unit needs to be sent back to Sony USA. This is all well arranged for US customers, but not for non-US customers. Although one Australian customer managed to arrange the upgrade, it is all a lot of hassle. After decrypting the ePub I can simply convert it to LRF and upload it to my PRS-500 using Calibre. I use the very same method for books from the Kindle store.

- Erwin

epstewart
12-18-2009, 05:07 PM
My PRS-500 needs a firmware upgrade to support ePub files. However, for the upgrade the unit needs to be sent back to Sony USA. This is all well arranged for US customers, but not for non-US customers. Although one Australian customer managed to arrange the upgrade, it is all a lot of hassle. After decrypting the ePub I can simply convert it to LRF and upload it to my PRS-500 using Calibre. I use the very same method for books from the Kindle store.

- Erwin

OK, Erwin, I understand now what your situation is. Thanks for spelling it out.

The following is for the benefit of others who may be in the same situation:

My ADEPTKey Generator 1.1a AppleScript (download it link removed) works under Mac OS X 10.5 "Leopard" or 10.6 "Snow Leopard" to extract from your ~/Library/Application Support/Adobe/Digital Editions/activation.dat file a cryptographic key which it puts in a new file, adeptkey.der. (You can put that adeptkey.der on the desktop or in any folder you want to, and you can change the name of the output file to whatever you want.)

adeptkey.der (or whatever you chose to call it) then is used by the ineptepub.pyw Python script when you decrypt (remove the Digital Rights Management encryption of) an Adobe Digital Editions e-book. The output of ineptepub.pyw is an unencrypted .epub file that you can use in any way that you can any other EPUB e-book.

Erwin (evdberg) has an activation.dat file that was not generated by the Adobe Digital Editions software. ADEPTKey Generator 1.1a does not work with activation.dat files such as Erwin's that come from the Sony Reader software on a Mac -- unless you do what Erwin did and edit the Sony Reader activation.dat file.

DaveNB
12-19-2009, 06:28 PM
Before re-installing Python 2.6 and PyCrypto from scratch, try typing this from the command line:



cd <to whatever directory you have all your ineptepub.py script stored in>

/usr/bin/python2.5 ineptepub



Try trashing the /Library/Frameworks/Python.framework/Versions/2.6/ folder and then reinstalling Python 2.6 and PyCrypto, in that order. It worked for me ...

Eric

DaveNB
12-19-2009, 07:27 PM
Found this great website/howto on creating self contained python applications that run like any other applications in OS X.

Then follow the directions here:
http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html

The key to this is when creating your own standalone python application is to specify that you want to use python2.5 in the creation of your application.

Feel free to PM me if you need any help getting this to work for you.

Dave

DaveNB
12-20-2009, 09:19 PM
Got a few folks asking how to do this step by step. Here is what I did to compile standalone Python applications.

IMPORTANT: After compiling these programs, I recommend immediately deleting them from your hard drive to avoid getting into any legal enganglements (DMCA), do not use them to illegally strip DRM if it is illegal for you to do so in your country. This is only meant as an exercise in learning to compile stand alone Python programs.

NOTE: ineptkey.py will not compile for OS X (it has Windows dependencies), you need it to generate the adept.der file that has the decryption key for your DRM protected ePubs and you will have to find some other way to do this.

WARNING:
-You should be comfortable with issuing Unix Command Line commands in Terminal and you need admin level permissions on your computer complete these instructions. Read through all of the instructions first and if you don't understand any of this or if it scares you, this is probably NOT for you. You CAN potentially screw up your computer pretty bad or lose data if you don't know what you're doing in the command line, you have been warned!!!

-I have not personally reviewed the PyCrypto nor the Adept ineptepub.pyw and ineptpdf.pyw source code and cannot guarantee the fitness or safety of these programs. You do this at your own risk, I'm not responsible if you crash your computer, screw up your OS X install/system, lose data, etc.


1) Create a folder on your Desktop and call it Adept
2) Locate on the internet from a reliable source, Download and Install the pycrypto 2.0.1 for 10.5 package.
3) Download, unzip and place the Python programs you want to compile into the Adept folder. Rename them so that the filenames end in ".py" instead of ".pyw"
4) Open your Terminal application.
5) Type: cd ~/Desktop/Adept
6) Type: curl -O http://peak.telecommunity.com/dist/ez_setup.py
7) Type: sudo python2.5 ez_setup.py -U setuptools
8) Type: ls /usr/local/bin to make sure that the following files are present: easy_install, easy_install-2.5, py2applet
You may want to add /usr/local/bin to your environment path to make things easier for you. If these files are not present, you did not successfully install the py2applet package and you will need to read through the web page referenced below for further information.
9) Type: /usr/local/bin/py2applet --make-setup <name of the Python program you want to build>.py
If successful, the output should say: Wrote setup.py
10) Type: python2.5 setup.py py2app
11) The resulting OS X application will be in a folder called "dist". Copy the application to your Desktop, try running it.
12) Before you try building another Python application, you should delete the "build" and "dist" folders by Typing: rm -rf build dist

Repeat steps 9 - 12 for building additional Python programs.


These instructions are taken from this URL/Online resource: http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html

If it is legal for you to strip DRM from the ePubs that you own where you live, PLEASE DO NOT use this capability for piracy and have due consideration for the Authors and Copyright holders of your ePubs.

Good luck,

Dave

epstewart
12-21-2009, 03:30 PM
Folks,

I invite you to try out the new version, ADEPTKey Generator 2.0 (download it link removed, then unzip it if it doesn't unzip by itself), of my AppleScript-based application that lets Mac OS X 10.5 Leopard and 10.6 Snow Leopard users create an adeptkey.der file. That file can then be used by the ineptkey.pyw Python/PyCrypto script to decrypt an Adobe Digital Editions e-book.

Version 2.0 adds the capability to deal with an activation.dat file that was created by Sony Reader software for the Mac, in addition to still working with an activation.dat file generated by the Adobe Digital Editions software itself. The Sony Reader software puts Mac-style return characters, not Unix-style newline characters, in the file. Thank you to the incognito person who provided me with the necessary changes to the Unix "shell script" that my AppleScript uses to extract the adeptkey.der file from activation.dat.

If you want to see the actual AppleScript code, you can download and unzip link removed, which expands into a folder containing both the source AppleScript and the compiled application.

As before, my script makes sure you actually have a ~/Library/Application Support/Adobe/Digital Editions/activation.dat file. For that reason, you need to Authorize Computer ... in Adobe Digital Editions before running my script. (If you are using Sony Reader software, not ADE, I assume there is an equivalent way to generate ~/Library/Application Support/Adobe/Digital Editions/activation.dat.)

Also, my script lets you choose any output filename, with adeptkey.der being the default name, and also the folder location for the output file.

I will be very appreciative if as many of you as possible will try my new ADEPTKey Generator 2.0 version and report back in this thread or in a private message to me as to whether it works for you or not. I believe it will work with Snow Leopard but have tried it only on Leopard. I have not tried it with Sony Reader's version of the activation.dat file, either.

Regards to all,
Eric

Moderator note: This site has a policy not to host or provide links to software or instructions used to defeat DRM. You can discuss it but do not provide instructions or links.

rcuadro
12-21-2009, 08:26 PM
Dang! Can someone PM the link ;)

Alexander Turcic
12-22-2009, 05:32 AM
Important

Guys, please respect our policy to not directly link to tools that can be used to break DRM. Also, please don't ask for detailed how-to instruction.

I am sure everyone can understand why we must be very strict about this. :thanks:

rwe
12-27-2009, 02:32 PM
i tried the above scripts, but i want to go back to base,
it didn't work (i use python version om my mac)
i got message:error: problem decrypting session key

i buy books and i want to use it on different readers supporting ADE
i don't want to liberate them completely, just use it on my own computers, my own readers.

when i import a book bought from B&N, so with a cc based drm key
and i import it into ADE, then i get the next message

Lee__Nothing_to_Lose__Jack.epub:
Licentie van document geldt voor een andere gebruikersaccount

licence of document is for another useraccount, does this mean i have to authorise ADE with the same user and pwd as used on B&N?
if i remember correctly, the ADE was based on a mailadress and given pwd
how can i make this work??

epstewart
12-29-2009, 02:37 PM
i tried the above scripts, but i want to go back to base,
it didn't work (i use python version om my mac)
i got message:error: problem decrypting session key

i buy books and i want to use it on different readers supporting ADE
i don't want to liberate them completely, just use it on my own computers, my own readers.

when i import a book bought from B&N, so with a cc based drm key
and i import it into ADE, then i get the next message

Lee__Nothing_to_Lose__Jack.epub:
Licentie van document geldt voor een andere gebruikersaccount

licence of document is for another useraccount, does this mean i have to authorise ADE with the same user and pwd as used on B&N?
if i remember correctly, the ADE was based on a mailadress and given pwd
how can i make this work??

It's me, epstewart, the guy who made ADEPTKey Generator 2.0. I also blog at the Viva eBooks! blog (http://vivaebooks.blogspot.com/), and I wonder if you are not the Anonymous comment author that asked a similar question at my iPhone: Reading Adobe/EPUB eBooks (http://vivaebooks.blogspot.com/2009/10/iphone-reading-adobeepub-ebooks.html) post. (For others: that post gives step-by-step instructions on how to make Adobe DRM protected eBooks readable on an iPhone, by stripping off the DRM as discussed in this thread.)

I am interested in helping you solve your problem. I am not so much of an expert that I can definitely tell you what to do to solve your problem, but let me make the following comments and let others who know more than I do add their expertise.

I believe the books you buy from B&N are not Adobe DRM-encrypted. B&N (as far as I know) does not sell books that use Adobe Digital Editions Protection Technology (ADEPT), the DRM encryption methodology from Adobe which this forum thread is about. I think you are right to say that a B&N account that uses a credit card number and a password to buy books cannot be made to match up with the Adobe Digital Editions application, whose authorization/activation involves using an "Adobe ID" (typically your e-mail address) and a password.

Here is a way that you may be able to use to tell whether your book is in fact ADEPT-encrypted. Here's what you do. Copy the original e-book file, putting the new copy on your Desktop, so that you are not working with the original file. (If you option-drag the file to the Desktop, you'll get a new copy of the file on the Desktop.) Then change the filename extension of the copied file on the Desktop from whatever it was originally to .zip. You can do that by doing Get Info on the copied file on the Desktop (shortcut: command-I) and editing the extension in the Name & Extension field. You will then click "Use .zip" in the dialog box that comes up to confirm your intention. Also, still in the Get Info window, set "Open with:" to the Mac's Archive Utility. (Do not click on "Change All ... " unless you want any double-clicked ZIP archive to use this utility.) Now close the Get Info window.

Once you have the .zip extension on the copied file and have the file set to open in Archive Utility, double-click the file. You should see the ZIP file expand into a new folder on your Desktop. The new folder's name reflects the name of your book. Open that folder. In it should be a META-INF folder. Open it. In the META-INF folder should be a file called rights.xml. Open it in TextEdit (best way: drag its icon to the TextEdit icon on the dock). The very first line of the rights.xml file should look something like this:

<?xml version="1.0"?><adept:rights xmlns:adept="http://ns.adobe.com/adept"><licenseToken xmlns="http://ns.adobe.com/adept">

If it looks nothing like that, then almost certainly your book is not ADEPT-encrypted!

***

Also, rwe, I do not quite understand why you want a B&N e-book to be readable in different readers supporting ADE, anyway. I find that B&N e-books work in eReader, for example, which you can get as a free download for your computer or for your iPhone or iPod Touch by clicking here (http://www.ereader.com/servlet/mw?t=help&si=59) and then clicking on Get eReader Software. B&N offers its own eReader software here (http://www.barnesandnoble.com/ebooks/download-reader.asp)

Plus, you can go here (http://www.lexcycle.com/download) to download the Stanza app for computers and/or iPhone/iPod Touch. It has the ability to transfer DRM-protected eReader books (which yours from B&N may be; does it have a .pdb filename extension in the Finder?) from the desktop version of Stanza (which cannot actually read the books) to the iPhone/iPod version (which can). See this FAQ (http://www.lexcycle.com/faq#3n619).

I hope this helps ...

Eric

mores
12-29-2009, 03:21 PM
Great, a tutorial on using something on a Mac that starts with "First, you need a PC!"

;)

EDIT: Now that I'm done with complaining I'll read the rest of the post in depth!

epstewart
12-29-2009, 04:47 PM
Great, a tutorial on using something on a Mac that starts with "First, you need a PC!"

;)

EDIT: Now that I'm done with complaining I'll read the rest of the post in depth!

mores,

You really ought to read this thread in depth, because the whole point is that you do not need a PC!

See my iPhone: Reading Adobe/EPUB eBooks blog post (http://vivaebooks.blogspot.com/2009/10/iphone-reading-adobeepub-ebooks.html) for step-by-step instructions for either a Mac or a PC.

Cheers,
Eric

mores
12-29-2009, 04:52 PM
Super, thanks for pointing me directly to the good stuff!

rwe
12-31-2009, 10:56 AM
epub decryption......
thanks Eric, i followed your excellent step by step instrcutions on viva ebooks blog and it worked fine, working on mac 10.5.8 (leopard)and python 2.5, no problems,
i credit you u all the Karma i can give :)
I come to the point where the value of my books is much bigger then the value of a reader and with all development going on, i'am certain i will buy a different reader in the near future.
This allowes me to put books i bought and payed for from different shops under either calibre for multiple formats or adobe digital editions and to be able distribute it on my preferred reader, being an ipod on the train or a bigger screen reader home.

The only piece missing is to have this work on my mac for epub books i bought from b&n, there is a set of scripts from ilu-cabbages, but they won't work yet on my mac.
i'am certain one day it will, even for amazon books.
(this also covered my remark on your blog)

rene

wallcraft
12-31-2009, 11:10 AM
The only piece missing is to have this work on my mac for epub books i bought from b&n, there is a set of scripts from ilu-cabbages, but they won't work yet on my mac. The latest B&N circumvention scripts are supposed to work on any platform.

adullday
12-31-2009, 11:31 AM
The key retrieval program is Windows only, but the key generator (which is all you need to get the key) will work on the Mac.

rwe
01-01-2010, 05:25 PM
The key retrieval program is Windows only, but the key generator (which is all you need to get the key) will work on the Mac.

Thanks all,
however i had to do a couple of things to make it work, things probably very basic, but maybe not as clear to everyone who works by pushing buttons like me.

when i clicked on the links in the cabbages blog, i got something with linenumbers etc. it didn't work out of the box.
-i had to cut and paste it into texteditor or scripteditor
-then i had to save it as plain xxx.txt to check and to xxx.py to get something that python understood
i put these files on the desktop btw.
clicking on the xxx.py created the structure and the application that did the trick.
i validated all by loading the output file of the operation into adobe digital editions and calibre and no hitch there, it worked.

i'am now one happy customer in control of my own books:2thumbsup

epstewart
01-02-2010, 01:29 PM
Thanks all,
however i had to do a couple of things to make it work, things probably very basic, but maybe not as clear to everyone who works by pushing buttons like me.

when i clicked on the links in the cabbages blog, i got something with linenumbers etc. it didn't work out of the box.
-i had to cut and paste it into texteditor or scripteditor
-then i had to save it as plain xxx.txt to check and to xxx.py to get something that python understood
i put these files on the desktop btw.
clicking on the xxx.py created the structure and the application that did the trick.
i validated all by loading the output file of the operation into adobe digital editions and calibre and no hitch there, it worked.

i'am now one happy customer in control of my own books:2thumbsup

Rene,

I am glad you have figured all this out! And that it works for you!

Here is my experience with it:

I went here (http://i-u2665-cabbages.blogspot.com/2009/12/circumventing-barnes-noble-drm-for-epub.html) at the i♥cabbages blog and clicked on each of the three scripts in turn: ignoblekey (even though it's Windows-only), ignoblekeygen, and ignobleepub. The links each take you to pages at pastie.org that list the script's code. At upper-right is a Download link for each, and when I used that I wound up with just the code itself without line numbers, etc. I saved each download to an appropriately named file with extension .py (not .pyw).

Then I double-clicked on the ignoblekeygen.py file. Because I have Python 2.6 installed, it created an ignoblekeygen app in the same folder, and when I double-clicked on that app, it opened a dialog box into which I entered my name (as registered at Barnes & Noble online) and my credit card number. ignoblekeygen put its output file, bnepubkey.b64, at the root level of my Mac's folder hierarchy — not my ~/ user folder hierarchy, the main folder hierarchy.

I did the same thing with ignobleepub.py, as downloaded. I double-clicked it to cause the ignobleepub app to appear in the same folder. Double-clicking the ignobleepub app brought up a dialog which asked me to enter the location of the key file that was generated in the prior step (bnepubkey.b64) — I just let that default to the root-level file generated as a default by ignoblekeygen, though I could have moved the default file elsewhere — and also the file I wanted decrypted. (There are ... buttons which let you browse for file locations.) The third field in the dialog is for the filename and location to be used for the decrypted output file.

Here I ran into a minor snag: none of my books from B&N seem to use the encryption these scripts are intended for! I tried inputting into the ignobleepub app a .pdb file I have on hand, but the script app complained that the input file wasn't a ZIP file, and did not produce any output.

So I'd appreciate it if you or anyone else reading this thread would supply me with a link to a book that these scripts work with!

Regards,
Eric

wallcraft
01-02-2010, 02:07 PM
So I'd appreciate it if you or anyone else reading this thread would supply me with a link to a book that these scripts work with! I saw a report in another thread that the B&N Mac Reader may still be downloading eReader (.pdb) files when the Windows version is downloading ePub (.epub) files. Make sure you have the latest version (v1.1 for Mac, which supports ePub). Under Windows, Altar of Eden by James Rollins (http://books.barnesandnoble.com/search/results.aspx?store=EBOOK&WRD=altar+of+eden&box=Altar%20of%20Eden&pos=0), currently free, downloads as a 2.1MB EPUB from within the Windows B&N Reader but if you download this from your B&N bookshelf via a web browser it comes as a 562KB eReader (.pdb) file.

Note that the .epub file format is a particular kind of ZIP file, and hence the "not a ZIP" error if the file isn't an EPUB.

epstewart
01-03-2010, 11:57 AM
I saw a report in another thread that the B&N Mac Reader may still be downloading eReader (.pdb) files when the Windows version is downloading ePub (.epub) files. Make sure you have the latest version (v1.1 for Mac, which supports ePub). Under Windows, Altar of Eden by James Rollins (http://books.barnesandnoble.com/search/results.aspx?store=EBOOK&WRD=altar+of+eden&box=Altar%20of%20Eden&pos=0), currently free, downloads as a 2.1MB EPUB from within the Windows B&N Reader but if you download this from your B&N bookshelf via a web browser it comes as a 562KB eReader (.pdb) file.

Note that the .epub file format is a particular kind of ZIP file, and hence the "not a ZIP" error if the file isn't an EPUB.

Thanks, wallcraft. I obtained Altar of Eden (http://books.barnesandnoble.com/search/results.aspx?store=EBOOK&WRD=altar+of+eden&box=Altar%20of%20Eden&pos=0) in the way you mentioned and successfully used the ignobleepub Python script from i♥cabbages (converted to a double-clickable application by my Mac) to decrypt it.

The situation, as you mentioned, is interesting. This eBook by James Rollins is being given away for free at the B&N online store. If you go there in a web browser, either on a Mac or in Windows, and "buy" and then download the book from your "My eBooks Library," you will get a .pdb version of the book.

The ignobleepub Python script doesn't work with that. It works only with the EPUB version. But apparently the only way to get the EPUB version is to download it from your online "My eBooks Library" using Barnes & Noble Desktop Reader for Windows! Barnes & Noble eReader for the Mac is not a clone of that software, and it cannot access your online B&N eBooks library, so apparently it cannot obtain the EPUB version of the Rollins book directly.

I find it curious that (at least in this case) B&N would be able to "localize" two different versions of the same eBook, depending on how you access the eBook once it is in your online B&N library.

I wonder if the same is true for other B&N eBooks. Does anyone know?

adullday
01-03-2010, 05:17 PM
I have one book, Jerry Coyne's book Why Evolution is True, that only downloads as a pdb. All of the other B&N books that I have (including the samples) download as epubs under the B&N software on XP and Vista, but as pdb from the web. It's not a bad deal for me since I get the epub books (which I prefer), but still have pdb versions I can read on my Centro without going through the trouble of converting them.

I haven't made the leap to Intel yet so I haven't been able to try the most up-to-date Mac version of the B&N software.

epstewart
01-04-2010, 12:18 PM
I have one book, Jerry Coyne's book Why Evolution is True, that only downloads as a pdb. All of the other B&N books that I have (including the samples) download as epubs under the B&N software on XP and Vista, but as pdb from the web. It's not a bad deal for me since I get the epub books (which I prefer), but still have pdb versions I can read on my Centro without going through the trouble of converting them.

I haven't made the leap to Intel yet so I haven't been able to try the most up-to-date Mac version of the B&N software.

Thanks, Dave, for the input. It sounds like B&N and the publishers that provide it with eBooks have a variable policy as to whether the book can be retrieved as an epub by using the Barnes & Noble Desktop Reader for Windows.

Why the policy would vary from book to book makes little sense to me, though. To wit, we in this thread know that the epub versions can be unlocked into no-DRM eBooks that might, by those less scrupulous than we, be freely distributed, while I am not aware that the pdb versions can be (though I have yet to really investigate pdb decryption). If I were B&N, I would get rid of the epubs post haste!

Off-topic alerts:

That Jerry Coyne book is excellent! I've read it in its print version, which I bought before getting involved with the next evolutionary step: electronic books.

Also, some of my friends tell me that (rumor has it) Apple will introduce its "tablet" device in, maybe, February. I gather it will be like a big iPhone and thus be capable of running apps such as Stanza/eReader/B&N eReader/Kindle which will let us read just about any eBooks (even Adobe-DRM'ed ones, provided we decrypt them first). My friends say it will cost about $900. I have read online that the backlit, color-LCD touchscreen size will be 10.6 inches diagonally.

Cheers,
Eric

adullday
01-04-2010, 01:45 PM
It wouldn't do B&N any good to get rid of the epubs... the ereader pdb's were cracked a long time ago. :) I'll withhold discussing it so I won't get Mobileread into any trouble, but a Google search should provide links and answers to the curious.

Off-topic:

I listened to the audio version of Jerry Coyne's book while raking leaves last Fall, and I loved it. It was a great (and refreshing) followup to the Kansas Evolution Hearings of 2005 (which are also on Audible.com). I saw your review of the book on your blog but haven't had a chance to read it yet.

Okay, I'm going way off-topic into a volatile subject... I'll behave. :D

epstewart
01-20-2010, 11:51 AM
I bought a Nook, the new eBook reader/"Kindle killer" from Barnes & Noble. I was (apparently erroneously) under the impression that it is able to side-load and read Adobe PDF files. My first attempt to do so met with failure. An eBook which works fine in Adobe Digital Editions on my Mac — "The Keepsake" by Tess Gerritsen, borrowed from Maryland's Digital eLibrary Consortium (http://maryland.lib.overdrive.com/75BE23E7-6B03-4E5D-9CB5-3211A7F9830F/10/336/en/default.htm) — refuses to open on the Nook.

I tried using v2 of the ineptpdf Python script from i♥cabbages on it. The script was able to successfully decrypt the book, but on the Nook the decrypted version opens to a blank page (1 of 0!), while on the Mac it fails to open in Adobe Reader at all, complaining, "There was an error opening this document. The root object is missing or invalid."

When I open the decrypted version on the Mac using Adobe Digital Editions, I get the same weird blank page as on the Nook.

I would like to try a later version of ineptpdf, but I can't seem to locate one on the Web. If any of you have one or know how to get one, would you kindly PM me with the necessary information?

Thanks,
Eric

Edit: Further experiments show that neither Adobe PDF nor Adobe EPUB files borrowed from Maryland's Digital eLibrary Consortium (http://maryland.lib.overdrive.com/75BE23E7-6B03-4E5D-9CB5-3211A7F9830F/10/336/en/default.htm) can be used on the Nook, though (at least one of) the same books seem to work fine on the Nook when I buy them commercially. In general, I seem to have no problem reading non-borrowed Adobe PDFs and EPUBs on the Nook. It is only the borrowed versions that fail to work. Also, an experiment with a different borrowed Adobe PDF showed that at least that book could in fact be successfully decrypted by v2 of ineptpdf and then read in decrypted form on the Nook, so it looks as if I just happened to pick an Adobe PDF with an extra problem when I tried decrypting it as my first experiment with borrowed Adobe PDFs.

joblack
03-09-2010, 06:22 PM
Ineptkeymac is state of the art for Mac OS X.

pietvo
03-10-2010, 07:07 AM
And ineptpdf is now at version 7.4 which can handle a lot more pdf's.

EatingPie
04-20-2010, 02:09 PM
The problem has to do with the fact that some downloaded Adobe eBook files need to be unzipped and then rezipped again before decrypting them on a Mac. eBooks in the ePub format (even if they are ADEPT-encrypted) are basically ZIP files. They've been zipped into an archive containing a signle folder that holds multiple individual files. The entire archive has been compressed to make it smaller. For some reason, the ineptepub.py decryption software on a Mac can't do the unzipping properly, preparatory to doing the decryption. But if you unzip the archive and then rezip it, you can feed the rezipped version to ineptepub.py and it will work.

The key thing to do seems to be to follow the directions in post #60 (http://www.mobileread.com/forums/showpost.php?p=635378&postcount=60).

You will work on a copy of your eBook, not the original. I suggest putting the copy on the Desktop. It has to be renamed in Get Info, in the Finder, so that it has a .zip extension replacing .epub. Then, when you double-click the renamed .zip file, the Mac will unzip it into a folder on the Desktop.

Post #60 refers to this post in another thread (http://www.mobileread.com/forums/showpost.php?p=581649&postcount=1), in which you will find a downloadable AppleScript "droplet" that you will download and unzip to become an ePub Zip 1.0.2 icon on your Desktop. Then you will drag the unzipped eBook archive, now a folder on your Desktop, to this droplet in order to rezip it. It becomes a file on the Desktop. This file has an .epub extension. You can use this file as the Input File to ineptepub.py.
I found an alternate solution to this problem.

- DOES NOT require unzip/rezip. (The Good News!)
- DOES require the command line. (The Bad News, unless you're me. ;) )

It also eliminates the do not use unzip on the command line warning. An unzip will work fine afterward, though it won't be necessary, since the archive is repaired directly.

Here goes...

The zip file has a corrupted file name in the archive, as mentioned above. The command line version of zip on Mac OS X actually has the ability to repair zip files. Since this is a pretty simple repair, it works fine.

Note that the zip command alters the file in place, so you probably want to work on a copy.

% cp your-epub.epub new-epub.epub
% zip -F new-epub.epub

To test the archive, you can use the unzip command:


% unzip -qt new-epub.epub

If the fix worked, you shouldn't see anything. Just a clean run, all clear and back to the prompt. This also doesn't actually unzip anything, it's just a test run.

Okay!!

Now you can run ineptepub.pyw on the fixed file (it has a command-line/no GUI mode when you pass it parameters).

% python ineptepub.pyw adeptkey.der new-epub.epub decrypted.epub
% rm new-epub.epub

I wrote a bash script to do the whole shebang, but it's pretty custom in terms of hard-coded directories. It's also against the rules to post here anyway. ;)

This solution should also work via in an Applescript. Wink Wink Nudge Nudge.

-Pie

epstewart
04-20-2010, 02:52 PM
I found an alternate solution to this problem.

- DOES NOT require unzip/rezip. (The Good News!)
- DOES require the command line. (The Bad News, unless you're me. ;) )

It also eliminates the do not use unzip on the command line warning. An unzip will work fine afterward, though it won't be necessary, since the archive is repaired directly.

Good deal!

Here goes...

The zip file has a corrupted file name in the archive, as mentioned above. The command line version of zip on Mac OS X actually has the ability to repair zip files. Since this is a pretty simple repair, it works fine.

Note that the zip command alters the file in place, so you probably want to work on a copy.

% cp your-epub.epub new-epub.epub
% zip -F new-epub.epub

The -F option means to fix the file.

To test the archive, you can use the unzip command:


% unzip -qt new-epub.epub

The 't' part of '-qt' means to test the file for correctness. The 'q' part of '-qt' means to do so quietly.

If the fix worked, you shouldn't see anything. Just a clean run, all clear and back to the prompt. This also doesn't actually unzip anything, it's just a test run.

Okay!!

Now you can run ineptepub.pyw on the fixed file (it has a command-line/no GUI mode when you pass it parameters).

% python ineptepub.pyw adeptkey.der new-epub.epub decrypted.epub

For me the command brought up the GUI version of ineptepub, which is fine.

EatingPie
04-20-2010, 10:14 PM
Thanks to epstewart for the fill-in on explaining the zip flags.

Now another question...

I just joined B&N to download a book and try out the ignobleepub.pyw. I received several free e-Books for joining, but they're all in PDB format!

Are all the purchase books on B&N ePUB, or is there some setting? They used to offer a choice IIRC, but now it just shows "EBOOK" and "DOWNLOAD" and that's it.

A recommendation on a cheap SF ePUB to D/L would be great! (Not Heinlein!) :)

-Pie

epstewart
04-21-2010, 09:56 AM
Thanks to epstewart for the fill-in on explaining the zip flags.


You're welcome.

Are all the purchase books on B&N ePUB, or is there some setting? They used to offer a choice IIRC, but now it just shows "EBOOK" and "DOWNLOAD" and that's it.

I think you're right. It looks like they're all ePubs now.

A recommendation on a cheap SF ePUB to D/L would be great! (Not Heinlein!)

How about I, Robot by Isaac Asimov? $6.39 at B&N ...

EatingPie
04-21-2010, 11:55 AM
I think you're right. It looks like they're all ePubs now.
Oh, I forgot to say why I asked.

For signing up and downloading the B&N Mac software, I received 7 free eBooks -- mostly public domain classics. They were all in PDB format. That made me sort of leery of making a blind purchase just to test out a program.

As a side note, I am testing the program so I can actually make future purchases from them if it works! Sheesh.

How about I, Robot by Isaac Asimov? $6.39 at B&N ...
If they had the one by Eando Binder, now THAT would be a sell!! :)

I've read I, Robot but I'll still give that a look and see if other Asimov books catch my eye.

-Pie

adullday
04-21-2010, 10:47 PM
Nice find with the zip option!

Margaret Atwood's "The Handmaid's Tale" is only $3.95. I'm not sure if that's the permanent price or if it's on sale.

It's pdb if you download it from their web site, but epub if you pull it from your Nook (if you have one) or you use the Windows version of the B&N software.

adullday
04-21-2010, 10:54 PM
I don't know what's up with the Mac version of the B&N software. It looks like they added epub support to the eReader software (which they acquired when they purchased Fictionwise), but they don't seem to give you any access to the epub formats of the books. I thought I saw somewhere where someone had figured out an url parameter to fetch the epub version of the book. If I find and confirm it I'll post it.

EatingPie
04-22-2010, 12:00 AM
Nice find with the zip option!

Margaret Atwood's "The Handmaid's Tale" is only $3.95. I'm not sure if that's the permanent price or if it's on sale.

It's pdb if you download it from their web site, but epub if you pull it from your Nook (if you have one) or you use the Windows version of the B&N software.
Is this true with a Windows Web Browser, like Firefox or IE?

-Pie

adullday
04-23-2010, 01:36 AM
It's true with any web browser I've tried (being IE, Safari, and Firefox), and on any platform. The only way I've been able to access the epub versions was by using the Windows version of the B&N software, and by copying directly from my Nook.

Wine might work. If you drink enough, the pdb's might start looking like epubs. No waitasec... I mean you might be able to run the Windows version of B&N using wine (the open source Windows emulator) on Mac OS X. (It's late and I'm tired. I'm being a good hubby and waiting for my wife's blanket to get out of the dryer. :) ) I didn't have any luck running it on Linux (I've got a powerbook--can't try it on Leopard), but I didn't try all that hard and someone out there may have figured out how to work it. I suggest to Google wine and Barnes and Noble eReader.

EatingPie
04-23-2010, 02:14 PM
It's true with any web browser I've tried (being IE, Safari, and Firefox), and on any platform. The only way I've been able to access the epub versions was by using the Windows version of the B&N software, and by copying directly from my Nook.

Wine might work. If you drink enough, the pdb's might start looking like epubs. No waitasec... I mean you might be able to run the Windows version of B&N using wine (the open source Windows emulator) on Mac OS X. (It's late and I'm tired. I'm being a good hubby and waiting for my wife's blanket to get out of the dryer. :) ) I didn't have any luck running it on Linux (I've got a powerbook--can't try it on Leopard), but I didn't try all that hard and someone out there may have figured out how to work it. I suggest to Google wine and Barnes and Noble eReader.
Kind of weird behavior. I have Parallels so I can give it a shot that way. I just don't want to pay for an ebook and have it be the wrong -- and unusable -- format.

I guess I could just be patient until the transition is done... like that will happen! :D

-Pie

adullday
04-23-2010, 10:09 PM
You can try the samples. They usually download in the same format as the full book.

EatingPie
04-24-2010, 12:33 AM
You can try the samples. They usually download in the same format as the full book.

Everything I have tried is a PDB in sample form. Including The Lost Symbol.

-Pie

EatingPie
04-24-2010, 02:22 AM
You can try the samples. They usually download in the same format as the full book.
I tried the previously mentioned I, Robot and the sample downloaded as a PDB. I also tried several others including The Lost Symbol. Everything sample was PDB. So that route ain't the one to follow. :(

Sheesh, all this just because I want to start buying ePUBs from B&N... and they make it impossible!

-Pie

adullday
04-25-2010, 11:42 AM
I'm sorry, I misspoke. The samples will still download as pdb's from the web. You need to download them using the Windows's B&N software or a Nook to see whether or not there is an epub version available.

The advantage of downloading the samples is that you can find out whether or not an epub version is available before purchase. I have a few B&N ebooks that are pdb's even when downloaded to my Nook--apparently there is no epub version available from B&N. (In these cases, I'll usually purchase the epub version of the book from another vendor.)

EatingPie
04-25-2010, 12:58 PM
I'm sorry, I misspoke. The samples will still download as pdb's from the web. You need to download them using the Windows's B&N software or a Nook to see whether or not there is an epub version available.
I actually did it with the Windows version of B&N. A couple of possibilities.

a) You need the Nook to get the ePUB samples (most likely).
b) You need to add/download initially with Windows Version.

In my cases I had already added/downloaded on the Mac or via a Web Browser.

If someone could list some samples that downloaded as ePUBs, that would be great! While I'm not interested in The Lost Symbol, I figured it would be ePUB for sure, but no dice. Maybe Opera's new tell all, which should be an awesome read for a guy!

The advantage of downloading the samples is that you can find out whether or not an epub version is available before purchase. I have a few B&N ebooks that are pdb's even when downloaded to my Nook--apparently there is no epub version available from B&N. (In these cases, I'll usually purchase the epub version of the book from another vendor.)
Indeed, that's why I haven't payed for a book at B&N yet.

-Pie

adullday
04-25-2010, 09:33 PM
I did a quick lookup of The Lost Symbol on http://ebooks.addall.com and they only listed pdb's available from B&N. I don't know how reliable that is, but you should be able to get the sample as an epub if it's available. If not, you'll get stuck with a pdb. Here's hoping they convert the rest of their library soon.

EatingPie
04-25-2010, 10:21 PM
I did a quick lookup of The Lost Symbol on http://ebooks.addall.com and they only listed pdb's available from B&N. I don't know how reliable that is, but you should be able to get the sample as an epub if it's available. If not, you'll get stuck with a pdb. Here's hoping they convert the rest of their library soon.
Ah! Great idea! I never thought to ebooks.addall it for checking ebook type from a seller. I always just went price/availability.

Turns out they show I, Robot (previously recommended) and Oprah: A Liography (brand new book) as PDB also.

Once again, Anyone who has a good ePUB they recommend from B&N, feel free to post here or PM me.

I'm guessing, as previously suggested, that you only receive an ePUB if you have a Nook. *shrug*

And I realize this is sounding off-topic, but all this is to test decryption of ePUB from B&N so I can start using them as a purchase source for my Sony Reader! So decidedly on topic, since you need a test case in order to test!

-Pie

adullday
04-26-2010, 11:42 PM
If the epub is available, you should be able to get it without a Nook, but only by using the Window's version of the B&N software. That's how I've been checking to see if any of my pdb ebooks have been updated to epub (so far none :(, but I only have two of them). All of the ebooks I've downloaded from the web have been in pdb format. However, when I download them using Windows B&N Reader, most of them are epub. A few still download as pdb leading me to believe that they don't have epub versions for those particular books.

Try downloading a few samples using the Windows B&N software and see if they come down as epub or pdb. Let us know what comes out--I'm curious! For instance, the sample for Greg Maguire's Wicked should download as an epub.

EatingPie
04-27-2010, 04:28 PM
If the epub is available, you should be able to get it without a Nook, but only by using the Window's version of the B&N software. That's how I've been checking to see if any of my pdb ebooks have been updated to epub (so far none :(, but I only have two of them). All of the ebooks I've downloaded from the web have been in pdb format. However, when I download them using Windows B&N Reader, most of them are epub. A few still download as pdb leading me to believe that they don't have epub versions for those particular books.

Try downloading a few samples using the Windows B&N software and see if they come down as epub or pdb. Let us know what comes out--I'm curious! For instance, the sample for Greg Maguire's Wicked should download as an epub.
Nope. :(

The B&N Reader software forced me into firefox to "Shop." There is no in-software browsing the store. I added the Wicked sample with Windows Firefox, Downloaded it with Windows B&N Reader, and got a PDB.

So it's back to waiting...

-Pie

adullday
04-27-2010, 10:20 PM
That is totally weird. Are you using the most recent version? I got an epub when I tried it.

Sorry I'm not much help here. :(

EatingPie
04-28-2010, 01:14 AM
That is totally weird. Are you using the most recent version? I got an epub when I tried it.

Sorry I'm not much help here. :(
Yep, downloaded it over the weekend.

Well, it was worth a try.

-Pie

adullday
05-08-2010, 09:56 AM
Now this is interesting. B & N just came out with a new version of their Windows eReader. I have just re-downloaded all of my ebooks (they get put into a different folder now), and every one of them except for the Merriam-Webster Dictionary has downloaded as an epub. (Yay!!)

EatingPie
05-09-2010, 12:33 AM
Now this is interesting. B & N just came out with a new version of their Windows eReader. I have just re-downloaded all of my ebooks (they get put into a different folder now), and every one of them except for the Merriam-Webster Dictionary has downloaded as an epub. (Yay!!)
Yes! Indeed the new version did, even for the sample of I,Robot which is still a PDB in the other folder!

Good news... now some work ahead. :)

UPDATE: Ah, samples are not encrypted (makes sense). I will bite the bullet and buy a book. :)

-Pie

FlorenceArt
05-24-2010, 05:49 AM
Just thought it would be useful to mention it here: there is now a Mac-compatible version of the script to get the adept key from ADE. You will need to run the script from the console, but it works on a Mac with ADE version 1.7.2 of ADE (don't know about earlier versions as the way ADE stores the key has changed).

Google ineptkeymac to find it.

wirehead
05-24-2010, 04:57 PM
Well, I read thru the entire thread and didn’t see my problem addressed which, I hope, doesn’t mean I’m the only one having the problem ;-)
Everything works gr8 for PDFs so I know everything is installed correctly. But, I get an error MSG for epubs: Error: File name in directory “O
Mac OSX 10.5.8, Python 2.6, PyCrypto 2.1.0, ineptepub_v2.py [I noticed you just appended the py after pyw...]
I tried the zip trick, the files were readable - someone said not to rezip the mimetype file...?
This is the 1st x trying epub. I DLed it from the Overdrive.
Gr8 info you’ve provided. I bought an iPad and couldn’t wait to read books on it. DRM is so nonsensical - I can buy a hard cover, read it, gift it, and not expect the gestapo to kick down my door but buy a digital book and I can’t even share it to my iPad!!

EatingPie
05-24-2010, 05:54 PM
Well, I read thru the entire thread and didn’t see my problem addressed which, I hope, doesn’t mean I’m the only one having the problem ;-)
Everything works gr8 for PDFs so I know everything is installed correctly. But, I get an error MSG for epubs: Error: File name in directory “O
Mac OSX 10.5.8, Python 2.6, PyCrypto 2.1.0, ineptepub_v2.py [I noticed you just appended the py after pyw...]
I tried the zip trick, the files were readable - someone said not to rezip the mimetype file...?
This is the 1st x trying epub. I DLed it from the Overdrive.
Gr8 info you’ve provided. I bought an iPad and couldn’t wait to read books on it. DRM is so nonsensical - I can buy a hard cover, read it, gift it, and not expect the gestapo to kick down my door but buy a digital book and I can’t even share it to my iPad!!
First step is to see if the Sony Reader application or ADE will read the original ePUB. If so, this should work. If not, then this method will not work.

Okay a few ideas...

Did you try to your work via the command line (Terminal.app), or with OSX Finder (double-clicking the ineptepub.pyw)?

On the command line, you can run a simple fix for your epub without unzipping it.

% cp your-epub.epub new-epub.epub
% zip -F new-epub.epub
Note the cp copies the original to a new file in case something goes wrong.
Then you can try running ineptepub.pyw on the new-epub.epub file.

If using Finder, you can't do this "fix" trick, and you have to unzip/re-zip. When you unzip the epub, the mimetype file is created with NO permissions at all, so you can't read or write to it (a "wtf!" is in order here). You can, however, change permissions simply, and then it will re-zip into an epub just fine.

Terminal.app (command line)
% chmod a+r <unzip-dir>/mimetype

You can also do it via the Finder, single-clicking on the mimetype, selecting "Get Info" from the menu and in the "Sharing & Permissions" tab at the bottom of the Info window, you change "Privilege" to "Read only" or "Read & Write" (won't matter which) across the board. Now you can re-zip to a new ePub, and you're ready for ineptepub.pyw. This probably is not your issue though.

If these hints don't work, feel free to post the whole set of error messages, exactly as they appear on screen.

-Pie

wirehead
05-24-2010, 09:26 PM
If these hints don't work, feel free to post the whole set of error messages, exactly as they appear on screen.

-Pie

Ni!ice! Worked gr8, looks gr8 on my iPad, Thanx so much, Pie.

pietvo
05-25-2010, 07:39 AM
Just thought it would be useful to mention it here: there is now a Mac-compatible version of the script to get the adept key from ADE. You will need to run the script from the console, but it works on a Mac with ADE version 1.7.2 of ADE (don't know about earlier versions as the way ADE stores the key has changed).

Google ineptkeymac to find it.
You can also run it by double-clicking. And it also works with ADE 1.7.1 (don't know about earlier versions).

SonomaLass
08-06-2010, 07:11 PM
Help? I've been reading this very helpful thread, and I can now handle my EPUB files. But I have had no luck with removing DRM from PDFs so that I can change their format in Calibre. The problem seems to be that I can't get Pycrypto to install properly.

The error message I get is:

error: could not create "build/lib.macosx.10.5-ppc-2.5" Permission denied.

Any idea what I need to do?

Thanks in advance!

epstewart
08-06-2010, 07:23 PM
Help? I've been reading this very helpful thread, and I can now handle my EPUB files. But I have had no luck with removing DRM from PDFs so that I can change their format in Calibre. The problem seems to be that I can't get Pycrypto to install properly.

The error message I get is:

error: could not create "build/lib.macosx.10.5-ppc-2.5" Permission denied.

Any idea what I need to do?

Thanks in advance!

Possibly you need to run Disk Utility, from the Utilities folder, and Repair Disk Permissions on your main hard drive?

EatingPie
08-06-2010, 07:37 PM
Possibly you need to run Disk Utility, from the Utilities folder, and Repair Disk Permissions on your main hard drive?
Actually, I'm pretty sure the permissions are actually working perfectly! :)

You need to run the installation as super user, as normal users do not have permission to write to the system python directories.

Precede the command with "sudo." For example, if the command is "make install" you would type:

"sudo make install"

-Pie

SonomaLass
08-07-2010, 02:26 PM
Pie,

I tried your suggestion, but it said "sudo" was an invalid command.

epstuart,

I ran the repair permissions function and got a LONG list of hits, I guess you could call them. I can reproduce them here if it helps. But then I tried the pycrypto install again and got the same error as before, so the disk repair doesn't seem to have fixed whatever the problem is.

Any other suggestions? I really appreciate help with figuring this out,

joblack
08-07-2010, 02:54 PM
Pie,

I tried your suggestion, but it said "sudo" was an invalid command.

epstuart,

I ran the repair permissions function and got a LONG list of hits, I guess you could call them. I can reproduce them here if it helps. But then I tried the pycrypto install again and got the same error as before, so the disk repair doesn't seem to have fixed whatever the problem is.

Any other suggestions? I really appreciate help with figuring this out,

Maybe you need to install fink or reinstall sudo.

epstewart
08-07-2010, 03:50 PM
Pie,

I tried your suggestion, but it said "sudo" was an invalid command.

epstuart,

I ran the repair permissions function and got a LONG list of hits, I guess you could call them. I can reproduce them here if it helps. But then I tried the pycrypto install again and got the same error as before, so the disk repair doesn't seem to have fixed whatever the problem is.

Any other suggestions? I really appreciate help with figuring this out,

SonomaLass,

One of my blog posts may help you. To find it, enter "iPhone: Reading Adobe/EPUB eBooks" into a Google search box. It should be the first hit that Google lists.

If you go to my blog post and scroll down to Step 3, I talk about installing PyCrypto on Windows and Mac platforms. I have a Mac that runs OS X 10.5.x Leopard, and the PyCrypto install procedure I describe in Step 3 of my blog post worked for me.

The key steps are:

(1) Obtain pycrypto-2.0.1.tar.gz using a link I give in my post and expand it into a pycrypto-2.0.1 folder on the Desktop.

(2) Obtain an AppleScript app called PyCrypto_2.0.1_Installer. It is what you get if you follow a second link in my post and download and expand PyCrypto_2.0.1_Installer.app.zip.

(3) Run PyCrypto_2.0.1_Installer, pointing it at the pycrypto-2.0.1 folder on the Desktop.

The result should be a successful PyCrypto install that will allow you to use the relevant Python scripts to decrypt Adobe EPUB and PDF e-books. You will know that your PyCrypto install was OK if you see, after running PyCrypto_2.0.1_Installer, the message "Writing /Library/Python/2.5/site-packages/pycrypto-2.0.1-py2.5.egg-info" in the terminal window that opens automatically when you run the AppleScript.

I can't give you direct links to my blog post or the things that it links to because this forum does not permit direct links to methods of de-DRM'ing e-books.

Good luck!

EatingPie
08-07-2010, 04:34 PM
Maybe you need to install fink or reinstall sudo.
Sudo is about as imperative as a command gets on OSX. It's there.

A quick try would be an addendum to my above post, assuming the command is "make install."

"/usr/bin/sudo make install"

Remember, "make install" is just an example. The "/usr/bin/sudo" is the key.

You can also try the above instructions, as I'm betting those will work... I can't remember how I installed pycrypto, but since I just got a new MacBook Pro, I will be re-installing myself as well. I'll get back to you in a day or so.

-Pie

SonomaLass
08-08-2010, 06:08 PM
epstewart,

Thanks! That install script was obviously what I needed. It works great now, at least for recent files. I have a few older (2008, not that old) PDFs that I still can only read using ADE on my laptop. Reading through comments at your blog and other places, I think something must have changed regarding my Adobe account during that time. I did change computers in that time (although I kept the same hard drive), and I know that has caused some authorization problems in other places.

Fortunately none of the files I can't open is very important. The most important thing is being able to open new PDFs easily, because those are usually advance review copies that I need to read right away.

Thanks so much for your help!!

EatingPie
08-09-2010, 03:16 PM
Let me second the thanks to epstewart. It's nice to have an easy solution, and clear instructions to follow them with!

-Pie

epstewart
08-09-2010, 05:09 PM
Let me second the thanks to epstewart. It's nice to have an easy solution, and clear instructions to follow them with!

-Pie

Thanks, Pie, for your expression of appreciation!

epstewart
08-09-2010, 05:23 PM
epstewart,

Thanks! That install script was obviously what I needed. It works great now, at least for recent files. I have a few older (2008, not that old) PDFs that I still can only read using ADE on my laptop. Reading through comments at your blog and other places, I think something must have changed regarding my Adobe account during that time. I did change computers in that time (although I kept the same hard drive), and I know that has caused some authorization problems in other places.

Fortunately none of the files I can't open is very important. The most important thing is being able to open new PDFs easily, because those are usually advance review copies that I need to read right away.

Thanks so much for your help!!

SonomaLass,

I'm very glad to hear that you can read most of your Adobe PDFs now!

One possible workaround for the older ones has to do with the fact that an updated version of the Adobe Digital Editions application as of about Feb. 2010 changed the rules as far as encryption is concerned. It meant that a new adeptkey.der file was needed in order to decrypt newly purchased and downloaded ADE e-books. Older downloads continued to need the old adeptkey.der file for use with ineptepub and ineptpdf.

If you have no older adeptkey.der file — as would seem to be your situation — I am wondering whether a workaround might be to re-download the e-book using the latest ADE version. That re-downloaded e-book should be able to be unlocked using your current adeptkey.der file.

I say "should be able" because I have no way of testing what I'm suggesting to you. (Anyone else want to chime in here with some words of confirmation?)

Before you re-download anything, I think you ought to make a backup copy of your existing e-books, just in case something goes wrong. If you are not sure how to make a backup copy or how to re-download an e-book that you already have downloaded, then you can ask in this thread and I or someone else will supply an answer ...

Good luck with it!

bohemian0607
11-13-2010, 04:16 PM
I registered just to thank this thread for all the patient explanations and help. I am now able to read my Adobe Digital Editions books on my Kindle.

I wanted to mention that I followed all these steps on a Mac, and got stuck for a long time with a problem like this post:
http://www.mobileread.com/forums/showpost.php?p=630127&postcount=43

I was getting the error "This script requires PyCrypto, which must be installed separately. Read the top-of-script comment for details."

This is how I fixed it: I right clicked on the ineptpdf file and chose Open With> Python Launcher 2.6.1 - NOT the 2.7 launcher.

Everything worked perfectly after that. Thanks again!

SonomaLass
02-22-2011, 01:28 AM
Hey guys, it's me again! My hard drive died a sudden and painful death, and while I managed to use the old machine in slave drive mode long enough to rescue my ebook files, none of the DRM removing stuff works anymore. No surprise, but in trying to follow the steps, I have had no success. Specifically, I can't get Pycrypto to install on the current machine, an older Powerbook running Mac OS 10.5.8. It starts the build but ends with
"unable to execute gcc: No such file or directory
error: command 'gcc' failed with exit status 1"

Ideas? Suggestions? I'm posting the same query directly at epstewart's blog.

KevinH
02-22-2011, 02:02 AM
Hi,

Versions from the "tools" no longer need PyCrypto on Macs. They have been modified to use OpenSSL instead.

ATDrake
02-22-2011, 02:14 AM
Specifically, I can't get Pycrypto to install on the current machine, an older Powerbook running Mac OS 10.5.8. It starts the build but ends with "unable to execute gcc: No such file or directory error: command 'gcc' failed with exit status 1"

I think the underlying problem is that you don't seem to have the XCode Developer Tools installed on the Powerbook?

FlorenceArt
02-22-2011, 05:29 AM
Hey guys, it's me again! My hard drive died a sudden and painful death, and while I managed to use the old machine in slave drive mode long enough to rescue my ebook files, none of the DRM removing stuff works anymore. No surprise, but in trying to follow the steps, I have had no success. Specifically, I can't get Pycrypto to install on the current machine, an older Powerbook running Mac OS 10.5.8. It starts the build but ends with
"unable to execute gcc: No such file or directory
error: command 'gcc' failed with exit status 1"

Ideas? Suggestions? I'm posting the same query directly at epstewart's blog.

As mentioned, there are now versions of the tools that don't require PyCypto. Try to look for the Calibre plugins, they seem to work fine mostly.

pdurrant
02-22-2011, 05:34 AM
Ideas? Suggestions? I'm posting the same query directly at epstewart's blog.

[EDIT] I see you have got the new tools successfully.

SonomaLass
02-25-2011, 03:21 AM
Thanks, all. The new tools version is awesome and so much easier to use! Although I will search for the Calibre plug-in, too.

pdurrant
02-25-2011, 05:13 AM
Thanks, all. The new tools version is awesome and so much easier to use! Although I will search for the Calibre plug-in, too.

The Calibre plug-ins are in the same tools archive as the other tools.