View Full Version : "invalid PID checksum" when using mobidedrm, even though it IS valid.


Haidon
07-07-2008, 03:51 AM
I've been trying to use mobidedrm (both 0.0.1 and 0.0.2) to remove the DRM from a number of ebooks that I've purchased for use on my Kindle. The application seems to work properly, and it requests the files and PID to input. However, after doing so, I continuously get the following error message

Error: invalid PID checksum

Unfortunately I have entered the correct PID! I have checked and double-checked the PID, and the files will open on the PCs with the software for their respective PIDs, and will not open on other computers. I have two PIDs registered for use with the ebooks and the same error message comes up with each, on all of my files.

I located the directory and inputted the command;
python mobidedrm002 inputfile.prc outputfile.prc PID
I renamed the script 'mobidedrm002' in order to make it easier to locate.

I've been trying the command using the terminal in Mac OS X 10.5.3. The majority of my ebooks are purchased for HarperCollins online store, though I plan to purchase books from mobipocket's store if I can get this working. Could this error be a result of my computer, the publisher, or have I been entering something wrong all along?

Any help at all would be greatly appreciated. Thanks.

wallcraft
07-07-2008, 11:41 AM
Try putting the PID in quotes. If that does not work, put all the arguments in quotes.

Haidon
07-07-2008, 11:11 PM
Try putting the PID in quotes. If that does not work, put all the arguments in quotes.

I just tried that then, and the script worked right up to when the same error message came up.

Error: invalid PID checksum

I don't get what's going wrong with it. The script works until it comes up with the error message, and the files open on the applications with their respective PIDs.

wallcraft
07-07-2008, 11:59 PM
I suggest going to HarperCollins and finding your PIDs there. Copy one to the "clipboard "and paste it into the command line (however this is done under OS X). So far as I know the PID is always 10 characters long and the last two characters are the checksum (confirming that the 1st 8 are correct). If this works, most likely you have misread a 1 as I or a zero 0 as a O.

