Click here to Skip to main content
15,898,538 members
Home / Discussions / C#
   

C#

 
GeneralRe: User interface Pin
momoo10-Nov-05 21:50
momoo10-Nov-05 21:50 
Question[C#] How to reference a parent class? Pin
Distinctive19-Oct-05 15:05
Distinctive19-Oct-05 15:05 
AnswerRe: [C#] How to reference a parent class? Pin
MoustafaS19-Oct-05 15:16
MoustafaS19-Oct-05 15:16 
AnswerRe: [C#] How to reference a parent class? Pin
timothycn19-Oct-05 16:13
timothycn19-Oct-05 16:13 
Questionclipboard Pin
xilefxilef19-Oct-05 12:24
xilefxilef19-Oct-05 12:24 
QuestionRe: clipboard Pin
MoustafaS19-Oct-05 14:36
MoustafaS19-Oct-05 14:36 
AnswerRe: clipboard Pin
xilefxilef20-Oct-05 4:36
xilefxilef20-Oct-05 4:36 
Questionproblem decrypting a file Pin
Sasuko19-Oct-05 12:20
Sasuko19-Oct-05 12:20 
i use this code to crypt the file i load with opendialog, i get a file 1k bigger the original:

FileStream stream = new FileStream(file_open_path, FileMode.Open, FileAccess.Read);
byte[] data = new Byte[stream.Length];
stream.Read(data, 0, (int)stream.Length);

FileStream writer = new FileStream(file_save_path, FileMode.Create, FileAccess.Write);
writer.Write(data, 0, (int)stream.Length);
stream.Close();
DESCryptoServiceProvider cryptic = new DESCryptoServiceProvider();
ASCIIEncoding ascii = new ASCIIEncoding();

cryptic.Key = ascii.GetBytes(key);
cryptic.IV = ascii.GetBytes(key);
CryptoStream crsStream = new CryptoStream(writer, cryptic.CreateEncryptor(), CryptoStreamMode.Write);

crsStream.Close();
writer.Close();
MessageBox.Show("Il Divx è stato criptato con successo!");
textBox1.Text = textBox2.Text = textBox3.Text = "";
openFileDialog1.FileName = saveFileDialog1.FileName = "";


then i use this one to dencrypt, but i don't free the file becouse i get the seme size and yet crypted, where do i wrong?:



FileStream stream = new FileStream(file_open_path, FileMode.Open, FileAccess.ReadWrite);

DESCryptoServiceProvider cryptic = new DESCryptoServiceProvider();
ASCIIEncoding ascii = new ASCIIEncoding();

cryptic.Key = ascii.GetBytes(key);
cryptic.IV = ascii.GetBytes(key);
CryptoStream crsStream = new CryptoStream(stream, cryptic.CreateDecryptor(), CryptoStreamMode.Read);
byte[] data = new Byte[stream.Length];
stream.Read(data, 0, (int)stream.Length);
int val = (int)stream.Length;
crsStream.Close();
stream.Close();

FileStream writer = new FileStream(file_save_path, FileMode.Create, FileAccess.Write);
writer.Write(data, 0, val);
writer.Close();

MessageBox.Show("Il Divx è stato decriptato con successo!");
textBox4.Text = textBox5.Text = textBox6.Text = "";
openFileDialog2.FileName = saveFileDialog2.FileName = "";

AnswerRe: problem decrypting a file Pin
leppie19-Oct-05 19:44
leppie19-Oct-05 19:44 
GeneralRe: problem decrypting a file Pin
Sasuko19-Oct-05 22:29
Sasuko19-Oct-05 22:29 
AnswerRe: problem decrypting a file Pin
leppie19-Oct-05 22:39
leppie19-Oct-05 22:39 
News71-528: TS: Microsoft® .NET Framework 2.0 - Web-based Client Development Pin
vipul_vips19-Oct-05 12:16
vipul_vips19-Oct-05 12:16 
QuestionCOM Collections: How to use get_Item(ref object index) Pin
dkarlton19-Oct-05 12:07
dkarlton19-Oct-05 12:07 
AnswerRe: COM Collections: How to use get_Item(ref object index) Pin
leppie19-Oct-05 19:49
leppie19-Oct-05 19:49 
GeneralRe: COM Collections: How to use get_Item(ref object index) Pin
dkarlton20-Oct-05 3:12
dkarlton20-Oct-05 3:12 
GeneralRe: COM Collections: How to use get_Item(ref object index) Pin
dkarlton20-Oct-05 3:33
dkarlton20-Oct-05 3:33 
QuestionConfused On References Pin
budidharma19-Oct-05 12:01
budidharma19-Oct-05 12:01 
AnswerRe: Confused On References Pin
Matt Gerrans19-Oct-05 16:34
Matt Gerrans19-Oct-05 16:34 
GeneralRe: Confused On References Pin
budidharma19-Oct-05 17:32
budidharma19-Oct-05 17:32 
GeneralRe: Confused On References Pin
Matt Gerrans19-Oct-05 18:07
Matt Gerrans19-Oct-05 18:07 
GeneralRe: Confused On References Pin
S. Senthil Kumar19-Oct-05 23:04
S. Senthil Kumar19-Oct-05 23:04 
GeneralRe: Confused On References Pin
budidharma20-Oct-05 3:30
budidharma20-Oct-05 3:30 
GeneralRe: Confused On References Pin
S. Senthil Kumar20-Oct-05 4:30
S. Senthil Kumar20-Oct-05 4:30 
GeneralRe: Confused On References Pin
budidharma20-Oct-05 4:51
budidharma20-Oct-05 4:51 
GeneralRe: Confused On References Pin
S. Senthil Kumar20-Oct-05 5:41
S. Senthil Kumar20-Oct-05 5:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.