ColdFusion PGP CFC and custom tag

Important: please read updates at the bottom of this post regarding compatibility with PGP 8.1 and 9.0.x.

ColdFusion component that gives you access to the commercial PGP (Pretty Good Privacy) libraries. It uses the nsdpgp3 PGP COM wrapper, which allows “KeyID and UserID lookup, the listing of all valid keys on the keyrings, File/String analysis, File/String conventional encryption and decryption, File/String public key encryption, decryption, signing and verification, File wiping, key pair generation, key deletion, revocation, enabling and disabling, and key import and export from/to File/String/KeyServer”.

(Includes custom tag, for ColdFusion 5)

Note: PGP 8.1 broke backwards compatibilty, and requires a new version of the COM wrapper. This CFC has only been tested with PGP 8.0 (although the new 8.1 wrapper should work fine.)

Usage:

  • Install PGP 8.0.
  • Register the nsdpgp3 COM DLL (supplied in download - see nsdpgp3 instructions).

In your ColdFusion pages, use:

pgpUtils=createObject("component","pgp").init("C:\pubring.pkr", "C:\secring.skr");
keys=pgpUtils.listKeys();

OR

<cf_pgp pubkeyring="c:\pubring.pkr" privkeyring="c:\secring.pkr" action="listkeys" result="keys">

(specify the full path of your keyring files).

View the PGP CFC documentation

Download pgp-cfc.zip (156k)

Update (30/08/2007) - David Medlock has put together good instructions on how to get PGP CFC working. As he notes, you’ll need a later version of the nsdpgp3 wrapper if you are using PGP v8.1 or v9.0.x . Version 1.7 of the wrapper is available here. Register the dll in that download rather than the dll supplied in the pgp-cfc download.