|  11-26-2009, 04:14 PM | #1 | 
| Wizard            Posts: 2,999 Karma: 300001 Join Date: Jan 2007 Location: Citrus Heights, California Device: TWO Kindle 2s, one each Bookeen Cybook Gen3, Sony PRS-500, Axim X51V | 
				
				Adventures in discovering the K4PC PID.
			 
			
			Anyone done this yet?  Anyone want to detail their experiences so far? Perhaps if we detail this in this thread we can finally make the breakthrough we want. Derek | 
|   |   | 
|  11-26-2009, 09:53 PM | #2 | 
| Addict            Posts: 241 Karma: 2617 Join Date: Mar 2009 Location: Greenwood, SC Device: Kindle 2 | 
			
			What good is the 'pid'?  The book key isn't encrypted in the same way as normal mobi books in k4pc books.  Who knows if a mobiPID is even used anymore in the new key encryption.  This is fairly obvious if you look at the DRM sections from two different books.
		 | 
|   |   | 
|  11-26-2009, 10:19 PM | #3 | |
| Wizard            Posts: 2,999 Karma: 300001 Join Date: Jan 2007 Location: Citrus Heights, California Device: TWO Kindle 2s, one each Bookeen Cybook Gen3, Sony PRS-500, Axim X51V | Quote: 
 Derek | |
|   |   | 
|  11-26-2009, 11:32 PM | #4 | 
| reader            Posts: 6,977 Karma: 5183568 Join Date: Mar 2006 Location: Mississippi, USA Device: Kindle 3, Kobo Glo HD | 
			
			Perhaps it is worth summarizing what happens in a normal MOBI ebook.  Here is what I think happens, but I am nor certain this is right and I am skipping over some technical details. The actual encryption is done before the ebook leaves the publisher, with a (book specific) key. Only a small part of this file is then customized for the 1-4 PIDs allowed in a delivered MOBI ebook. The customization encodes an encrypted marker of the PID and the book key in the file, and this can then be extracted by entering the PID (e.g. by a MobiPocket Reader or by mobidedrm). So the process is PID -> book key -> plain text. The K4PC AZW files are largely the same as AZWs for other devices, in other words the book key and the basic encryption is the same. What clarknova is suggesting is that Amazon has changed the PID -> book key process. This is plausible, because Amazon only needs 1 PID per file (not 4) and in principle they could do anything that used the same basic structure as the standard MOBI file. If this is the case, then this would be disappointing because MobiPocket never designed the PID to be a secret. Since it is only 8 characters long, with 36 values per character, it is in principle discoverable using a Brute force attack. In effect the PID is a password, subject to Password cracking. I don't know how long it would take to crack the PID from a MOBI file, but this seems practical even using brute force and there might be faster ways. This is a complete waste of effort for standard PIDs, because we already know them. Even the "secret" PIDs of Kindles and the Kindle iPhone app were discovered by other techniques, not relying of cracking the PID from a MOBI file. Since we don't know the PID of K4PC, cracking might be appropriate - but only if we know that K4PC is actually using a conventional MOBI PID. Note that most DRM schemes are not broken by brute force or other attacks on the cipher, but rather on some flaw in the system that allows discovering the PID (or whatever). This "flaw" has to be there because DRM is being asked to do the impossible. The reader app is in the possession of the "attacker" and it has to know how to decrypt the ebook. Last edited by wallcraft; 11-26-2009 at 11:38 PM. | 
|   |   | 
|  11-27-2009, 02:20 AM | #5 | |
| Wizard            Posts: 2,999 Karma: 300001 Join Date: Jan 2007 Location: Citrus Heights, California Device: TWO Kindle 2s, one each Bookeen Cybook Gen3, Sony PRS-500, Axim X51V | Quote: 
 Derek | |
|   |   | 
|  11-27-2009, 04:04 AM | #6 | 
| Junior Member  Posts: 6 Karma: 10 Join Date: Nov 2009 Device: none | 
			
			For version 1.0.25338.0 (MD5 348F25D496FBDDF2CE4A9CE0C2A7E1ED) deregister K4PC, set a breakpoint at offset 005B2A59, register again, and look at the stack 0012C144 01A13110 ASCII "https://firs-ta-g7g.amazon.com/FirsProxy/registerDevice?deviceType=AXXXXXXXXXXXXS&deviceSer ialNumber=PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX3 &deviceName=%25FIRST_NAME%25's%20Kindle%20for%20PC %25DUPE_STRATEGY_2ND%25&pid=NXXXXXXK" Note that the PID is 8 chars long. MobiDeDRM failed at decrypting after removing the checkum check. | 
