Well I got slightly bored, and thought I’d dig into some old crypto software. And PGP 1.0 was as good as any place to start.
Now one scandalous thing at the time was the inclusion of RSAREF 1.0, the RSA reference library which redistribution required a license that wasn’t exactly included with PGP.
A company called Public Key Partners (PKP) holds the exclusive
commercial license to sell and sub-license the RSA public key
cryptosystem. For licensing details on the RSA algorithm, you can
contact Robert Fougner at PKP, at 408/735-6779. The author of this
software implementation of the RSA algorithm is providing this
implementation for educational use only.
And wow was this fun at the time. As far as I know this license lapsed on September 21, 2000.
And then there was this slight issue:
After Biham and Zimmermann go their food and sat down, Zimmermann took out a few pages of computer listings. Within minutes, Birham was finding fundamental flaws in Bass-O-Matic. Some of the flaws were subtle-weaknesses that made the algorithm susceptible to differential cryptanalysis, which was Birham’s speciality. Others were more embarrassing, like a conceptual error in Zimmermann’s algorithm that prevented the last bit of each byte from being properly encrypted. After ten minutes of Birham’s onslaught, Zimmermann realized that Bass-O-Matic was a lost cause.
So now you would be wondering, why would I even bother with what was a quickly abandoned encryption? Well I was bored, and I was more interested if I could locate the source to 1.0. What would be more interesting to me is to revive it onto somewhat more modern 32-bit platforms. Namely OS X, Win32 and MS-DOS.
With a little luck, I found the unix_pgp10.tar.gz, which does contain the source code for a Unix version of PGP! This version is more so geared to the SPARC of all things. Specifically it mentions:
Tested on SunOS 4.1 with gcc 1.39
However building on OS X was trival with changing the Makefile. The CC had to be changed to reflect a 32bit build, and the DEFINES had to remove the HIGHFIRST define, as the x86 platform is little endian.
CC=cc -arch i386
DEFINES= -DUNIX -DPSEUDORANDOM -DUNIT16 -DPORTABLE
Is the relevant changes.
And even better it’ll work!
$ pgp pgp.ctx pgp.exe
Pretty Good Privacy 1.0 – RSA public key cryptography for the masses.
(c) Copyright 1990 Philip Zimmermann, Phil’s Pretty Good Software. 5 Jun 91
File has signature. Public key is required to check signature.
File ‘pgp.ctx’ has signature, but with no text.
Text is assumed to be in file ‘pgp.exe’.
Good signature from user “Zimmermann, Philip R. – email@example.com”.
Signature made Wed Jun 5 13:51:18 1991
Signature and text are separate. No output file produced.
Plaintext filename: pgp.exe
Wasn’t that great!
Now getting this to run on Windows was a little bit more of a challenge. I was going to build from the UNIX source code again, however both Visual C++, and Watcom C++ build an executable, but neither are able to add keys to the keyring, verify the executable reliably and deadlock all the time.
So I thought I’d get a little creative and start replacing some code from the MS-DOS version of PGP. It turns out that all I needed was rsaio.c & rsaio.h and I was able to build an executable. But I ran into other snags, and stack errors. A glance at the MS-DOS Makefile, and I saw that they had to up the stack size from the defaults. So I figured the same would hold true, and I picked a much larger 32kb stack for the heck of it. I mean it is 2014, and if you can’t handle a 32kb stack well..
Compiling on Visual C++ went like this:
cl386 -c /DPSEUDORANDOM /DUNIT16 /DPORTABLE *.c
cl *.obj /F32768 /Fepgp.exe
And for Watcom C++
wcl386 -c -dPSEUDORANDOM -dUNIT16 -dPORTABLE *.c
wcl386 *.obj -fe=pgp.exe -k32768
And now I can build for either compiler. And even better, it works!
Even for completness sakes, DOS4G/W works as well! Just remember to link for MS-DOS
wcl386 *.obj -fe=pgp.exe -k32768 -l=dos4g
And you should be good to go.
So what happened to PGP? Well version 2 used a more ‘acceptable’ encryption, the IDEA cypher, then the company was sold, IP was sold again and again. It’s still out there, mostly for email encryption.
While it sure did ignite the world on fire for a while, the overall difficulty of using it, combined with the ease of losing the private key and all your data is just too easy. But this really is the nature of the beast.