If you've been looking for an easy way to access PGP functions using Delphi (and C++ Builder) - here it is:

PGP Components for Delphi

Version 5.0.1 - 12/2011

When I first started to use Pretty Good Privacy™ with my email client, I tried to find a handy extension to work with the at that time newest version (2.6.3). And indeed, there were two of them: QDPGP - which actually did not satisfy my demands - and another one, that isn't updated and supported any more. So I decided to write one by myself - in Delphi.

While learning about piping in- and output between command-line and GUI applications, I tried to find some supporting sources on the internet - and again was successful: Some free PGP components for DOS were already available. In the meantime PGP itself came up with GUI interfaces, and I was expecting to maybe find a program library I could use for my own programming efforts.

It then happened that I heard about a really comprehensive Delphi PGP header file for PGP 5.5.3i but, as still I'm not a professional programmer, that really wasn't what I could deal with. So again I was waiting for an easier way to find, and finally I did: Thanks to Steve Heller there was SPGP.DLL, a library providing some easy interfaces for the most important PGP functions. For more links to SDK related resources including a mailing list see Robert's PGP SDK pages.

Now that I've become really familiar with these I've been able to rewrite my components to directly interface with PGP's libraries themselves, which enables me to provide more features and more convenient data structures using Delphi's capabilities than SPGP does - but only with PGP versions 6.5.x, 7.x, 8.x, 9.x and 10.x. Please be aware that this version is not compatible to any 1.x version of the components!

The latest package pgpdc501.zip (400 KB) containing the sources and their detached PGP signature includes 34 units, most of them providing interfaces to PGP libraries (please note that these are covered by the "Mozilla Public License Version 1.1"), customized versions of Primoz Gabrijelcic's Time Zone Routines v1.2 and Ralph Junker's Base64 routines and an optimized version of Sébastien Sauvage's pascal version of Bob Jenkins' random number generator. The components have been successfully used with Delphi 2 and 6, 2005 and 2010 by myself, please let me know about problems with any other version. You don't need anything else than a full installation of PGP 6.5.x, 7.x, 8.x, 9.x or 10.x (but this is mandatory: if PGP isn't installed on your machine Delphi may fail to load its visual component library, see the ReadMe.txt file in the download package). As of August 2002 I've added files for compiling the components into C++ Builder 5 & 6, created and tested by Jesse Reichler.

As of February 2002 I've added the sources for a simple DLL and a small application demonstrating its use. The DLL has originally been created for a VB developer's email application called PostMe.

As of October 2004 there are six additional components for creating, exporting, importing, verifying and examining x.509 certificates with PGP versions since 7.x.

The components (15 in total) provide:

Feel free to use and modify the sources according to your demands - but be aware that I cannot provide any warranties whatsoever. Your comments and suggestions are welcome. Have fun ...

(PGP key)

PS: Here's where you can find my PGP extension for Pegasus Mail: www.pmpgp.de


What's new?

it's private by ChangeDetection

Version 5.0.1 - 19.12.2011

This version just enables PGP 10.2 support.

Version 5.0.0 - 25.07.2010

This one is almost exclusively about migration to Unicode based versions of Delphi (2009 and later) with the main issue being the lack of a backwards compatible TStringList type: Hence there's now a new unit called PGPStringList.pas implementing a TRawByteStrings list type capable of dealing with AnsiString and RawByteString types. For keeping compatibility with prior versions of Delphi these types are either an alias or a redefinition of predefined types, please make sure to read the respective help file page. Other changes:

Version 4.9.4 - 06.03.2010

... now supports PGP 10.

Version 4.9.3 - 20.11.2009

Version 4.9.2 - 13.06.2009

Version 4.9.1 - 21.12.2008

Version 4.9.0 - 22.05.2008

Version 4.8.2 - 16.12.2007

Version 4.8.1 - 12.08.2007

Version 4.8.0 - 14.07.2007

Main changes aside from various internal enhancements and fixes:

