OpenPGP: Support for Legacy PGP Implementations
By default, the component encrypts data using the newer and more secure integrity protected data packet format. However, older implementations such as PGP 6.5.8 require the older, less secure packet type.
To support these legacy systems, enable the AllowOldPacketType configuration setting. When this is set to True, the component reads the capabilities of the recipient's key to determine whether the older packet format is required:
- If required, the component uses the older packet type.
- If not required, the newer integrity protected packet type is used.
By default, this setting is False, meaning the component will always use the newer integrity protected packet format and will not fall back to the older format under any circumstances.
// Encrypt using the old packet format
pgp.Config("AllowOldPacketType=true");
pgp.InputMessage = inputMessage;
pgp.RecipientKeys.Add(new Key(publicKey, "recipient@test.com"));
pgp.OutputFile = outputFile;
pgp.Overwrite = true;
pgp.EncryptingAlgorithm = "CAST5";
pgp.Encrypt();
// Decrypt a message encrypted using the old packet format
pgp.Config("AllowOldPacketType=true");
pgp.OutputFile = decryptedFile
pgp.InputFile = encryptedFile;
pgp.Keys.Add(new Key(privateKey, "recipient@test.com") { Passphrase = "test" });
pgp.Decrypt();
Note that PGP version 6.5.8 does not support AES, which is the default encryption algorithm used by the components. Instead, CAST5, IDEA, or 3DES must be used. These algorithms can be specified via the EncryptionAlgorithm property, as shown in the sample code above.
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.