|   |   | 
|  11-27-2009, 09:27 AM | #7 | |
| reader            Posts: 6,977 Karma: 5183568 Join Date: Mar 2006 Location: Mississippi, USA Device: Kindle 3, Kobo Glo HD | Quote: 
 Something I did not make explicit in my description above is that MOBI allows up to 4 PIDs per ebook, i.e. has "slots" for 4 PIDs in the file structure, but Amazon only uses 1 PID per ebook. In other words each AZW file will only work on one device. | |
|   |   | 
|  11-27-2009, 09:34 AM | #8 | 
| reader            Posts: 6,977 Karma: 5183568 Join Date: Mar 2006 Location: Mississippi, USA Device: Kindle 3, Kobo Glo HD | 
			
			  Is the PID what you get by running kindlepid on the deviceSerialNumber?  It is clearly being generated on the PC, hopefully from some local unique id.
		 Last edited by wallcraft; 11-27-2009 at 09:37 AM. | 
|   |   | 
|  11-27-2009, 09:53 AM | #9 | ||
| Addict            Posts: 241 Karma: 2617 Join Date: Mar 2009 Location: Greenwood, SC Device: Kindle 2 | Quote: 
  This would be faster if you know the PID is a Kindle/Mobi pid (Which ends in either $ or * and limits the combinations to 105046700288)  However for a Kindle 4 PC or iPod these increase to 1785793904896 combinations.  I got lucky and it only took me about a day to brute force my Kindle 4 PC pid. Quote: 
 Now if you look at books for your Kindle 4 PC, you'll see that "00 00 00 43" is encrypted DIFFERENTLY on every* book. This means they've introduced an IV into the book key encryption method. * - So how did I brute force my PID when the encryption's changed? Because when I first installed K4PC I downloaded one book out of my library. It came across with the old encryption. Every book since has had the new encryption, and the only way I can readily tell which encryption method the book will use is by that EXTH 208 record (you know the one: "atv:kin:1:{base64 data}:{base64 data}" ). If that record has a length of 0xC7, then the book seems to use the old (normal) book key encryption. If the length is 0xDB, then it's the new method. | ||
|   |   | 
|  11-27-2009, 04:51 PM | #10 | |
| Junior Member  Posts: 6 Karma: 10 Join Date: Nov 2009 Device: none | Quote: 
 FWIW, I found that the PID actually IS used to decrypt books (only tried on www.amazon.com/gp/product/B002ENBM7G , prc format) | |
|   |   | 
|  11-27-2009, 05:14 PM | #11 | |
| Wizard            Posts: 2,999 Karma: 300001 Join Date: Jan 2007 Location: Citrus Heights, California Device: TWO Kindle 2s, one each Bookeen Cybook Gen3, Sony PRS-500, Axim X51V | Quote: 
 Derek | |
|   |   | 
|  11-27-2009, 07:47 PM | #12 | ||
| Addict            Posts: 241 Karma: 2617 Join Date: Mar 2009 Location: Greenwood, SC Device: Kindle 2 | Quote: 
 Quote: 
 Now, why don't you try newly downloading a free book (like http://www.amazon.com/gp/product/B000FBJBA4) and see how far that PID gets you. Once that fails, you could also try deleting that book you listed before, re-downloading and seeing if it still comes down with the old encryption method. | ||
|   |   | 
|  11-27-2009, 08:09 PM | #13 | |
| Junior Member  Posts: 6 Karma: 10 Join Date: Nov 2009 Device: none | Quote: 
 > Mobipocked PID for iPhone serial# {SERIAL} is S*1*S*H*AT The PID that's sent to the server (and used in decryption AFAICT is N*I*7*F* [calc checksum: VZ]) They do NOT match   | |
|   |   | 
|  11-28-2009, 02:14 AM | #14 | |
| Wizard            Posts: 2,999 Karma: 300001 Join Date: Jan 2007 Location: Citrus Heights, California Device: TWO Kindle 2s, one each Bookeen Cybook Gen3, Sony PRS-500, Axim X51V | Quote: 
 Derek | |
|   |   | 
|  11-28-2009, 10:43 AM | #15 | |
| I'm Super Kindle-icious            Posts: 6,734 Karma: 2434103 Join Date: Apr 2008 Location: Long Drive, Calinadia Candafornia Device: KDXG, KT, Oasis | Quote: 
   | |
|   |   | 
|  | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| discovering and loving this fb.2 reader.. | oncdoc | Astak EZReader | 2 | 04-19-2010 06:05 PM | 
| K4 Mac or PC Where are K4PC files? | lmittell | Amazon Kindle | 3 | 01-06-2010 01:04 AM | 
| Where is the PID on Pocket Pro, ADE and K4PC? | rxsz | Astak EZReader | 7 | 12-20-2009 05:29 AM | 
| Free on Kindle - Discovering Dani | koland | Deals and Resources (No Self-Promotion or Affiliate Links) | 0 | 09-28-2009 09:57 AM | 
| Kindle PID from Mobi PID - can anyone do it? | delphidb96 | Workshop | 2 | 04-27-2009 04:42 PM |