Version 4.7.0 - 16.03.2007

Version 4.6.0 - 04.02.2007

This version provides PGP 9.5.x adjustments along with some enhancements and fixes:

Version 4.5.3 - 05.08.2006

This version mainly provides some more fixes:

Version 4.5.2 - 18.03.2006

This version only provides some fixes and adjustments:

Version 4.5.1 - 01.02.2006

Version 4.5.0 - 25.12.2005

I finally managed to implement S/MIME support for PGP 8.1 (with SDK 3.2.x) and later which had some side effects (except for bug fixing):

Version 4.2.1 - 11.10.2005

This version fixes two bugs in TPGPDecode:

Version 4.2.0 - 28.08.2005

PGP 9 support has been added:

Version 4.1.2 - 29.06.2005

Version 4.1.1 - 05.06.2005

Version 4.1.0 - 13.02.2005

Version 4.0.1 - 27.10.2004

Version 4.0.0 - 02.10.2004

Version - 02.05.2004

Version - 22.02.2004

Version 3.3.7 - 07.12.2003

Version 3.3.6 - 14.09.2003

Version 3.3.5 - 06.04.2003

Version - 16.03.2003

Version 3.3.4 - 01.03.2003

Version - 12.02.2003

Version 3.3.3 - 06.02.2003

Version 3.3.2 - 27.01.2003

Version 3.3.1 - 01.01.2003

Version 3.3.0 - 15.12.2002

PGP 8 support has been added, which currently doesn't change a lot:

Version 3.2.6 - 30.11.2002

Version 3.2.5 - 24.10.2002

Version 3.2.4 - 11.08.2002

Version 3.2.3 - 06.07.2002

Version 3.2.2 - 20.05.2002

Version 3.2.1 - 07.04.2002

Version 3.2.0 - 24.03.2002

Some internal enhancements and a new read-only property in TKeyPropsList called ValidProps which indicates the valid key properties for all records contained in the respective properties list as passed to the method retrieving that list. Furthermore some fixes:

Version 3.1.9 - 10.03.2002

Version 3.1.8 - 02.03.2002

Version 3.1.7 - 23.02.2002

Version 3.1.6 - 01.02.2002

Version 3.1.5 - 30.01.2002

Version 3.1.4 - 27.01.2002

Version 3.1.3 - 20.01.2002

Version 3.1.2 - 12.01.2002

Two changes / additions:

Version 3.1.1 - 30.12.2001

Version 3.1.0 - 22.12.2001

Some more important changes have been applied with this version:

Version 3.0.4 - 19.11.2001

Version 3.0.3 - 06.11.2001

Version 3.0.2 - 25.10.2001

Version 3.0.1 - 13.10.2001

Version 3.0.0 - 07.10.2001

Version 2.0.8 - 18.08.2001

Version 2.0.7 - 04.08.2001

Version 2.0.6 - 28.07.2001

Version 2.0.5 - 22.07.2001

Version 2.0.4 - 14.07.2001

Version 2.0.3 - 18.06.2001

More bug fixes:

Version 2.0.2 - 17.06.2001

Version 2.0.1 - 12.06.2001

A bug fix and another utility function have been added:

Version 2.0.0 - 04.06.2001

Version 1.3.2 - 04.10.2000

Version 1.3.1 - 27.08.2000

Version 1.3.0 - 08.08.2000

New features available since SPGP version

NB: The most important changes first, as some modifications have been applied which will affect applications you may have written using former versions. Steve Heller is introducing a new, more flexible and extensible way of setting options which can gain you a major improvement of performance. So far it has only been applied to the SPGP functions KeyRingID, GetKeyProps and two new functions, but it will be implemented for all applicable functions with his upcoming version 3. Using the components you will not have to deal with them directly, as they have been converted to option sets. If you still want or need to keep compatibility to former versions you may set the global flag CompatibilityMode to true.

Nevertheless there are some changes you may have to apply to your applications:

