02-05-2009, 02:05 AM | #1 |
Evangelist
Posts: 416
Karma: 14682
Join Date: May 2008
Location: SF Bay Area
Device: Nook HD, Nook for Windows 8
|
Determining if a PDF File is encrypted - the hard way
Because daesdaemar asked me to....
At the simplest level a PDF file is a collection of numbered objects. The objects themselves will tend to be streams of data ( such as the text run, graphics, or fonts) or dictionaries (structures which contained formatted data that describe the document). If you look at PDF file you'll tend to see a lot of the following: 1 0 obj ...object data... 2 0 obj ...object data... 3 0 obj ...object data... The objects themselves are organized by a cross reference table which lists the offsets for the document, and also has a trailer dictionary which list the object numbers important objects. One of those objects is the encryption dictionary, which must exist if the document is encrypted. So, opening the PDF file in a good text editor (on the Mac I really like BareBones' TextWrangler) search for the string "/Encrypt" which if the file is encrypted should take you to the trailer dictionary which will look something like Code:
<</Size 1910/Root 1426 0 R/Encrypt 1908 0 R/Info 1421 0 R/ID[<5081abdd2bdafc8f4748b307de4c8eff><29c91bdce6e8e5478905ab5d6890c7eb>]>> Code:
1908 0 obj<</Filter/EBX_HANDLER/V 1/EBX_TITLE(Book Title)/>> endobj
For more information about the PDF File format get the PDF File Reference from http://www.adobe.com/devnet/pdf You can look at section 3.5 in particular which contains the information about Encryption in PDFs Last edited by Jim Lester; 02-05-2009 at 02:18 AM. |
08-28-2009, 06:25 PM | #2 |
Junior Member
Posts: 4
Karma: 10
Join Date: Aug 2009
Device: none
|
Sorry for wrong thread!
|
Advert | |
|
07-05-2010, 12:10 AM | #3 |
Junior Member
Posts: 1
Karma: 10
Join Date: Jul 2010
Device: none
|
Apologies for resurrecting this old topic, but i've found it extremely useful for some software development I've been doing and I had a question if anyone is able to answer it.
Is there a way to tell if a PDF document has been given an owner password but not a user password? I don't care what the passwords are, or about the content of the PDF, but I do need to know what *type* of password protections are on it. It seems that encrypted PDFs get both an /O and /U entry in the /Filter section regardless of the type of password in use. |
07-05-2010, 06:10 AM | #4 |
frumious Bandersnatch
Posts: 7,533
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Maybe pdftk or pdfinfo can help.
|
07-12-2010, 04:20 PM | #5 | |
Evangelist
Posts: 416
Karma: 14682
Join Date: May 2008
Location: SF Bay Area
Device: Nook HD, Nook for Windows 8
|
Quote:
Note that the algorithms will be slightly different for AES256 encrypted documents (came along with Acrobat 9). |
|
Advert | |
|
07-12-2010, 05:37 PM | #6 | |
Wizard
Posts: 1,746
Karma: 4382688
Join Date: Jul 2006
Location: Somewhere on earth
Device: Onyx Boox Tab X
|
Quote:
|
|
07-16-2010, 11:37 AM | #7 |
Evangelist
Posts: 416
Karma: 14682
Join Date: May 2008
Location: SF Bay Area
Device: Nook HD, Nook for Windows 8
|
|
07-19-2010, 07:22 AM | #8 |
Wizard
Posts: 1,746
Karma: 4382688
Join Date: Jul 2006
Location: Somewhere on earth
Device: Onyx Boox Tab X
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
What were the formulas for determining TOC | lunixer | Calibre | 2 | 08-16-2010 11:14 AM |
PDB file cannot be encrypted - but why? | permutations | Other formats | 7 | 08-17-2009 10:14 AM |
Hanlin V3 firmware V1.27 released - adds encrypted PDF support | T-bag | HanLin eBook | 20 | 09-18-2008 06:02 AM |
Encrypted PDF Converter? | NatCh | Sony Reader | 11 | 04-30-2008 10:20 PM |
Encrypted File System on a USB Thumbdrive | Colin Dunstan | Lounge | 0 | 11-13-2004 07:08 AM |