.NET And Triple DES Security
page 7 of 8
by Kay Lee
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 39922/ 57

Good, Now How Do I Use It?

[ Download Code ] | [ Download Help ]
When using the encryption assembly, you may refer to the windows form example attached to the solution.

The way you use this article's implementation is quite simple. 

string password = "MyPassword1s123";

KraGiE.TripleDES des = new KraGiE.TripleDES();
des.SetKeys = "Whatever your Private-Key Is";
des.SetMode = KraGiE.TripleDES.CipherMode.CipherBlockChaining;
string encrypted = des.Encrypt(password);


string decrypted = des.Decrypt(encrypted);

if (password == decrypted)
     System.Diagnostics.Debug.WriteLine("Kay doesn't know what he's talking about.");

des = null;

Just remember that you need to either use the SetKeys property or manually set the Key and IV properties with 24 byte and 8 byte arrays respectively.  Based on the parameter type of the Encrypt and Decrypt method, you'll receive the same type back.

View Entire Article

User Comments

Title: Hai   
Name: mangala
Date: 2008-07-22 7:54:10 AM
Title: Public Key   
Name: Joe Grant
Date: 2006-12-08 12:12:50 PM
How would one go about create a public key to share with someone so they can decrypt without sharing the private key?
Title: Excellent coverage of TripleDES   
Name: Sam
Date: 2005-08-02 9:11:49 PM
Great stuff... simple but with enough background information to understand the important elements eg. PK, IV, Cipher etc. I will be using parts of it in my enterprise application.
Title: triple des   
Name: Josh
Date: 2004-10-13 10:12:45 PM
we've been looking at different encryption methods in class and lectures have been so boring. i decided to search around and found your article to be a great practical implementation. i wish my class would provide us with pratical examples like this. Thanks.
Title: Thanks   
Name: Kay Lee
Date: 2004-10-13 6:42:03 PM
Thanks. I'm glad you like it, and I hope the source works well for you.
Title: Triple DES Encryption   
Name: Brian Chiasson
Date: 2004-10-12 3:35:52 PM
Excellent article. I have been looking for a couple of hours for something on encryption. It shed light on the subject and provided me with useful code for my intranet application. Thanks a million...

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-07-15 5:12:04 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search