EldoS
Navigation
Web site
Support
Table Of Contents

Encrypt the data

To encrypt the data using OpenPGP algorithms, you need to use ElPGPWriter 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 ElPGPWriter 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 ElPGPWriter class to reference the instance of ElPGPKeyring 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 ElPGPWriter class.

To compress the data before encryption, set Compress property of ElPGPWriter 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 ElPGPWriter class.

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

To sign and encrypt the data in one operation use EncryptAndSign() method of ElPGPWriter 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 ElPGPWriter class to true and UseNewFeatures property of ElPGPWriter to false. Set these properties before calling Encrypt() method.

 
Contact Us | Terms of Use | Trademarks | Privacy Statement
Copyright (c) 1998-2011, EldoS Corporation