Click here to Skip to main content
12,628,919 members (30,921 online)
Click here to Skip to main content


51 bookmarked

Encrypt and Decrypt Data with C#

, 17 May 2006 CPOL
Encrypt and Decrypt important data with C# and play
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace EnCryptDecrypt
    public partial class frmMain : Form
        public frmMain()

        private void btnEncrypt_Click(object sender, EventArgs e)
            if (txtClearText.Text == "")
                error.SetError(txtClearText, "Enter the text you want to encrypt");
                string clearText = txtClearText.Text.Trim();
                string cipherText = CryptorEngine.Encrypt(clearText, true);
                txtDecryptedText.Visible = false;
                label3.Visible = false;
                txtCipherText.Text = cipherText;
                btnDecrypt.Enabled = true;

        private void btnDecrypt_Click(object sender, EventArgs e)
            string cipherText = txtCipherText.Text.Trim();
            string decryptedText = CryptorEngine.Decrypt(cipherText, true);
            txtDecryptedText.Text = decryptedText;
            txtDecryptedText.Visible = true;
            label3.Visible = true;            

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Syed Moshiur Murshed
Software Developer Pöyry Infra GmbH
Austria Austria
I am Syed Moshiur Murshed from Bangladesh. I studied BSC in Computer Science at American International University Bangladesh( And then MSC in Software Technology at Stuttgart University of Applied Science, Germany( Currently I am employed as a Software Engineer at Pöyry Infra GmbH in Salzburg, Austria since 04-2011.
I have been learning C# for quite some time and Enjoying it.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161205.3 | Last Updated 18 May 2006
Article Copyright 2006 by Syed Moshiur Murshed
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid