Discuss this help topic in SecureBlackbox Forum

Encrypt the data

To encrypt the data using OpenPGP algorithms, you need to use TElPGPWriter class.

First, you need to define, which encryption type you will use. It is possible to encrypt the data using public keys, using password or both. Note, that PGP 2.6 doesn't support password-based encryption. Set the desired encryption type to EncryptionType property of TElPGPWriter class.

If you plan to use PublicKey or Both encryption type, you need to specify the keys, which will be used for encryption. This is done by setting the EncryptingKeys property of TElPGPWriter class to reference the instance of TElPGPKeyring class, which contains the keys. Note, that all keys will be used for encryption. If your keyring contains more keys than you plan to use then you need to copy the keys to other keyring.

If you plan to use Password or Both encryption type, you need to specify the passphrases. This is done using Passphrases property of TElPGPWriter class.

To compress the data before encryption, set Compress property of TElPGPWriter class to true. If you want to "armor" the data (encode it to text using base64 format), set Armor property to true. Read more about armoring in the corresponding how-to article

To specify the data encryption algorithm use SymmetricKeyAlgorithm property of TElPGPWriter class.

Finally, call Encrypt() method of TElPGPWriter class to process the data.

To sign and encrypt the data in one operation use EncryptAndSign() method of TElPGPWriter class. Before calling this method, read the corresponding how-to article.

If you want the saved data to be readable using old PGP software (PGP 2.6, old versions of GnuPG etc.) you need to save the data in old format. To do this, set UseOldPackets property of TElPGPWriter class to true and UseNewFeatures property of TElPGPWriter to false. Set these properties before calling Encrypt() method.

How To articles about file encryption and signing with OpenPGP

Discuss this help topic in SecureBlackbox Forum