MobiPocket does not say how long a PID is (even though it is obvious by inspection), but it does say: incorrect PID message on web site (http://www.mobipocket.com/forum/viewtopic.php?t=1602):Problem
You get the "Incorrect PID" message when trying to ente ryour PID on the web site.

Cause
The PID you are entering is incorrect, because some of the characters are confusing.

Solution
Double check every character that can be confusing: 0 (zero) and O, 1 and I etc. Here "Incorrect PID" is exactly the same as "Error: invalid PID checksum" (since that is what the checksum is for).

If none of this works, Igor kindly provided us with the PID of someones Kindle to test kindlefix.py. So try V176CXM*FZ as the PID. It will fail because this isn't a PID authorized for your ebook, but the point is this PID has a valid checksum and so it should fail with a different error message (Error: no key found. maybe the PID is incorrect).

riverhorus
07-09-2008, 03:42 PM
Wallcraft,

I'm having the same problem as Haidon and I've carefully checked and rechecked my PID. I took your suggestion and entered the PID provided by Igor. Got the same error message about an "invalid PID checksum." Any other suggestions what might be going on?

I suggest going to HarperCollins and finding your PIDs there. Copy one to the "clipboard "and paste it into the command line (however this is done under OS X). So far as I know the PID is always 10 characters long and the last two characters are the checksum (confirming that the 1st 8 are correct). If this works, most likely you have misread a 1 as I or a zero 0 as a O.

MobiPocket does not say how long a PID is (even though it is obvious by inspection), but it does say: incorrect PID message on web site (http://www.mobipocket.com/forum/viewtopic.php?t=1602): Here "Incorrect PID" is exactly the same as "Error: invalid PID checksum" (since that is what the checksum is for).

If none of this works, Igor kindly provided us with the PID of someones Kindle to test kindlefix.py. So try V176CXM*FZ as the PID. It will fail because this isn't a PID authorized for your ebook, but the point is this PID has a valid checksum and so it should fail with a different error message (Error: no key found. maybe the PID is incorrect).

riverhorus
07-09-2008, 05:38 PM
Wallcraft,

Just to let you know and anyone else having an invalid PID checksum with MobiDeDRM0.02. I went back to ver 0.01 and had no problem running the program. Something appears to be broken in ver 0.02. The only difference between the two versions that I can see is the following:


def getSizeOfTrailingDataEntries(ptr, size, flags):
def getSizeOfTrailingDataEntry(ptr, size):
bitpos, result = 0, 0
while True:
v = ord(ptr[size-1])
result |= (v & 0x7F) << bitpos
bitpos += 7
size -= 1
if (v & 0x80) != 0 or (bitpos >= 28) or (size == 0):
return result
num = 0
flags >>= 1
while flags:
if flags & 1:
num += getSizeOfTrailingDataEntry(ptr, size - num)
flags >>= 1
return num

Haidon
07-09-2008, 11:57 PM
I suggest going to HarperCollins and finding your PIDs there. Copy one to the "clipboard "and paste it into the command line (however this is done under OS X). So far as I know the PID is always 10 characters long and the last two characters are the checksum (confirming that the 1st 8 are correct). If this works, most likely you have misread a 1 as I or a zero 0 as a O.

Though there is only one 'I' in the PID I also tried this approach, though it has returned the same error message.

If none of this works, Igor kindly provided us with the PID of someones Kindle to test kindlefix.py. So try V176CXM*FZ as the PID. It will fail because this isn't a PID authorized for your ebook, but the point is this PID has a valid checksum and so it should fail with a different error message (Error: no key found. maybe the PID is incorrect).

I got the other error message when I inputted that PID (Error: no key found. maybe the PID is incorrect).

Just to let you know and anyone else having an invalid PID checksum with MobiDeDRM0.02. I went back to ver 0.01 and had no problem running the program. Something appears to be broken in ver 0.02.

Both version return the same error message unfortunately.

As my attempts to run the script under Mac OS X (my main machines, unfortunately) have failed, I've also tried loading the script through an oldish Windows machine. I read a tutorial explaining that in order to run it it is necessary to create a .bat file with the following:
mobidedrm002.py inputfile.prc outputfile.prc PID
pause

This only brings up a message telling me how to use the application:
MobiDeDRM v0.02. Copyright <c> 2008 The Dark Reverser
Removes protection from Mobipocker books
Usage:
mobidedrm infile.mobi outfile.mobi PID

After this it just says "Press any key to continue..." and then closes without actually doing anything. Am I doing something wrong the the DOS command?

Once again, thanks for any and all advice!

wallcraft
07-10-2008, 12:32 AM
I got the other error message when I inputted that PID (Error: no key found. maybe the PID is incorrect). This is an indication that the script is working, at least for some PIDs. It also indicates that the original PID might be mistyped (or the script may only work on some PIDs).

I've also tried loading the script through an oldish Windows machine. I read a tutorial explaining that in order to run it it is necessary to create a .bat file with the following:

This only brings up a message telling me how to use the application: I don't think you need a .bat file, but in any case the "usage" message is an indication that the script is being called with the wrong number of arguments (i.e. not 3). Some of the arguments may need to be in quotes.

pilotbob
07-10-2008, 12:43 AM
mobidedrm002.py inputfile.prc outputfile.prc PID
pause

You didn't put literally the above in the bat file, did you?

BOb

Haidon
07-11-2008, 05:55 AM
You didn't put literally the above in the bat file, did you?

BOb

No. I typed in the correct details for the files and the PID. I just used that as an example, as I tried it multiple ways, with and without quotation marks. Unfortunately nothing worked. I can think of no other reason for this to be other than what wallcraft suggested, that the script only works with some (likely most, but not all) PIDs.

red_dragon
07-18-2008, 09:39 AM
You could disable the PID check and examine what mobidedrm expects. After making the changes you have to pass a 8 char PID to the python program:

(Be careful with the indentions)

def __init__(self, data_file, pid):
### BEGIN NEW CODE ###
# Calculate PID checksum if just the first 8 chars are specified
if len(pid) == 8:
pid = checksumPid(pid)
print "Full PID is %s" % pid
### END NEW CODE ###
if checksumPid(pid[0:-2]) != pid:
raise DrmException("invalid PID checksum")
pid = pid[0:-2]


Does it work for you?

If the decrypted result is garbage then your PID is not correct.

-Red Dragon

adinb
07-25-2008, 12:21 AM
Does it work for you?

If the decrypted result is garbage then your PID is not correct.

-Red Dragon

I'm another one experiencing the problem...inserting the code into the python script computed the original checksum (WE) and correctly de-decrypted a couple of test books. (I used V.01 of the script for this testing)

Haidon
07-25-2008, 04:29 AM
You could disable the PID check and examine what mobidedrm expects. After making the changes you have to pass a 8 char PID to the python program:

(Be careful with the indentions)

def __init__(self, data_file, pid):
### BEGIN NEW CODE ###
# Calculate PID checksum if just the first 8 chars are specified
if len(pid) == 8:
pid = checksumPid(pid)
print "Full PID is %s" % pid
### END NEW CODE ###
if checksumPid(pid[0:-2]) != pid:
raise DrmException("invalid PID checksum")
pid = pid[0:-2]


Does it work for you?

If the decrypted result is garbage then your PID is not correct.

-Red Dragon

Success!

After adding the above code I managed to get the script working. The original PID still didn't work; strangely it returned a message telling me my 'FULL PID' was something different.

FULL PID is ----------

Note: I've blanked out the actual PID. What it suggested above was the same as the actual PID for the first 7 digits, and then with a different last three. MobiDeDRM wouldn't accept it as a PID either.

But when I took the last two digits off the PID, cutting it from 10 digits to 8, as red_dragon's code suggested, it worked flawlessly. It came up with a message similar to the one above, listing my actual PID instead of the incorrect one, and then decoded the file.

I've tried it on a number of files at its worked each time. If anyone else is having the same problem I recommend trying this.

Thanks to everyone who's helped solve this problem! :thanks:

adinb
07-25-2008, 04:18 PM
I'm going to go out on a branch here and bet that the "invalid" PIDs were all PID's from PCs (as opposed to "mobile" implementations of mobipocket PID's).

The "Dark Reverser" might want to update his official copy of his script to either diable PID checking or take PC PID checksums into account.

Glad to hear that this little mystery is getting cleared up for everyone w/issues.

wallcraft
07-26-2008, 11:51 AM
But when I took the last two digits off the PID, cutting it from 10 digits to 8, as red_dragon's code suggested, it worked flawlessly. It came up with a message similar to the one above, listing my actual PID instead of the incorrect one, and then decoded the file. The PID for a Windows PC often (always?) has a $ as the 8th character, and I think this is what is causing the problem. On a Mac (and Linux), but not under Windows, this may be replaced by some other character before the python script even sees its arguments. What actually gets changed is some string starting with $ and this probably does not happen if the $ is last, i.e. when using the new 8-character PID option. There have been reports of success using single quotes around the PID (double quotes don't work), see Mobipocket Decoder Tool, post 120 (http://www.mobileread.com/forums/showpost.php?p=221813&postcount=120) and subsequent posts. The makes sense because single quotes turns off the command line replacement of $.

Surfergirl
08-02-2008, 04:44 PM
The PID for a Windows PC often (always?) has a $ as the 8th character, and I think this is what is causing the problem.

I've got this problem - my PID is from a PC and has a $ as the 8th character. I'm fairly computer literate, but don't know anything about Python and am not sure what changes need to be made to the mobidrdrm program.

If I send my PID to someone, could they run it through the calculation script, and tell me what the correct PID actually is? I'm desparate to get the DRM-stripping working, as a book is due to be released very soon which is only available in MOBI (and I've got a Sony Reader!)

Thanks, Irene

llasram
08-02-2008, 08:47 PM
I've got this problem - my PID is from a PC and has a $ as the 8th character. I'm fairly computer literate, but don't know anything about Python and am not sure what changes need to be made to the mobidrdrm program.

What platform are you running mobidedrm on? Looking back over this thread it looks to me like everyone having this problem was running OS X or GNU/Linux and wasn't putting their $-containing PID in single quotes. Did you you try that?

Hope this helps!,

-Marshall

=X=
08-03-2008, 12:21 AM
The PID for a Windows PC often (always?) has a $ as the 8th character, and I think this is what is causing the problem.

I've got this problem - my PID is from a PC and has a $ as the 8th character.

Thanks, Irene

Hi Surfergirl, look back to post #15 & #13 have the answer to your problem.
Your PC PID is a 10 digit, where the eight digit is a $, put your PID in single quotes and drop of the last two char so if your PID. So if your PID is 1234567$90 change it to '1234567$' (include single quotes).

=X=

JSWolf
08-03-2008, 12:30 AM
Or create a PID you can use without a $ and add that to your list of PIDs so when you do go to use MobiDeDRM.py, you won't have to worry about a $.

Leep
08-03-2008, 12:51 AM
Have you tried Pdurrants hack to fix a couple of mobidedrm issues?
http://www.mobileread.com/forums/sho...4&postcount=76

wallcraft
08-03-2008, 11:26 AM
The PID for a Windows PC often (always?) has a $ as the 8th character, and I think this is what is causing the problem.

I've got this problem - my PID is from a PC and has a $ as the 8th character. If putting the full 10-digit PID in single quotes does not work, then check to see if you have mistyped 1 for I or 0 for O (or I for 1, O for 0).

Surfergirl
08-03-2008, 05:19 PM
What platform are you running mobidedrm on? Looking back over this thread it looks to me like everyone having this problem was running OS X or GNU/Linux and wasn't putting their $-containing PID in single quotes. Did you you try that?

Hope this helps!,

-Marshall

Hi. Yep - tried that. Still comes back with "Invalid PID checksum". :( And I'm running on Windows XP.

Irene

Surfergirl
08-03-2008, 05:20 PM
Hi Surfergirl, look back to post #15 & #13 have the answer to your problem.
Your PC PID is a 10 digit, where the eight digit is a $, put your PID in single quotes and drop of the last two char so if your PID. So if your PID is 1234567$90 change it to '1234567$' (include single quotes).

=X=

Hi. Unfortunately, tried that already - still just comes back with "invalid PID checksum".

Surfergirl
08-03-2008, 05:21 PM
Or create a PID you can use without a $ and add that to your list of PIDs so when you do go to use MobiDeDRM.py, you won't have to worry about a $.

Hi Jon. I know this must sound like a real dumb question, but how do I create a new PID??

Thanks, Irene

JSWolf
08-03-2008, 05:22 PM
Do you maybe have access to a Windows machine to try this on?

Surfergirl
08-03-2008, 05:59 PM
Do you maybe have access to a Windows machine to try this on?

I'm using a Windows XP machine!

wallcraft
08-04-2008, 08:35 PM
One problem with mobidedrm is that it does not do any "sanity checking" of its arguments. This would normally be easy to fix, but modifying mobidedrm.py is not legal in the US. So I attach argecho.py from Dive Into Python (http://diveintopython.org/scripts_and_streams/command_line_arguments.html). If you have problems with mobidedrm, or any other python script, replace the command with argecho. This is almost the simplest possible python program. All it does is echo its arguments, one per line with the 1st line being the command name. For example:

C:\Documents and Settings\alan\My Documents\My eBooks\SOFTWARE>argecho test file.prc test file.mobi V176CXM*FZ
C:\Documents and Settings\alan\My Documents\My eBooks\SOFTWARE\argecho.py
test
file.prc
test
file.mobi
V176CXM*FZ This first attempt did not have quotes around the filename, and so what should have been 3 arguments became 5 arguments and the third argument (4th output line) is "test" instead of "V176CXM*FZ". The 1st line of output starts with "C:" because I have argecho.py in the current directory. Adding quotes around the filenames gives the expected 3 arguments.
C:\Documents and Settings\alan\My Documents\My eBooks\SOFTWARE>argecho "test file.prc" "test file.mobi" V176CXM*FZ
C:\Documents and Settings\alan\My Documents\My eBooks\SOFTWARE\argecho.py
test file.prc
test file.mobi
V176CXM*FZ There are no doubt many better ways to debug python scripts than using argecho, but using argecho would have made finding past issues with mobidedrm (for example) much easier.

pdurrant
08-05-2008, 05:38 AM
Best to use my second set of hacks, which actually fix the problem rather than masking it :-)

http://www.mobileread.com/forums/showpost.php?p=222142&postcount=125

Paul

Have you tried Pdurrants hack to fix a couple of mobidedrm issues?
http://www.mobileread.com/forums/sho...4&postcount=76

Surfergirl
08-06-2008, 09:44 AM
Thank you to everyone who has chipped in with suggestions for my problem.

Argecho.py confirms that I'm using the correct number of arguments to the Python script, I've updated MobiDeDrm using pdurrant's list of changes. I've even tried reinstalling Python from scratch, in case something got screwed in the initial install .... unfortunately, I just keep getting the "invalid PID" error with both of my PIDs. I can't think of anything else to try, so I think I'm just going to have to write this off as a bad job - it's just incredibly frustrating when other people get the script to work without a problem.

My stepson is a Mac addict, so I might try running the script on his machine if he's got Python installed.

Thanks again for all your help
Irene

dickon25
10-07-2008, 06:07 PM
You could disable the PID check and examine what mobidedrm expects. After making the changes you have to pass a 8 char PID to the python program:

(Be careful with the indentions)

def __init__(self, data_file, pid):
### BEGIN NEW CODE ###
# Calculate PID checksum if just the first 8 chars are specified
if len(pid) == 8:
pid = checksumPid(pid)
print "Full PID is %s" % pid
### END NEW CODE ###
if checksumPid(pid[0:-2]) != pid:
raise DrmException("invalid PID checksum")
pid = pid[0:-2]


Does it work for you?

If the decrypted result is garbage then your PID is not correct.

-Red Dragon


When I try this, inputting the shortened 8 digit PID, it tells me the correct PID is the 10 digit 'abc123...' - which is exactly what it rejected in the first place!
It then gives me 'invalid PID checksum' and does not convert.

I'm using v0.4 of MobideDRM and the PID is for a Windows PC running XP.

Does anyone have any other ideas, please?

Thanks
:help:

Leep
10-07-2008, 07:26 PM
Thank you to everyone who has chipped in with suggestions for my problem.

Argecho.py confirms that I'm using the correct number of arguments to the Python script, I've updated MobiDeDrm using pdurrant's list of changes. I've even tried reinstalling Python from scratch, in case something got screwed in the initial install .... unfortunately, I just keep getting the "invalid PID" error with both of my PIDs. I can't think of anything else to try, so I think I'm just going to have to write this off as a bad job - it's just incredibly frustrating when other people get the script to work without a problem.

My stepson is a Mac addict, so I might try running the script on his machine if he's got Python installed.

Thanks again for all your help
Irene
How sure are you that the drm on the book is one of the PIDs that you are trying. I (and several other people) ran into this same error because the PID that we input was not the actual PID on the book. Maybe you can get someone that is successfully using Mobidedrm to do a test for you and then you would at least know whether it's an installation problem or an incorrect PID.

cheers

dickon25
10-07-2008, 07:41 PM
How sure are you that the drm on the book is one of the PIDs that you are trying. I (and several other people) ran into this same error because the PID that we input was not the actual PID on the book. Maybe you can get someone that is successfully using Mobidedrm to do a test for you and then you would at least know whether it's an installation problem or an incorrect PID.

I wondered about this. I thought the PID related to the device (ie my PC) rather than the book but, just to be on the safe side, I re-registered my PID with the vendor (BOB) then re-downloaded the book (so, presumably, the book was then 'tagged' with that PID?). I then put that book through the same system.....and got the same result - invalid PID checksum. How can that be, if BOB accepted it as a valid PID?

Yours, more confused every minute, etc........:smack:

JSWolf
10-07-2008, 07:57 PM
Try reading the eBook with Mobipocket Reader. If it's one that needs a UN/PW then it won't work till you've copied it to a portable device such as a memory card.

pilotbob
10-07-2008, 09:01 PM
I then put that book through the same system.....and got the same result - invalid PID checksum. How can that be, if BOB accepted it as a valid PID?

Yours, more confused every minute, etc........:smack:

Are you sure you are doing the right file? Someone else here had a problem using this and it turned out the book was downloaded to a different location than they expected. I don't recall if it was the same error, but I do recall it was BoB they had an issue with.

I tried to find the thread... but can't.

BOb

pdurrant
10-08-2008, 04:42 AM
Are you enclosing the PID in single quotes? Some PIDs have strange characters that command lines don't like unquoted.

Paul

When I try this, inputting the shortened 8 digit PID, it tells me the correct PID is the 10 digit 'abc123...' - which is exactly what it rejected in the first place!
It then gives me 'invalid PID checksum' and does not convert.

I'm using v0.4 of MobideDRM and the PID is for a Windows PC running XP.

Does anyone have any other ideas, please?

Thanks
:help:

dickon25
10-08-2008, 12:15 PM
Thanks for the suggestions and sorry for delay in replying (sleep/work gets in the way!!).
Following suggestions from elsewhere, I've got the book and the MobideDRM in the same folder - so I think I'm OK on that one.
I've tried the PID with 8 or 10 digits, with and without single quotes and get the same result each time.

dickon25
10-08-2008, 05:55 PM
OK. A couple of members have PM'd me and my PID has been checked - seems OK.
I can read the book fine through MobiReader on my PC.
One member suggested I post the exact line I'm inputting, so here it is:

mobidedrm.py firstbook.prc secondbook.prc 'PID'
Pause

...where 'PID' is the actual PID characters, of course, and I've tried both with and without the single quotes.

Any and all suggestions gratefully received......
Thanks.

JSWolf
10-08-2008, 05:59 PM
Try again, but this time make sure no spaces or extended characters are used. That way, you need no quotes. Also, what version MobideDRM.py do you have? if you have 0.02, it could be that you need 0.01. If you have 0.03, it could be the bug has gotcha and you need 0.04, 0.02 or 0.01. If you have 0.04 then I have no idea the problem as it works for me.

What version Python do you have? Did you get Python from http://www.python.org?

pilotbob
10-08-2008, 06:01 PM
OK.
One member suggested I post the exact line I'm inputting, so here it is:

mobidedrm.py firstbook.prc secondbook.prc 'PID'
Pause


Are you using the PID from your PC or from your device? Do you have more than 1 PID entered in the book store and are they all valid mobi PIDs? Not sure if this will matter but try double quotes instead of single. Also, try no quotes. Does that matter?

I also assume that neither of the book file names have spaces or special characters in them? If so, you would need to surround them with double quotes too. (Because I'm sure the above is not the "exact" line that you are using.)

BOb

dickon25
10-08-2008, 06:24 PM
The PID I'm using is the one from my PC.
I'm using v0.04 of MobideDRM but now have another copy so will try that (I've added the extra scipt from post #11 on this thread (the one about checking the PID)
Python is ActivePython-2.5.2.2-win32-x86 - as downloaded from the Python site.
No speacial characters in the book names etc......

Just had another PM and an offer I can't refuse......watch this space!

Thanks all.

Surfergirl
10-09-2008, 08:58 AM
Dickon25

It sounds like you're having exactly the same problem that I did (and I almost went bald from tearing my hair out). My book was valid, both my PIDs were valid, the version of python was up-do-date, but nothing I did would get past the infuriating "invalid PID" error.

The solution (supplied from another thread) was to make sure that you have actually *opened up* the purchased book - the act of opening it for reading does something clever to the DRM. Trying to run the script against the downloaded but unopened book failed miserably, but when I ran it against the *opened* version it worked perfectly. The post-opened book was stored somewhere like "My e-books", so if you try this you might have some success.

Keeping my fingers crossed for you! Good luck.

Irene

Alfy
10-09-2008, 10:13 AM
Nope, does not work either, at least for me.

I'm new to the thread, but my problem is just the same: invalid PID all over the place!

After your post, I took the prc file and opened it on my PC. that worked fine, although the file was on a USB key and no files were created in My Ebooks folder. Nevertheless, something happened, as I now have a new 4kb .mpb file on my key! I then went back to my mac and tried to run mobidedrm, but to no avail... Snif!

EDIT Or rather yes it does!!! This time, I connected my pc to the net and downloaded the book on it, and that time it worked! Thanks a lot for that! :iloveyou:

dickon25
10-09-2008, 02:37 PM
Surfergirl

It sounds like you're having exactly the same problem that I did (and I almost went bald from tearing my hair out). My book was valid, both my PIDs were valid, the version of python was up-do-date, but nothing I did would get past the infuriating "invalid PID" error.

Isn't this forum great?! When I caught the gremlins I searched and found this thread - so I knew your problem was the same. I couldn't see a solution though and thought you'd given up!
Thanks for the suggestion - I've tried that, and am trying it again with the assistance of one our wonderful techies here on the site. It's proving very complicated and the situation isn't helped by the fact that I'm a complete numpty on the tech side. Like you, all I want to do is read books!!

Thanks
Chris

dickon25
10-09-2008, 02:41 PM
Nope, does not work either, at least for me.

I'm new to the thread, but my problem is just the same: invalid PID all over the place!

After your post, I took the prc file and opened it on my PC. that worked fine, although the file was on a USB key and no files were created in My Ebooks folder. Nevertheless, something happened, as I now have a new 4kb .mpb file on my key! I then went back to my mac and tried to run mobidedrm, but to no avail... Snif!

EDIT Or rather yes it does!!! This time, I connected my pc to the net and downloaded the book on it, and that time it worked! Thanks a lot for that! :iloveyou:

Hi Alfy,
So glad it worked for you... but hey, I'm not bitter!!!!! :rofl: :)

Alfy
10-10-2008, 01:44 AM
Ouch!

Well, if it helps, here is one thing I noticed: books I purchased on mobipocket.com had their filename changed after I opened them with my PC: _r1 was added at the end of the filename, before the .prc.

Strange thing is, books I purchased on fictionwise already have _r1 at the end of the filename, and I can dedrm them without having to open them first.

You might want to go to fictionwise and grab a copy of their cheapest book for testing purposes.

Haidon
10-10-2008, 02:30 AM
When I try this, inputting the shortened 8 digit PID, it tells me the correct PID is the 10 digit 'abc123...' - which is exactly what it rejected in the first place!
It then gives me 'invalid PID checksum' and does not convert.

I'm using v0.4 of MobideDRM and the PID is for a Windows PC running XP.

Does anyone have any other ideas, please?

Thanks
:help:

I originally had this problem also, but just input the first 8 digits of the PID (like the code suggests) and it works perfectly. But then, I would just use the new version with the correct modifications to run it perfectly. Nonetheless, try typing in the first 8 digits only. Failing that, put the PID in 'single quotation marks', both 8 and 10 digit versions.

Haidon
10-10-2008, 02:33 AM
Dickon25

It sounds like you're having exactly the same problem that I did (and I almost went bald from tearing my hair out). My book was valid, both my PIDs were valid, the version of python was up-do-date, but nothing I did would get past the infuriating "invalid PID" error.

The solution (supplied from another thread) was to make sure that you have actually *opened up* the purchased book - the act of opening it for reading does something clever to the DRM. Trying to run the script against the downloaded but unopened book failed miserably, but when I ran it against the *opened* version it worked perfectly. The post-opened book was stored somewhere like "My e-books", so if you try this you might have some success.

Keeping my fingers crossed for you! Good luck.

Irene

I'm not aware that that is the case. I download my ebooks on a mac, which naturally doesn't have the software to open the files, but I can still strip the DRM on the same machine without them ever having been opened.

dickon25
10-10-2008, 04:25 PM
I download my ebooks on a mac, which naturally doesn't have the software to open the files, but I can still strip the DRM on the same machine without them ever having been opened.

Books clearly behave differently! I've now got a non-DRM version, but it had to be opened and read first......which is what Surfergirl had to do as well. Ah well, there's something to look forward to next time (sigh....).

Thanks to all for the suggestions and practical help offered and given. :thanks:

pilotbob
10-11-2008, 12:54 PM
On a Mac (and Linux), but not under Windows, this may be replaced by some other character before the python script even sees its arguments. There have been reports of success using single quotes around the PID

Brilliant! No wonder it would work on my Windows machine and not my Mac... but worked with my Kindle PID but not my PC PID.

I spent all this time putting python 2.6 on my Mac thinking it was a python version thing. I should have come here first. The forum saves me again!

I LOVE THIS PLACE!!!

BOb

NedScharpf
11-17-2008, 11:37 AM
I still cant get it to work - I opened the book, I put in the first 8 digits only, etc., etc. Ah! I am so frustated. You guys have been incredibly helpful though.

Any words of wisdom?

Ned

slayda
11-17-2008, 12:16 PM
You have to enter the entire PID. You may be getting it confused with ereader2html which uses your credit card (last) 8 digits.

NedScharpf
11-17-2008, 12:48 PM
But when I enter the entire pid I get the old - When I try this, inputting the shortened 8 digit PID, it tells me the correct PID is the 10 digit 'abc123...' - which is exactly what it rejected in the first place!
It then gives me 'invalid PID checksum' and does not convert.

pilotbob
11-17-2008, 12:54 PM
But when I enter the entire pid I get the old - When I try this, inputting the shortened 8 digit PID, it tells me the correct PID is the 10 digit 'abc123...' - which is exactly what it rejected in the first place!
It then gives me 'invalid PID checksum' and does not convert.

If you get invalid pid checksum then the pid you are passing in is not valid. What OS are you using? Make sure if it is a Mac you are using single quotes not double quotes on the command line.

BOb

NedScharpf
11-17-2008, 01:30 PM
I get an error saying that the pid I am using does not match the file. I am sure this is related to Fictionwise changing the pid (they took out the * before the last 2 digits and I am unable to delete that pid or ad a new one). I am running WindowsXP.

Thanks for your help!!

wallcraft
11-17-2008, 02:44 PM
I get an error saying that the pid I am using does not match the file. I am sure this is related to Fictionwise changing the pid (they took out the * before the last 2 digits and I am unable to delete that pid or ad a new one). I am running WindowsXP. The PIDs with a "*" are Kindle PIDs, not Windows Desktop PIDs (these typically have a "$" as 8th character). Look under "devices" in Windows Desktop MobiPocket Reader, and it should include the PID for your Windows PC. Register this with FictionWise and redownload the ebooks. Confirm that you can open them with Windows Desktop MobiPocket Reader, then use mobidedrm with the newly registered PID.

pilotbob
11-17-2008, 03:03 PM
I get an error saying that the pid I am using does not match the file. I am sure this is related to Fictionwise changing the pid (they took out the * before the last 2 digits and I am unable to delete that pid or ad a new one). I am running WindowsXP.

Thanks for your help!!

You will have to email them to remove the bad PID.

BOb

mrgiedrnkr
12-29-2008, 08:58 PM
UGH! I am pulling my hair out. I have v.05 of mobiderdrm.py. I keep getting invalid PID Checksum. I have tried single quotes, double quotes, the backslash. everything! The number I am entering is the number that is showing on my MobipocketReader for my PC and the number I registered at fictionwise. I want to convert the files to run on my sony prs505.

Any advice?
Stacy

wallcraft
12-29-2008, 10:46 PM
UGH! I am pulling my hair out. I have v.05 of mobiderdrm.py. I keep getting invalid PID Checksum. I have tried single quotes, double quotes, the backslash. everything! The number I am entering is the number that is showing on my MobipocketReader for my PC and the number I registered at fictionwise. This is often caused by a problem with the filenames - these are what typically need to be in quotes. On a Mac, a PID with a $ may need single quotes otherwise the naked PID is usually ok. Even v0.05 does not have good command line error reporting. You might try argecho from post #27 (http://www.mobileread.com/forums/showpost.php?p=228313&postcount=27).

pilotbob
12-30-2008, 12:51 AM
U

Any advice?
Stacy

Show us the exact command line you are passing to it. I'm guessing that you are missing a parameter or you are not putting quotes around file names that have spaces in them.

BOb

Jean
02-18-2009, 07:35 PM
I was trying to use the script shown in post #11:

def __init__(self, data_file, pid):
### BEGIN NEW CODE ###
# Calculate PID checksum if just the first 8 chars are specified
if len(pid) == 8:
pid = checksumPid(pid)
print "Full PID is %s" % pid
### END NEW CODE ###
if checksumPid(pid[0:-2]) != pid:
raise DrmException("invalid PID checksum")
pid = pid[0:-2]

but I keep getting the response:

IndentationError: unexpected indent

could someone please explain what the possible problem could be? Thanks.

Jean

wallcraft
02-18-2009, 07:53 PM
I was trying to use the script shown in post #11 See pid_checksum.py (http://www.mobileread.com/forums/showpost.php?p=317502&postcount=233).

pilotbob
02-18-2009, 08:30 PM
IndentationError: unexpected indent

could someone please explain what the possible problem could be? Thanks.

Jean

Where did you get the script from. White space (tabs and such) is significant in Python. So, if maybe you cut and paste this from somewhere it might have been wrapping text and you didn't get the full lines.

BOb

Jean
02-20-2009, 03:55 PM
I tried the pid_checksum.py script and it resulted in different checksum's than what I had been using for both my Kindle PID and my PC's PID.

Unfortunately I still get an error message -- "Error: invalid PID checksum".
I am thinking though that perhaps the book I am trying to de-drm has no drm to begin with. Would that give me an error message? At this point I am thinking of making a new purchase of a book I know has DRM included and retrying it.

I aslo tried using mobidedrm on a .pdb file but it didn't work - does mobidedrm work on .pdb files?

Pilotbob - I got the script from post #11 (page 1) of this thread posted by Red Dragon.
I copied it to notepad and renamed it as a .py script and saved it to my Python25 directory. When I tried to run it (from the command window while in the Python 25 directory) I recieved the 'unexpected indent' error. I don't know anythihg about python scripting so I don't know what the problem is.

Thanks for the assistance.

Jean

pilotbob
02-20-2009, 03:59 PM
Pilotbob - I got the script from post #11 (page 1) of this thread posted by Red Dragon.
Thanks for the assistance.

Jean

you didn't get the mobidedrm script from here... that's what I meant.

BtW: You don't have to buy something to test this. Both fictionwise and booksonboard have free test ebooks each each format.

Can you read the book in Stanza or calibre as it is? If so, there is no DRM on it.

BOb

wallcraft
02-20-2009, 08:20 PM
Unfortunately I still get an error message -- "Error: invalid PID checksum". The usual reason for this is spaces in the filenames, for example the command: pid_checksum file name1.prc file name2.prc XXXPIDXXXX has 5 arguments and its 3rd argument is file. The pid_checksum script will detect that you are using 5 arguments by mistake, but mobidedrm just tells you that the PID checksum is wrong. The fix is to use quotes: pid_checksum "file name1.prc" "file name2.prc" XXXPIDXXXX

wallcraft
02-21-2009, 03:15 PM
I tried the pid_checksum.py script and it resulted in different checksum's than what I had been using for both my Kindle PID and my PC's PID. Forget my previous post. I now think this means that the PIDs have typos, check for 1 vs I and 0 vs O.

wolfsi
02-22-2009, 12:38 AM
I didn't read all the posts but I found out that all letters in the PID have to be in upper case. That what helped me after a few error messages.

wolfsi

Jean
02-23-2009, 07:11 PM
OK - I tried again to use mobidedrm on one of my .prc files using capital letters in the PID.
This time instead of getting an invalid PID checksum error I now get an 'invalid file format' error.

From within the Python25 prompt in the command window I am typing:
mobidedrm.py inputfile.prc outputfile.mobi PID

There are no spaces in my file names and the mobidedrm.py file and my .prc file are located in the Python25 directory. Does anyone have any suggestions or thoughts on what the problem may be? Thanks again for all the assistance.

Jean

Marysart
03-10-2009, 05:59 AM
From within the Python25 prompt in the command window I am typing:
mobidedrm.py inputfile.prc outputfile.mobi PID

There are no spaces in my file names and the mobidedrm.py file and my .prc file are located in the Python25 directory. Does anyone have any suggestions or thoughts on what the problem may be? Thanks again for all the assistance.

Jean

I think both input and outputfile need to be .prc

mrgiedrnkr
03-11-2009, 12:15 PM
I use a .prc infile and a .mobi outfile as well. However, I have to put my PID in double quotes. Then, it works great.
Stacy

tubamann
04-15-2009, 02:43 AM
Thank you mrgiedrnkr, that's what I had to do as well :)

Reddevil
05-24-2009, 05:58 AM
Just as a side note - I couldn't get mobidedrm to work unless I renamed my input .prc file from the original mobipocket name (something stupid like 92032322_90232322.prc) to a short name like dummies.prc.

I suspect the underscore in the name causes some sort of parse error when the script is being executed.

I must have messed around with mobidedrm for a good 2 hours banging my head against a wall since I knew my PID was exactly what was in mobipocket reader and PIDchecksum said the same thing but it still wouldn't work.

Renamed the file and it worked first shot. I didn't need to put my PID in quotes either.

delphidb96
05-24-2009, 06:05 PM
Just as a side note - I couldn't get mobidedrm to work unless I renamed my input .prc file from the original mobipocket name (something stupid like 92032322_90232322.prc) to a short name like dummies.prc.

I suspect the underscore in the name causes some sort of parse error when the script is being executed.

I must have messed around with mobidedrm for a good 2 hours banging my head against a wall since I knew my PID was exactly what was in mobipocket reader and PIDchecksum said the same thing but it still wouldn't work.

Renamed the file and it worked first shot. I didn't need to put my PID in quotes either.


Just so you know. SOME of those file names have TWO underscores in a row and, depending upon which font your computer uses to display filenames, this may not be obvious. Yep. Those 'double-underscore' names have tripped me up more than once - until I started using the 'Rename' option to grab the filename to the clipboard... :D :D :D

Derek

kevindorsey
06-22-2009, 01:12 PM
Just so you know. SOME of those file names have TWO underscores in a row and, depending upon which font your computer uses to display filenames, this may not be obvious. Yep. Those 'double-underscore' names have tripped me up more than once - until I started using the 'Rename' option to grab the filename to the clipboard... :D :D :D

Derek

LMAO. Nice way to finish the thread.

mindwarp
07-06-2009, 09:04 PM
I've been having this same problem. I can't for the life of me figure out what I'm doing wrong. But I continue to get Invalid PID Checksum.
I have a Macbook and a Ipod Touch and am using Iphone Backup extractor to get my Kindle files.
I got my UDID from Itunes and then used kindlepid.py to get my Mobipocket PID
I have python and wxpython installed and working. I've used mobidedrm 01, 02 and 05 and nothing seems to work.
I've tried all the suggestions of quoting my PID, making sure its capitalized, renaming the .prc ebook and so on.

This is what continues to come up:
macbook:ebook home$ python mobidedrm005.py ebook.prc output.prc 'PID'
MobiDeDrm v0.05. Copyright (c) 2008 The Dark Reverser
Error: invalid PID checksum

Any ideas on how I can go about figuring this out? Is it possible my PID is wrong?

Thanks so much!

wallcraft
07-06-2009, 09:27 PM
I continue to get Invalid PID Checksum. Try using pid_checksum.py (http://www.mobileread.com/forums/showpost.php?p=317502&postcount=233). Note that 0 vs O and 1 vs I are common errors, although in this case there is also the possibility that kindlepid returned the wrong PID (because it was given the wrong UDID).

Also, make sure you don't have Python 3.X which does not work.

mindwarp
07-06-2009, 10:16 PM
Try using pid_checksum.py (http://www.mobileread.com/forums/showpost.php?p=317502&postcount=233). Note that 0 vs O and 1 vs I are common errors, although in this case there is also the possibility that kindlepid returned the wrong PID (because it was given the wrong UDID).

Also, make sure you don't have Python 3.X which does not work.

Thanks for the reply.

I've tried pid_checksum and it said Mobipocket PID is correct. There are no 0 or 1 in my PID so I'm clear there. I'm using python 2.6.2.

I'm beginning to think that the wrong PID must have been generated from my Ipod UDID, cause I'm running out of ideas. lol

wallcraft
07-06-2009, 11:02 PM
I'm beginning to think that the wrong PID must have been generated from my Ipod UDID, cause I'm running out of ideas. I agree, because it is unlikely that a "random" PID-like string has a good checksum. Try generating the PID from the UDID again.

wallcraft
07-06-2009, 11:18 PM
Error: invalid PID checksum This is confusing, because pid_checksum.py with EXACTLY the same command line (right?), i.e. with mobidedrm005.py replaced with pid_checksum.py, did not give a checksum error.

mindwarp
07-06-2009, 11:59 PM
This is confusing, because pid_checksum.py with EXACTLY the same command line (right?), i.e. with mobidedrm005.py replaced with pid_checksum.py, did not give a checksum error.

Right. I typed it up here wrong, but it has the exact same command line just replacing mobidedrm005.py with pid_checksum.py.

I tried seeing if I had another UDID anywhere or if it would change if I restored my Ipod, but it didn't. I really have no clue, because the checksum says it's correct.

I've tried different files and typed in different extensions (.azw and .prc) But no avail.

Thanks for the suggestions!

wallcraft
07-07-2009, 12:26 AM
But no avail. Try the suggestion in post #4 (http://www.mobileread.com/forums/showpost.php?p=210779&postcount=4). This it isn't much but it is all I have left.

mindwarp
07-07-2009, 12:41 AM
Try the suggestion in post #4 (http://www.mobileread.com/forums/showpost.php?p=210779&postcount=4). This it isn't much but it is all I have left.
Thanks I did find something odd. I tried the sample PID given with pid_checksum and typed it in instead of my PID and it came out as correct.... and when I posted it with mobidedrm005.py it said invalid PID checksum instead of what it should have said (Error: no key found. maybe the PID is incorrect).

I don't know what that means, but I found that odd. Even if you don't have any more ideas, thanks so much for trying to help!

mindwarp
07-07-2009, 02:51 AM
I finally got one to work! lol It seems that all the kindle books I was using came up as invalid file type when I used mobidedrm.py (when I used mobidedrm005.py it said invalid PID) I download quite a few free kindle ebooks and samples and tested them out. Some worked with mobidedrm.py but none worked with mobidedrm005.py.

I haven't figured out why only some will work, but none with the newer mobidedrm.

I did notice that if the sample was drmed then I couldn't undrm the full book, but if the sample wasn't drmed then I could undrm the full book. Not sure why that is though... lol

Thanks again, wallcraft!

wallcraft
07-07-2009, 11:21 AM
I finally got one to work! lol It seems that all the kindle books I was using came up as invalid file type when I used mobidedrm.py (when I used mobidedrm005.py it said invalid PID) I download quite a few free kindle ebooks and samples and tested them out. Some worked with mobidedrm.py but none worked with mobidedrm005.py. You may have a corrupted version of v5, but I have suspected in other cases on the Mac that the "checksum" error is coming up when some other error is actually invoked. You seem to have confirmed this.

DRM-free AZW's should give a different error, but they don't need mobidedrm at all. I was not aware that any samples had DRM. Are the ebooks (samples or otherwise) that fail completely TOPAZ ebooks (file extension .tpz or .azw1)? This is an Amazon-specific format that no one outside Amazon knows how to read.

See kindledrm.py (http://www.mobileread.com/forums/showpost.php?p=410263&postcount=10) for a script to identify DRM-free AZW ebooks.

mindwarp
07-07-2009, 01:38 PM
DRM-free AZW's should give a different error, but they don't need mobidedrm at all. I was not aware that any samples had DRM. Are the ebooks (samples or otherwise) that fail completely TOPAZ ebooks (file extension .tpz or .azw1)? This is an Amazon-specific format that no one outside Amazon knows how to read.

See kindledrm.py (http://www.mobileread.com/forums/showpost.php?p=410263&postcount=10) for a script to identify DRM-free AZW ebooks.Hey! Yep, the books I was trying to convert that came up with checksum error were all Tpz. Both in Samples and the Full book. Seems I had a lot of this format and I wasn't aware. Paul was gracious enough to show me how to figure out what format it's in. I didn't know, because when you extract from an IPhone/Itouch the format is always .prc. No matter if it's azw, azw1 or tpz. Good for future knowledge too anyone that uses this device. :)

Thanks again

nohmi2
07-15-2009, 09:05 AM
Oh frabjous joy!!!

Downloaded two books from PanMcMillan.
Converted one with no trouble at all. Tried to convert the second one (same PID, same method) wrong PID.
Before clocking in here, had a look at our local e-newspaper and this is what greeted me:

:eek:Tsunami warning for east coast

is on a tsunami alert following an earthquake off New Zealand.

3 comments on this story

Twitter: Latest tsunami talk

:)All help with the MobiDeDRM would be appreciated.

Some days it doesn't pay to get up does it?

Cheers

pdurrant
07-15-2009, 09:48 AM
Downloaded two books from PanMcMillan.
Converted one with no trouble at all. Tried to convert the second one (same PID, same method) wrong PID.


Some PanMcMillan ebooks are DRM free. Check to see if it really does have DRM first?

nohmi2
07-15-2009, 07:52 PM
Some PanMcMillan ebooks are DRM free. Check to see if it really does have DRM first?

:book2:Will have a look today.

Many thanks.:2thumbsup

nohmi2
07-16-2009, 01:24 AM
It was DRM free.

I really cannot understand their reasoning, but I will remember that fact when I buy from them again.

Many thanks.

Dowland
08-05-2009, 06:54 PM
Here comes a lengthy post to summarize the problem and give an actual solution. Please don't hesitate to reproduce this elsewhere. And also, please don't bury this post in the thread, because then nobody will ever find it ... :-)
*

Background info. A MobiPocket PID is 10 characters: 8 characters are the actual key, and 2 characters are the checksum.

Now, before doing its deed, MobileDRM looks at the PID you gave: it controls whether the checksum and the key actually correspond. If they dont, then it gives the error message we all know ("Error: invalid PID checksum"). If they do, then it cuts away the last 2 characters of the PID, and keeps only the key for the remainder of its operation.

Problem. The issue, at least in mobiledrm005.py, is that it accidentally repeats this operation twice (probably whoever wrote this did an unwitting double copy-paste). So scenario 1: your PID is incorrect, and it gets rejected on the first check. And scenario 2: your PID is correct, it passes the first check, gets shortened to its key component, and then flunks the second check.

Solution. Remove the first block from the initialization the code
Please contact the OP for this code, as we are not allowed to host Python code of this nature on MR. Thanks for your understanding.

Moderator
Outro. It may very well be that your PID is actually incorrect, and you should browse this thread for ways to find out.

Also: opening the book after buying it unnecessary (except if your vendor does some non-standard thing I've never heard about). If this seems like it works, than a possible explanation is that opening the book actually removes the DRM (and then running MobileDRM on it gives the appearance that it actually worked ...).

Finally: no, I've never seen (valid) MobiPocket PIDs with anything but uppercase alphanumerical characters...

pdurrant
08-06-2009, 05:32 AM
Problem. The issue, at least in mobiledrm005.py, is that it accidentally repeats this operation twice (probably whoever wrote this did an unwitting double copy-paste).

This is a copying error somewhere along the way to you. The original 0.05 certainly didn't have this duplicate code.

Robotech_Master
08-09-2009, 02:01 AM
I'm trying to extract a couple of the free Kindle books I downloaded to my iPod, just to see if I can. I jailbroke and copied them over, and tried to run mobiddrm using the key I generated from my UDID and got the following:

python2.5 mobiddrm01.py B000FCK3C8_EBOK.prc maxride.prc "KT18ZMY*6X"
MobiDeDrm v0.01. Copyright (c) 2008 The Dark Reverser
Error: no key found. maybe the PID is incorrect

I did the checksum thing and it said the key was correct. As far as I can tell, it is encrypted (at least, when I open it with FBReader, I get gibberish).

Any suggestions? Did I perhaps generate the key from the UDID wrong?

pilotbob
08-09-2009, 02:41 AM
I did the checksum thing and it said the key was correct. As far as I can tell, it is encrypted (at least, when I open it with FBReader, I get gibberish).

Any suggestions? Did I perhaps generate the key from the UDID wrong?

It's probably content encrypted. There is a script to remove that to... somewhere. Search around.

BOb

wallcraft
08-09-2009, 01:02 PM
MobiDeDrm v0.01. Copyright (c) 2008 The Dark Reverser This is a very old version, the latest is v0.05. One place to look for information about these scripts is in the comments to the Darkreverser's Weblog.

Robotech_Master
08-12-2009, 06:12 PM
Still does the same thing with 0.05.

mrgiedrnkr
08-12-2009, 06:36 PM
I did an iphone/kindle extract today and I had to put single quotes around my python generated PID. I tried no quotes, double quotes and single quotes until I got one to work.
Stacy

Robotech_Master
08-14-2009, 01:41 AM
I tried single quotes, still got the same result.

gatorfan
08-30-2009, 11:34 PM
Here comes a lengthy post to summarize the problem and give an actual solution. Please don't hesitate to reproduce this elsewhere. And also, please don't bury this post in the thread, because then nobody will ever find it ... :-)
*

Background info. A MobiPocket PID is 10 characters: 8 characters are the actual key, and 2 characters are the checksum.

Now, before doing its deed, MobileDRM looks at the PID you gave: it controls whether the checksum and the key actually correspond. If they dont, then it gives the error message we all know ("Error: invalid PID checksum"). If they do, then it cuts away the last 2 characters of the PID, and keeps only the key for the remainder of its operation.

Problem. The issue, at least in mobiledrm005.py, is that it accidentally repeats this operation twice (probably whoever wrote this did an unwitting double copy-paste). So scenario 1: your PID is incorrect, and it gets rejected on the first check. And scenario 2: your PID is correct, it passes the first check, gets shortened to its key component, and then flunks the second check.

Solution. Remove the first block from the initialization the code (as this is Python code, you have to be very careful with the indentation), i.e. change:
def __init__(self, data_file, pid):

if checksumPid(pid[0:-2]) != pid:
raise DrmException("invalid PID checksum")
pid = pid[0:-2]

if checksumPid(pid[0:-2]) != pid:
raise DrmException("invalid PID checksum")
pid = pid[0:-2]

to:
def __init__(self, data_file, pid):

if checksumPid(pid[0:-2]) != pid:
raise DrmException("invalid PID checksum")
pid = pid[0:-2]

That line that appears twice "pid = pid[0:-2]", is what shortens the PID (it means "take all but the last two characters of this string and replace the original").

Outro. It may very well be that your PID is actually incorrect, and you should browse this thread for ways to find out.

Also: opening the book after buying it unnecessary (except if your vendor does some non-standard thing I've never heard about). If this seems like it works, than a possible explanation is that opening the book actually removes the DRM (and then running MobileDRM on it gives the appearance that it actually worked ...).

Finally: no, I've never seen (valid) MobiPocket PIDs with anything but uppercase alphanumerical characters...

After a week of trying to figure out exactly what I was doing wrong, including searching different internet sites, the above post solved my problem.

I thank you and my blood pressure thanks you!

Dan de V
09-01-2009, 01:19 PM
Dowland,
Thank you very much for summarizing the issue so well. I have read through pages and pages of posts to try and fix my "invalid PID checksum" problem with my copy of mobidedrm005. Even the 1st 6 pages of this thread....shows I should read backwards on threads here :o)

Being of suspicious mind I now wonder if the repeat code has been deliberately added to discourage people from trying to strip the DRM off mobi files.......I might hurriedly add that I actually got the faulty mobidedrm005 script from another site!

Sydney's Mom
09-01-2009, 03:24 PM
Ooh, and I thought I was paranoid!

sahmad88
09-07-2009, 11:46 AM
I tried single quotes, still got the same result.

I have this exact same problem. Here is a bit of background. I had a MacBook Pro with Leopard on it. And I had an iPhone. Everything worked fine at this point. Then my iPhone had a display problem and they replaced it. Then my MacBook had some hardware failure in the first 30 days, and they replaced that. I now have Snow Leopard on my mac.

I generated a new PID from my new iPhone. Now I can't get it to work at all, and I get the exact same error that Robotech Master gets: Error: no key found. maybe the PID is incorrect

I have tried this on a book that worked before. The only problem is, I don't have the original file. When my mac failed, at that point I didn't have a backup. So I am not sure if there is something new that is being done on Kindle books to try to defeat this.

Thank you all for your help.

Juliette
09-27-2009, 03:40 AM
Some PanMcMillan ebooks are DRM free. Check to see if it really does have DRM first?

Saved my life (and my sanity). Thanks!

kevindorsey
09-28-2009, 07:39 PM
Saved my life (and my sanity). Thanks!

LOL. We need our sanity.

Riptide
10-13-2009, 01:14 AM
Unfortunately, this hasn't corrected my issue...

Running the checksum script (pg 5), it tells me my Mobipocket PID ABCDEFG*HI is correct.

Yet trying to enter the script with single quotes, double quotes, no quotes, dropping the last two digits (and again trying with the different quotes), has all produced the same result.

I know this is a DRM protected ebook (caliber said so)...

Windows Vista
Python 2.6.3

Idea's?

pdurrant
10-13-2009, 08:36 AM
It might be a content protected, but not PID protected eBook. There's a thread here somewhere detailing the changes needed to decode this kind of content. Unlikely if it's one you bought though - it's usually only applied (no idea why) to free ebooks.

Unfortunately, this hasn't corrected my issue...

Running the checksum script (pg 5), it tells me my Mobipocket PID ABCDEFG*HI is correct.

Yet trying to enter the script with single quotes, double quotes, no quotes, dropping the last two digits (and again trying with the different quotes), has all produced the same result.

I know this is a DRM protected ebook (caliber said so)...

Windows Vista
Python 2.6.3

Idea's?

wallcraft
10-13-2009, 11:20 AM
It might be a content protected, but not PID protected eBook. See Latest MobiDeDRM Patch (http://www.mobileread.com/forums/showthread.php?p=524539).

Another possibility is a bad copy of mobidedrm.py. I think the version bundled with eBookUtility is probably good. As is the most recent version of 0.06.

Riptide
10-13-2009, 05:44 PM
Ok, I know I was running 0.05. I'll try the link above when I get home tonight.

galavanter
10-25-2009, 09:54 AM
Since I got the Kindle 1, jetBook, iPod Touch, and then sold the Kindle, I have been using mobidedrm.py without a problem. Most of the files were azw from the Kindle, but when the kindle app came out I got the Touch, and sold the Kindle. The first test book I purchased on it came through mobidedrm clean as a whistle. I had used iPhone Backup Extrtactotr and drm'd the prc file.

The night before last, I purchased the second book on the Touch, extracted it, and that's when my 36 hr nightmare began.

I use a Mac upgraded to Snow Leopard. After running mobidedrm 1,2,5, and 6 repeatedly, I went to Windows via vmWare Fusion. I installed python 2.5.

I'm not Windows savvy, but with a little research I was soon able to get the identical error in DOS as I do in the Mac terminal every time, "Error: no key found. maybe the PID is incorrect".

I performed red_dragon's hack because the OP reported success with it. Not me.

I downloaded Hextreme to see if my book might be a Tpz file. it says Mobi.

I got my UDID again from iTunes and ran kindlepid.py again. The same PID I had saved from months ago popped up.

I switched to a Dell Mini 10, on which I have installed Mac OSX 10,5.8. I ran all the mobidedrm.py files again, this time on the FIRST book I purchased on the Touch, the one I had dedrm'd successfully previously. Same "Error: no key found. maybe the PID is incorrect".

Now that's just not right. The kindle app was updated just 3 days ago. I'm not into conspiracy theories, but nothing else makes sense to me at this point.

If anyone is using mobidedrm.py successfully on a Mac with prc files, please send me some help!

Better yet, buy a book today on your iPhone or Touch, dedrm it with your Mac, let me KNOW, and I'll reimburse you for the book via paypal.

pdurrant
10-25-2009, 12:04 PM
It sounds to me like the book you bought doesn't have DRM. Some books in the Kindle store don't have any DRM to begin with.

Since I got the Kindle 1, jetBook, iPod Touch, and then sold the Kindle, I have been using mobidedrm.py without a problem. Most of the files were azw from the Kindle, but when the kindle app came out I got the Touch, and sold the Kindle. The first test book I purchased on it came through mobidedrm clean as a whistle. I had used iPhone Backup Extrtactotr and drm'd the prc file.

The night before last, I purchased the second book on the Touch, extracted it, and that's when my 36 hr nightmare began.

I use a Mac upgraded to Snow Leopard. After running mobidedrm 1,2,5, and 6 repeatedly, I went to Windows via vmWare Fusion. I installed python 2.5.

I'm not Windows savvy, but with a little research I was soon able to get the identical error in DOS as I do in the Mac terminal every time, "Error: no key found. maybe the PID is incorrect".

aria110
10-26-2009, 05:24 AM
Since I got the Kindle 1, jetBook, iPod Touch, and then sold the Kindle, I have been using mobidedrm.py without a problem. Most of the files were azw from the Kindle, but when the kindle app came out I got the Touch, and sold the Kindle. The first test book I purchased on it came through mobidedrm clean as a whistle. I had used iPhone Backup Extrtactotr and drm'd the prc file.

The night before last, I purchased the second book on the Touch, extracted it, and that's when my 36 hr nightmare began.

I use a Mac upgraded to Snow Leopard. After running mobidedrm 1,2,5, and 6 repeatedly, I went to Windows via vmWare Fusion. I installed python 2.5.

I'm not Windows savvy, but with a little research I was soon able to get the identical error in DOS as I do in the Mac terminal every time, "Error: no key found. maybe the PID is incorrect".

I performed red_dragon's hack because the OP reported success with it. Not me.

I downloaded Hextreme to see if my book might be a Tpz file. it says Mobi.

I got my UDID again from iTunes and ran kindlepid.py again. The same PID I had saved from months ago popped up.

I switched to a Dell Mini 10, on which I have installed Mac OSX 10,5.8. I ran all the mobidedrm.py files again, this time on the FIRST book I purchased on the Touch, the one I had dedrm'd successfully previously. Same "Error: no key found. maybe the PID is incorrect".

Now that's just not right. The kindle app was updated just 3 days ago. I'm not into conspiracy theories, but nothing else makes sense to me at this point.

If anyone is using mobidedrm.py successfully on a Mac with prc files, please send me some help!

Better yet, buy a book today on your iPhone or Touch, dedrm it with your Mac, let me KNOW, and I'll reimburse you for the book via paypal.

I had this problem today, when I was testing out dedrm'ing on Kindle files from my iPhone (on Snow Leopard). I downloaded and used kindlepid.py to get an ID that looked like this: #######*## (with the #s as alphanumeric characters). I tried every version of mobidederm.py I could find, and every variant of single quotes, double quotes, using all 10 digits, dropping the last two, etc, but nothing worked. It alternated between "Error: no key found. maybe the PID is incorrect" and "Error: invalid PID checksum."

After lots of googling, I found someone who suggested downloading the latest version of kindlepid.py -- which can be found by googling azw-0.2.zip. The version of kindlepid.py in that zip, when fed my iphone device ID, gave me a different PID -- without an asterisk. That PID worked to decrypt all my kindle files just fine (with v0.05 of mobidedrm, though I'm not sure if it matters).

This may apply to anyone who uses the Kindle for iPhone application *only,* instead of in conjunction with a Kindle device. Worth trying at least!

galavanter
10-26-2009, 11:35 AM
What can I say but thanks a million! It worked! Just like you, I got a different PID, without an asterisk. I used 0.06 of mobidedrm.

Thank you.

Coops
11-15-2009, 03:59 PM
Just another thankyou to all here....

Just switched to a Mac - downloaded a mobi from fictionwise for my PRS-505, and was having the wrong pid checksum issue - but worked fine when i put the PId in single quotes..... Marvellous.

Already converted to ePub......

Coops

Sydney's Mom
12-02-2009, 06:48 PM
For once, I thouht maybe I could provide a little help. I was getting this error message today (Kindle for PC doesn't show any of my books - I have to remove DRM first. I put the books on my kindle, want to read it on my
PC, and I have to remove DRM!). First, I tried different PIDs. When I had tried everything, I tried quotation marks. Nothing. It was a 5-word title, so I changed the first instance to one word. Nothing. Then I changed the 2d instance to one word - done.

Katelyn
12-12-2009, 07:33 PM
FINALLY! After spending days trying to figure out why I could not get past the "Error: no key found. maybe the PID is incorrect" and "Error: invalid PID checksum" error when using my PID from my IPhone, I found the post about downloading azw-0.2.zip and using that version of kindlepid.py and it worked! I can now grab some of my books from my phone and move them to my 360 reader. :thumbsup:

kelosh
12-14-2009, 06:25 PM
Sorry if I am bringing up something that was answered. I looked through the posts and I believe that my mobipocket books that I bought must be content-encrypted and not necessarily tied to a particular device since I can view them on any device/computer as long as I view it with Mobireader. The problem is that I now have an Android phone and I want to be able to read it with that. It appears that Amazon has no intention of creating Mobireader for Android. Since I paid for the books I have no qualms with decrypting them. I have tried the mobidedrm and it keeps giving me the Invalid PID checksum error but I'm wondering if I need to actually use mobidedrm005 since my books aren't associated with a PID. Is there some other way to decrypt these? Thank you so much for any help!

wallcraft
12-14-2009, 07:10 PM
I looked through the posts and I believe that my mobipocket books that I bought must be content-encrypted and not necessarily tied to a particular device since I can view them on any device/computer as long as I view it with Mobireader.

Is there some other way to decrypt these? See Mobipocket Decoder Tool #176 (http://www.mobileread.com/forums/showthread.php?p=292071#post292071).

pdurrant
12-16-2009, 01:55 PM
As is the most recent version of 0.06.

I see on a certain shadowy gentleman's blog that there's now a 0.07 version of mobidedrm available.

andersz
01-28-2010, 11:15 PM
) != pid:
raise DrmException("invalid PID checksum")
pid = pid[0:-2]

if checksumPid(pid[0:-2]) != pid:
raise DrmException("invalid PID checksum")
pid = pid[0:-2]
to:
Code:
def __init__(self, data_file, pid):

if checksumPid(pid[0:-2]) != pid:
raise DrmException("invalid PID checksum")
pid = pid[0:-2]
That line that appears twice "pid = pid[0:-2]", is what shortens the PID (it means "take all but the last two characters of this string and replace the original").

Outro. It may very well be that your PID is actually incorrect, and you should browse this thread for ways to find out.

Also: opening the book after buying it unnecessary (except if your vendor does some non-standard thing I've never heard about). If this seems like it works, than a possible explanation is that opening the book actually removes the DRM (and then running MobileDRM on it gives the appearance that it actually worked ...).

Finally: no, I've never seen (valid) MobiPocket PIDs with anything but uppercase alphanumerical characters...


THANK YOU!

This is what made it working for me! I never thought it would work.

I signed up just to be able to thank you!

Thank you and everybody at this great community! :)

Zorz
01-30-2010, 02:12 AM
hello everybody, I had similar problems, mainly fixed with the fix above. I also found a invalid PID because my PID had a ? in it. I found putting the pid in 'PID'. single quotes fixed this problem. Here is a updated and fixed script

http://paste2.org/p/640624

kevindorsey
02-02-2010, 02:22 PM
I had to run the fix for one of the 7 units that our family owns, and yes it was fixed quickly. Last solution works well.

axx83
04-15-2010, 09:33 AM
Hi everyone, I have the same problem as many of you but I simply cannot make it to work in any way. I want to read it on my cybook !!!

I bought a book from mobipocket (never ever anymore I'll give you my money you stupid bastards) before putting the name of my device, installing the software or anything.

I use linux, when I downloaded the file from the website Calibre said it had drm. I installed mobiread in my windows paritition and downloaded the file from inside the program, it asked me for login and password and opened the file. I then plugged the Cybook, with the mobipocket firmware, uploaded the file which opens just fine.

I then checked online for dedrm and followed the procedure. I tried using the file directly downloaded from internet, the one on windows after I had opened it, the one on the reader after I had uploaded it from the software and opened it inside the reader. I tried each one of these options with the ebook reader pid, windows pid, even mobiread under linux wine's pid (they all show on mobipocket website).

NO SUCCESS, it always give me Error: invalid PID checksum

I want to read this book on my cybook reader with its epub firmware as I have numerous epub books, I need to dedrm it and convert it.

Please guys help me, drm suck so bad it hurts

axx83
04-15-2010, 10:09 AM
UPDATE

Sorry guys, it finally worked, it seems that among the many many options I had to try I was skipping one, I tried again with the cybook's file and the cybook's pid + dedrm 0.13 and it worked :-)

Sydney's Mom
04-15-2010, 09:42 PM
Isn't that just the greatest feeling?! Congratulations and enjoy.

axx83
04-16-2010, 05:38 AM
IT IS !!! I am definitely never going to buy another book with drm, but if it's absolutely my only choice (as for the book I was referring to) I will probably buy it in mobi format so that I can break it easily.

JSWolf
04-23-2010, 10:03 PM
IT IS !!! I am definitely never going to buy another book with drm, but if it's absolutely my only choice (as for the book I was referring to) I will probably buy it in mobi format so that I can break it easily.

ePub actually is easier to break the DRM once the key file is generated.

Sydney's Mom
04-24-2010, 12:38 AM
ePub actually is easier to break the DRM once the key file is generated.


I respectfully disagree. You can find a mobi DRM plug-in, so you just have to import the book into Calibre. Actually, takes some of the fun out of it.

meiniet
08-13-2010, 01:46 PM
I tried this, with an 8 digit PID (the ten digit version, without the two last digits), but got "invalid checksum" again. It also showed the "right" PID, and that was the 10-digit PID that I used in the first place, so now I am stuck again...
Who can help me?

You could disable the PID check and examine what mobidedrm expects. After making the changes you have to pass a 8 char PID to the python program:

(Be careful with the indentions)

def __init__(self, data_file, pid):
### BEGIN NEW CODE ###
# Calculate PID checksum if just the first 8 chars are specified
if len(pid) == 8:
pid = checksumPid(pid)
print "Full PID is %s" % pid
### END NEW CODE ###
if checksumPid(pid[0:-2]) != pid:
raise DrmException("invalid PID checksum")
pid = pid[0:-2]


Does it work for you?

If the decrypted result is garbage then your PID is not correct.

-Red Dragon

JSWolf
08-13-2010, 03:41 PM
I tried this, with an 8 digit PID (the ten digit version, without the two last digits), but got "invalid checksum" again. It also showed the "right" PID, and that was the 10-digit PID that I used in the first place, so now I am stuck again...
Who can help me?

What version MobiDeDRM are you using?

djpyle
09-08-2010, 03:27 AM
I'm having the same problem. What I really don't get is that it's only happening with some books. I created a Calibre plugin that works for the majority of my books, but recently, some of them aren't importing with stripped DRM. When I run the scripts in Terminal, I get the "no key found. maybe the PID is incorrect" error. And this happens with every version of MobiDeDRM I have. I think I've tried just about every patch suggestion out there. I don't know what else to do. What would make it work with some books and not others?

KevinH
09-08-2010, 11:12 AM
Hi,

One possible explanation is that the source of your books is a standalone Kindle ...

Kindle has recently updated its firmware to 2.5 and this change has changed the way PID's are used from one per device to a unique PID used for each and every book/user combination. Without this unique book/user specific PID, you can not run any of the tools.

So if your Kindle firmware updated recently (wirelessly?), then its single PID can no longer be used.

There are workarounds if you use Kindle4 For PC but for standalone Kindles - unless you are using version 1 which has no firmware update - any recent firmware update will prevent you from using a known PID in the way that you want.

PM me if you want more info.

KevinH

tt2nn
10-01-2010, 09:53 AM
These is one guy who tell me that he can buy books from amazon with a very low price. Is it possible? How can he strip the drm?

IUNO
10-01-2010, 12:25 PM
Hi,
do you mean that if i'm looking for my kindle 3 Pid, i won't find it through the python string, and that all this tools are useless to me?

Hi,


Kindle has recently updated its firmware to 2.5 and this change has changed the way PID's are used from one per device to a unique PID used for each and every book/user combination. Without this unique book/user specific PID, you can not run any of the tools.



I've been trying to strip the drm from a book i've bought on cyberread, and i always get the "invalid checkum" or the "maybe your pid is incorrect" message.

KevinH
10-01-2010, 12:47 PM
Hi,

Yes, I think the Kindle 3 comes with firmware >= 2.5 automatically.
If so you can no longer copy books from your Kindle 3 and use the MobiDeDRM.py script since there is no way with that device to determine the book specific PID. Amazon has improved the security via that firmware update and all newer models have that.

A solution is to get "Kindle For PC", register it, download all of the books you have already purchased for your Kindle 3 onto it (via the "Archive") and run K4PCDeDRM.pyw on them.

Google "Apprentice Alf's Blog" for more info, links to tools_v1.9, etc since none of that can be linked to from here.

KevinH

KevinH
10-01-2010, 12:51 PM
Hi,
I've been trying to strip the drm from a book i've bought on cyberread, and i always get the "invalid checkum" or the "maybe your pid is incorrect" message.

If you buy a Mobi book from someplace other than Amazon, you have to provide a PID of some sort so that the vendor can encrypt the file with the PID.

If you can download that book (not via your Kindle 3) and know the PID you provided, you should still be able to process it, I would think.

My previous post was only about books bought from Amazon via your standalone Kindle device (in this case a Kindle 3).

Hope this is clearer,

KevinH

IUNO
10-01-2010, 12:55 PM
Thanks for the quick response.

I'll look around anf and let you know if I succed in making that ebook work on my kindle :)

pdurrant
10-01-2010, 02:04 PM
These is one guy who tell me that he can buy books from amazon with a very low price. Is it possible? How can he strip the drm?

No-one can buy books from Amazon for less than Amazon sell to everyone. Anyone offering you books from Amazon for less than Amazon sell them is scamming you - either you won't get the books, or you'll get unauthorised copies.

If you're going to pirate ebooks, don't give money to scamming scammers.

Sydney's Mom
10-01-2010, 04:36 PM
Hi,

Yes, I think the Kindle 3 comes with firmware >= 2.5 automatically.
If so you can no longer copy books from your Kindle 3 and use the MobiDeDRM.py script since there is no way with that device to determine the book specific PID. Amazon has improved the security via that firmware update and all newer models have that.

A solution is to get "Kindle For PC", register it, download all of the books you have already purchased for your Kindle 3 onto it (via the "Archive") and run K4PCDeDRM.pyw on them.
Google "Apprentice Alf's Blog" for more info, links to tools_v1.9, etc since none of that can be linked to from here.

KevinH

Now you can just copy them onto your desktop (from Kindle for PC) and import them into Calibre. The plug in works great!

simwi
11-04-2010, 07:17 PM
Now you can just copy them onto your desktop (from Kindle for PC) and import them into Calibre. The plug in works great!Which plugin?

wallcraft
11-04-2010, 07:59 PM
Which plugin? Apprentice Alf's Blog is the best place to start to look for tools_v2.1, and other info about DRM.

simwi
11-05-2010, 03:51 AM
Thank you! I found the right plugin, installed it and tried to add the azw file to Calibre from the command line as recommended. This is what I got:

DSN: P2tfPYt9r1rPPP5P7YPASt73P2rM5Y666YnU5751
Device PID: SRUFDDECER
Account Token: 84863d4c666603ad24186abf023bffb4de48d1b4
Pid for Bad Things Happen: 2yrl0ChtBQ
MOBI header version = 6, length = 232
Extra Data Flags = 2
Running file type plugin K4PC, K4Mac, Mobi DeDRM failed with traceback:
Traceback (most recent call last):
File "site-packages\calibre\customize\ui.py", line 176, in _run_filetype_plugins
File "<string>", line 486, in run
Exception: K4MobiDeDRM plugin could not decode the file
Backing up metadata
Notifying calibre of the change

Any suggestions?

KevinH
11-05-2010, 09:47 AM
Thank you! I found the right plugin, installed it and tried to add the azw file to Calibre from the command line as recommended. This is what I got:

Exception: K4MobiDeDRM plugin could not decode the file
Backing up metadata
Notifying calibre of the change

Any suggestions?

Yes, I suggest you post your error and ask your questions on either the ApprenticeAlf Blog (in the appropriate sub-forum) or on the Dark Reverser's New Blog because in this forum we are really not supposed to help you with DRM removal tools too much.

Just a thought, but it does make sense since that is where you downloaded the tools from.

simwi
11-05-2010, 01:02 PM
Will do. And big thanks to everyone in this forum, I usually get an answer to my problems by browsing.