PGP 2.x compatibility

The early releases of the original PGP program from the 2.x version product line operate according to the RFC 1991 format.

Unfortunately the current OpenPGP standard is not backward compatible with PGP 2.x software and if you need to exchange encrypted or signed and encrypted data with such systems you will have to take actions in order to produce compatible output.

In this article we will show how to enable PGP 2.x compatible output with our OpenPGP libraries and will mention some errors that indicate that the PGP 2.x compatibility mode hasn’t been tuned on. To receive data with our products you don’t have to do anything as they recognize the format automatically.

1. Enable PGP 2.x compatibility
2. Common errors

Enable PGP 2.x compatibility

In order to enable PGP 2.x compatibility a special property has to be turned on:

C# example (OpenPGP Library for .NET)

1
2
3
4
    PGPLib pgp = new PGPLib();           
    pgp.Pgp2Compatible = true;
    // now in subsequent encryption or sign and encrypt calls 
    // the data will be compatible with PGP 2.x systems

VB.NET example (OpenPGP Library for .NET)

1
2
3
4
    Dim pgp As New PGPLib()           
    pgp.Pgp2Compatible = True
    ' now in subsequent encryption or sign and encrypt calls 
    ' the data will be compatible with PGP 2.x systems

Java example (OpenPGP Library for Java)

1
2
3
4
    PGPLib pgp = new PGPLib();           
    pgp.setPgp2Compatible(true);
    // now in subsequent encryption or sign and encrypt calls 
    // the data will be compatible with PGP 2.x systems

Common errors

Bad or missing CTB_CKE byte

This error displayed by PGP 2.x software is caused by encrypted or signed and encrypted OpenPGP data produced by newer software implementations. The solution is to enable PGP 2.x compatibility as shown above.

Badly-formed or corrupted signature certificate

This error is produced when the signed and encrypted data is not compatible with PGP 2.x. The solution is to enable PGP 2.x compatibility as shown above.

Summary

This post illustrates how to produce PGP 2.x compatible output with DidiSoft OpenPGP Library for .NET and OpenPGP Library for Java. Usually you will have to take the steps described here only if you are certain that the recipient of the encrypted data uses such old software.

To receive PGP 2.x encrypted data, you don’t have to do anything, because our libraries recognize the format automatically.