PDA

View Full Version : امنیت ارسال ایمیل با استفاده از توابع ایجاد Hash



tefos666
یک شنبه 07 اسفند 1390, 21:11 عصر
سلام خدمت اساتید گرامی

بنده یک نرم افزار نوشتم که ایمیل ارسال می کند
ورودی به صورت زیر است


privatevoid SendByMail(FileStream FS, string Email, string CustomerID,string subject,string Body)

String server = "mail.***.com";


String File = FS.Name;


MailAddress to = newMailAddress(Email);


MailAddress from = newMailAddress("***@***.com");


MailMessage message = newMailMessage(from, to);


// attach File

FS.Dispose();




Attachment data = newAttachment(File, MediaTypeNames.Application.Octet);




ContentDisposition disposition = data.ContentDisposition;

disposition.CreationDate = System.IO.
File.GetCreationTime(File);

disposition.ModificationDate = System.IO.
File.GetLastWriteTime(File);

disposition.ReadDate = System.IO.
File.GetLastAccessTime(File);

message.Attachments.Add(data);

message.Subject = subject;

message.Body = Body;


SmtpClient client = newSmtpClient(server);

client.Credentials =
newNetworkCredential("***@***.com", "password

try

{

client.Send(message);


MessageBox.Show(" ");



}


catch (Exception ex)

{


thrownewException(ex.Message, ex);


//Console.WriteLine("Exception caught in CreateMessageWithAttachment(): {0}", ex.ToString() );

}


موقع استفاده هم اینجوری عمل کردم


FileStream



fs = newFileStream(txtEmailFile.Text, FileMode.Open);


SendByMail(fs, txtEmail.Text,
"1010",txtsubject.Text,txtBody.Text);



حالا سوالی که برام پیش اومده اینه که من یکسری توابع دارم که می خوام به منظور امنیت فایل ضمیمه ای که به ایمیلم پیوست میشه در حین ارسال اون رو Hash کنم که حاصل آرایه ای 32 بیتی از byte میشه

ولی نمی تونم byte رو چجوری به Filestream تبدیل کنم که در تابع ایمیلم بگنجونم ؟

اینم کدش



Hashing hasher = newHashingClass();


HashingMethod sha = newHashingMethodClass();

sha.HashSize = 256;

hasher.HashingMethod = sha;

hasher.ReadFile(txtEmailFile.Text, 0, 0, XceedEncryptionLib.
EXEFileProcessing.efpHash, true);

HashedFile = sha.HashValue;


لطفا کمک کنید .........

tefos666
یک شنبه 07 اسفند 1390, 22:05 عصر
سروران گرامی کسی نمیتونه راهی ارائه بده ؟

tefos666
دوشنبه 08 اسفند 1390, 08:09 صبح
لطفا کمک کنید .