Encrypting and Decrypting with DES

This article shows how to encrypt and decrypt data using the DES component of IPWorks Encrypt.

Date Entered: 11/12/2014    Last Updated: 11/12/2014

IPWorks Encrypt makes it very easy to encrypt and decrypt data. This article will detail the process of performing DES encryption and decryption.

DES Encryption

DES Encryption is as simple as selecting a KeyPassword and specifying the data to be encrypted. Please see the following example:

Des des = new Des(); des.KeyPassword = "MyKeyPassword"; des.InputFile = "C:\\Path\\to\\UnEncryptedFile.txt"; des.OutputFile = "C:\\Path\\to\\EncryptedFile.dat"; des.Encrypt();

DES Decryption

DES Decryption is just as simple as DES Encryption. All that is needed is the encrypted data and the KeyPassword that was used during the encryption.

Des des = new Des(); des.KeyPassword = "MyKeyPassword"; des.InputFile = "C:\\Path\\to\\EncryptedFile.dat"; des.OutputFile = "C:\\Path\\to\\DecryptedFile.txt"; des.Decrypt();

Configuring DES to use Hex-encoded strings

The DES component can be instructed to use Hex-encoded strings for its encryption and decryption operations. When the UseHex property is set to true, the Encrypt operation will Hex-encode the encrypted data. Similarly, if the UseHex property is set to true, the Decrypt operation will assume that the encrypted data has been Hex-encoded.

Additional Options

The DES component supports a variety of options to offer more control over the encryption and decryption mechanisms used. Options include the ability to specify the Cipher Mode and Padding Mode used, as well as specifying the Key and IV values. Please see the IPWorks Encrypt help documentation for more information on these options.

We appreciate your feedback.  If you have any questions, comments, or suggestions about this entry please contact our support team at kb@nsoftware.com.