The new features:

  1. TPGPGetKeyProps

    has been modified to use the new flags feature. The Update method can now retrieve nearly all available information about a keyring's keys at once without having to call DoGetKeyProps for every single key, just by setting the desired options. DoGetKeyProps has accordingly been changed to only get the properties you have selected instead of providing a fixed list (like in compatibility mode).

    Some new utility functions have been added to retrieve these data without hassles - see KeyRec, KeyProps and ExtractKeyProps for changes. The new methods DoGetKeyPropADK and DoGetKeyPropRevokationKey (similar to DoGetKeyPropUserID) will provide more detailled information about sub-keys added to DH/DSS keys (no compatibility mode available).

  2. TPGPreferences

    provides two new methods besides the old single parameter functions: Using the flag feature you can now choose which options to get or set at once without having to call a function for every single preference. And the last missing preference has been added: PGPPref_GroupsFile.

    Furthermore a new standard dialog has been added here: ShowPrefsDialog will show PGPkey's preferences dialog with the tab control page at its front that you select by setting the property PrefsPage (available for all PGP versions supported by SPGP).

  3. And finally I've added the new TPGPKeysGenerate component, though Steve's reference still characterizes them "as experimental and subject to change": They provide four methods for creating RSA keys, DSA (sign-only) keys, DH (encrypt) sub-keys and the complete DH/DSS key pair at once. Please read the instructions carefully.
  4. All components changing key rings or keys (TPGPKeysGenerate, TPGPKeyImport, TPGPSetKeyProps, TPGPreferences) now provide the property GetKeyProps which enables you to have your user ID and hex ID lists updated automatically.

Version 1.2.4 - 29.07.2000

Version 1.2.3 - 30.06.2000

Version 1.2.2 - 11.04.2000

Version 1.2.1 - 08.04.2000

Version 1.2. - 28.02.2000

  1. With SPGP version the following changes / additional features are available:
  2. TPGPEncode: The DoEncode method (by default) has been restricted to doing textmode / armored encoding only, as binary encoding wouldn't work properly (you cannot pass binary data as strings).
  3. TPGPEncode: The DoEncodeFile method now attaches .pgp to FileIn's name if you don't provide FileOut.
  4. TPGPDetachedSigCreate: The DoSigCreate method now attaches .sig to FileIn's name instead of changing its extension if you don't provide FileOut.
  5. TPGPSetKeyProps: The DoKeyPassChange method now provides setting and checking of minimum length and quality.
  6. The OnGetSignKeyPass, OnGetPassphrase and OnGetPass events in TPGPEncode, TPGPDecode, TPGPDetachedSigCreate and TPGPSetKeyProps now verify that you select a private key and provide a KeyProps record for showing detailed information to the user about the key that the passphrase is required for.
  7. Cancelling the passphrase dialogs will now return properly without keeping the last passphrase entered.
  8. The default PGP dialogs (only with PGP versions 6.x) are now available for the following methods:
    • DoEncode / DoEncodeFile (TPGPEncode)
    • DoDecode / DoDecodeFile (TPGPDecode)
    • DoSigCreate (TPGPDeatchedSigCreate)
    • DoKeyPassChange (TPGPSetKeyProps)
  9. To enable using these dialogs just set the new property StandardDlg of the appropriate components to true. Another new property coming along with this feature is ParentHandle, which allows you make PGP's dialogs act as child windows of your application's windows (forms): It takes the handle of the intended parent window.
  10. A PGP6X function has been added to determine whether the previous mentioned standard dialogs are available on the respective computer. It is called implicitely on execution of these methods.
  11. Another unit providing the PGP error constants has been added.
  12. A direct link to Steve Heller's function reference has been added to the help file's References page.
  13. Some more functions (e.g. key generation) are available through the spgp.pas wrapper but currently not included in these components and not supported by the author (see Steve Heller's function reference).

Version 1.1 - 16.11.1999

PGP™ is © PGP Corporation