Encrypted PDFs When you give a PDF document an owner password, Adobe Acrobat encrypts it so that you can't just remove the password from the file. Unfortunately, because of stupid US regulations about exporting cryptographic software, the encryption cannot be added into programs like GhostScript which are distributed with source code from the US. This web page, however, is not in the US, so I can provide here the modifications necessary to view encrypted PDFs with GhostScript. GhostScript versions 4.01 and earlier To allow versions of GhostScript from 3.33 through 4.01 to read encrypted PDFs, you need to download the appropriate patch from the list below, place it in the same directory as the files pdf_base.ps and pdf_main.ps, and pipe them into patch -l. If you don't have `patch' on your machine, you can probably find a version at your friendly GNU archive. There are patches for versions: * 3.33, * 3.53, * 4.00 and 4.01. The last of these patches is quite a bit better than patches for earlier versions. It is likely that these patches will not work if GhostScript is compiled with 64-bit integers. GhostScript versions 4.02 and later For these versions, things became somewhat simpler. All you need to do is replace the file called pdf_sec.ps with the version provided below, as described in the documentation. pdf_sec.ps This file is version 1.0.3, which corrected a bug visible with the US Copyright Office's Form TX. Version 1.0.2 added support for versions 5.0 and later of GhostScript. Version 1.0.1 corrected support for interpreters with 64-bit integers. Usage information If GhostScript reports ****This file has a user password set., you can specify a password by setting PDFPassword to either the user or owner password of the PDF file. On the command line, you might say gs -sPDFPassword=apassword somefile.pdf. Inside GhostScript, you can say /PDFPassword (apassword) def. You can also put this in a file generated with pdf2dsc; put it just after the line that says %%BeginProlog. Technical Details If you're interested in how the patch works, you should look at version 1.2 of the PDF reference manual (available at Adobe's Web site). My patches predate this description, but they seem to conform to it exactly. RC4-compatible and MD5 PostScript * Source for an RC4-compatible algorithm implemented in PostScript. * Source for MD5 implemented in PostScript. If you have your browser set to automatically run PostScript files with (say) Ghostview, you'll find doing that is not very interesting, as they don't make any marks on the page; they just run some self-tests. ---------------------------------------------------------------------------- This page has been hit [more than 7000] times. Unless otherwise specified, these files are Copyright 1996, 1997 Geoffrey Keating, and may be freely distributed with or without modifications, so long as proper attribution is given and copyright notices are not removed.