.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Windows Application >> Post New QuestionBookmark and Share Subscribe to Forum

CryptoGraphic Error

Posted By: Naim Khan     Posted Date: January 08, 2009    Points:2   Category :Windows Application
Sir i m creatind a one Demo of Security.Cryptography Application built is Successfully . when its running have one Error

Troubleshooting Exceptions: System.Security.Cryptography.CryptographicException

\\code is there
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
using System.IO;

namespace DemoDES
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
string ID = textBox1.Text;
DESCryptoServiceProvider key = new DESCryptoServiceProvider();
MemoryStream ms = new MemoryStream();
CryptoStream encStream = new CryptoStream(ms, key.CreateEncryptor(), CryptoStreamMode.Write);
StreamWriter sw = new StreamWriter(encStream);
sw.WriteLine(ID);
MessageBox.Show(ID,"The Sum is");
byte[] buffer = ms.ToArray();
ms = new MemoryStream(buffer);
encStream = new CryptoStream(ms, key.CreateDecryptor(), CryptoStreamMode.Read);
StreamReader sr = new StreamReader(encStream);
sr.ReadLine();
key.Clear();
sw.Close();
sr.Close();
encStream.Close();
ms.Close();


}
}
}//

can anybody help me

Responses
Author: Faizal             
Posted Date: January 13, 2009     Points: 5   

Hi Naim,
why don't you use other encryption decryption method? Let me know your requirement and i will provide you the encryption decryption method.



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend