Search code examples
windowsprintingdriverghostscriptpostscript

Signed ghostscript postscript print driver


I am using the Windows postscript print driver that is shipped with ghostscript (lib/ghostpdf.inf) to generate postscript files from print jobs.

However the postscript driver is not digitally signed, so Windows 8 and Windows Server 2012 won't allow installing it without booting into the "allow unsigned drivers"-mode.

Do you know if there is any signed version out there to be used with the latest Windows versions?

If thats not the case, I am fine compiling and signing it myself, however I was not able to find the source code for the postscript print driver within the git repo available at http://git.ghostscript.com/ghostpdl.git. May I've just overseen it since I am not familiar with building drivers.

Can one give me a hint where I can find the postscript driver files to compile it myself?

EDIT: How does the .INF file tell windows where the driver binaries are located? I've looked into the "ClassGUID" however its the same for all drivers and the registry entry says something about C:\Windows\System32\ntprint.dll. I don't think this is important for the problem, is it?


Solution

  • To sign "the ghostscript driver" you just have to sign the INF-file that comes with Ghostscript.

    There's an article on technet describing the steps required to do so.

    The steps are:

    1) Create/acquire a certificate
    2) Ensure that your computer trusts the certificate (place it in your cert store if required)
    3) Download and install the Windows Driver Kit (WDK)
    4) Change the CatalogFile=oemprint.cat in the INF file to ghostpdf.cat
    5) Change the DriverVer=01/02/2007,1.0.0.1 to DriverVer=01/01/2013,1.0.0.1 (maybe you need some other date, you'll see that in the next step)
    6) Use the Inf2Cat tool to create a cat file (was at C:\Program Files (x86)\Windows Kits\8.0\bin\x86 for me):

    NOTE
    Use cmd.exe not powershell, as powershell gives Parameter format not correct. error all the time

    Command:

    inf2cat.exe /driver:c:\path\to\folder\whereCatFileIsIn /os:7_X86,7_X64,8_X86,8_X64[,other OS you'd like to support]
    

    7) Sign the cat file using the signtool (Same directory as the Inf2Cat tool)

    Command:

    SignTool.exe sign /f "C:Path\to\my.pfx" /t http://timestamp.verisign.com/scripts/timestamp.dll "C:\Path\To\ghostpdf.cat"
    

    (See the signtool docs for more informations about the available paramters)