Şimdi ise şifrelidiğimiz dosyadaki bilgileri
tekrardan çözeceğiz.
Şekil 3
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Security.Cryptography;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider();
FileStream fs = File.OpenRead(@"c:\sifreli.key");
BinaryReader br = new BinaryReader(fs);
tdes.Key = br.ReadBytes(24);
tdes.IV = br.ReadBytes(8);
FileStream fstream = File.OpenRead(@"c:\sifreli.txt");
CryptoStream cs = new CryptoStream(fstream, tdes.CreateDecryptor(), CryptoStreamMode.Read);
StreamReader sr = new StreamReader(cs);
textBox1.Text = sr.ReadToEnd();
sr.Close();
}
}
}
//Bir sonraki makalede görüşmek üzere. Bahadır ŞAHİN
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Security.Cryptography;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider();
FileStream fs = File.OpenRead(@"c:\sifreli.key");
BinaryReader br = new BinaryReader(fs);
tdes.Key = br.ReadBytes(24);
tdes.IV = br.ReadBytes(8);
FileStream fstream = File.OpenRead(@"c:\sifreli.txt");
CryptoStream cs = new CryptoStream(fstream, tdes.CreateDecryptor(), CryptoStreamMode.Read);
StreamReader sr = new StreamReader(cs);
textBox1.Text = sr.ReadToEnd();
sr.Close();
}
}
}
//Bir sonraki makalede görüşmek üzere. Bahadır ŞAHİN
0 comments:
Yorum Gönder