Encrypted PDF files

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Post Reply
hsenden
Posts: 167
Joined: Mon Oct 21, 2002 2:22 am
Location: Wijlre, Netherlands
Contact:

Encrypted PDF files

Post by hsenden » Wed Oct 12, 2005 7:21 am

Hi,

in a migration program for our DMS we are trying to checkin PDF files on Unix into the Document Management System, but we have found some encrypted files.
Is there a possibility (before checking in) to determine whether the PDF-file is encrypted or not ?

regards,
Hans

Guest

Post by Guest » Wed Oct 12, 2005 1:45 pm

May be asking in Planet PDF forum will get you a greater response from some of the pdf developers there. I'm guessing that those encrypted PDFs might have some indication in the very first few bytes or so .. you can use read dataset in binary mode to transfer first few bytes and from there figure out if they're encrypted or not.

hsenden
Posts: 167
Joined: Mon Oct 21, 2002 2:22 am
Location: Wijlre, Netherlands
Contact:

Post by hsenden » Thu Oct 13, 2005 12:15 am

Any one ?

From an abap i want to check the pdf file if it is secured.

Hans

Guest

Post by Guest » Thu Oct 13, 2005 1:31 am

There is none from standard SAP .. you need to program it yourself.

hsenden
Posts: 167
Joined: Mon Oct 21, 2002 2:22 am
Location: Wijlre, Netherlands
Contact:

Post by hsenden » Thu Oct 13, 2005 1:37 am

how ?

that is exact my question ;-)

Guest

Post by Guest » Thu Oct 13, 2005 1:50 am

Guess I answered it in my first post .. go to PlanetPDF and ask them a question on how the encrypted PDF footprint looks like. There must be a standard foorprint saying that the file is encrypted.

hsenden
Posts: 167
Joined: Mon Oct 21, 2002 2:22 am
Location: Wijlre, Netherlands
Contact:

Post by hsenden » Thu Oct 13, 2005 2:39 am

OK, i will do that.
I think i have to run a DOS command to check the preference of the PDF-file, someway ?

Thanx anyway

Guest

Post by Guest » Thu Oct 13, 2005 10:35 am

Did a quick google search and found this info..

http://www.cs.cmu.edu/~dst/Adobe/Galler ... yption.txt

Every document has a "trailer dictionary" which holds references to a
few important things (like the tree of page objects which contains the
document content) and optionally to an encryption dictionary. If the
encryption dictionary is present (i.e., if the document is encrypted),
it contains the information needed to decrypt the document. An
example:

% Trailer dictionary
trailer
<<
/Size 95 % number of objects in the file
/Root 93 0 R % the page tree is object ID (93,0)
/Encrypt 94 0 R % the encryption dict is object ID (94,0)
/ID [<1cf5...>] % an arbitrary file identifier
>>

% Encryption dictionary
94 0 obj
<<
/Filter /Standard % use the standard security handler
/V 1 % algorithm 1
/R 2 % revision 2
/U (xxx...xxx) % hashed user password (32 bytes)
/O (xxx...xxx) % hashed owner password (32 bytes)
/P 65472 % flags specifying the allowed operations
>>
endobj
Guess you could actually look for "% Encryption dictionary" in the file.. if present.. then the pdf is encrypted .. good luck.

Post Reply