.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

Error In Encryption

Posted By: Naim Khan     Posted Date: January 08, 2009    Points:2   Category :Windows Application
Hello Sir,
I have an Error "Troubleshooting Exceptions: System.Security.Cryptography.CryptographicException"
and BAD Data" what is the Meaning of it.

Code is there
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);
Error In This Line// sr.ReadLine();
key.Clear();
sw.Close();
sr.Close();
encStream.Close();
ms.Close();


}

Responses
Author: Praveen             
Posted Date: January 08, 2009     Points: 5   

Which .NET version are you using? It might be bug in .NET 2.0 check out this

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=98208



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