Click here to Skip to main content
15,888,802 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Encrypting Passwords in .NET application [modified] Pin
Yajnesh Narayan Behera30-Jul-08 20:19
Yajnesh Narayan Behera30-Jul-08 20:19 
In my project requirement was same as of your. There is two approach two encrypt as the code level & database level, but I took the code level approach. Although I am not an expert in this area would like to know whether my approach was correct or not also it may answer your query.

I used some class provided by .NET framework.


private static string Encrypt(string originalString)
{

 DESCryptoServiceProvider cryptoProvider = new DESCryptoServiceProvider();
 MemoryStream memoryStream = new MemoryStream();

 CryptoStream cryptoStream = new CryptoStream(memoryStream,  cryptoProvider.CreateEncryptor(bytes, bytes), CryptoStreamMode.Write);

 StreamWriter writer = new StreamWriter(cryptoStream);
 writer.Write(originalString);
 writer.Flush();
 cryptoStream.FlushFinalBlock();
 writer.Flush();

 return Convert.ToBase64String(memoryStream.GetBuffer(), 0, (int) memoryStream.Length);

}


Now the returned string is in encrypted format & can be inserted in the database.

modified on Thursday, July 31, 2008 2:33 AM

GeneralRe: Encrypting Passwords in .NET application Pin
Mark Churchill30-Jul-08 20:54
Mark Churchill30-Jul-08 20:54 
QuestionCreate database from DBML file Pin
Manuel Then28-Jul-08 5:47
Manuel Then28-Jul-08 5:47 
AnswerRe: Create database from DBML file Pin
Sam Xavier31-Jul-08 18:48
Sam Xavier31-Jul-08 18:48 
GeneralRe: Create database from DBML file Pin
Manuel Then31-Jul-08 21:23
Manuel Then31-Jul-08 21:23 
AnswerRe: Create database from DBML file Pin
MisterX4424-Mar-09 10:49
MisterX4424-Mar-09 10:49 
QuestionSqlServerCE and ASP.NET Configuration Pin
hammerstein0528-Jul-08 3:51
hammerstein0528-Jul-08 3:51 
AnswerRe: SqlServerCE and ASP.NET Configuration Pin
led mike28-Jul-08 9:59
led mike28-Jul-08 9:59 
GeneralRe: SqlServerCE and ASP.NET Configuration Pin
hammerstein0528-Jul-08 13:05
hammerstein0528-Jul-08 13:05 
Questionproblem writing a file on my desktop Pin
unknown78928-Jul-08 2:48
unknown78928-Jul-08 2:48 
AnswerRe: problem writing a file on my desktop Pin
Paul Conrad28-Jul-08 18:24
professionalPaul Conrad28-Jul-08 18:24 
GeneralRe: problem writing a file on my desktop Pin
unknown78928-Jul-08 23:04
unknown78928-Jul-08 23:04 
GeneralRe: problem writing a file on my desktop Pin
unknown78930-Jul-08 0:28
unknown78930-Jul-08 0:28 
QuestionMagic: Application runs sometimes and fails sometimes Pin
Muhammad Gouda27-Jul-08 5:10
Muhammad Gouda27-Jul-08 5:10 
AnswerRe: Magic: Application runs sometimes and fails sometimes Pin
Oshtri Deka28-Jul-08 0:26
professionalOshtri Deka28-Jul-08 0:26 
GeneralRe: Magic: Application runs sometimes and fails sometimes Pin
Muhammad Gouda28-Jul-08 2:15
Muhammad Gouda28-Jul-08 2:15 
GeneralRe: Magic: Application runs sometimes and fails sometimes Pin
Lutosław28-Jul-08 7:39
Lutosław28-Jul-08 7:39 
AnswerI found a solution ... thanks Pin
Muhammad Gouda2-Aug-08 1:44
Muhammad Gouda2-Aug-08 1:44 
GeneralRe: I found a solution ... thanks Pin
Mark Salsbery2-Aug-08 7:02
Mark Salsbery2-Aug-08 7:02 
GeneralRe: I found a solution ... thanks Pin
Muhammad Gouda8-Aug-08 21:45
Muhammad Gouda8-Aug-08 21:45 
QuestionMore than 256 colors in ColorPalette? Pin
Tobias Norlund27-Jul-08 1:16
Tobias Norlund27-Jul-08 1:16 
QuestionMCAD to MCSD or MCPD? Pin
RogueTrooper26-Jul-08 15:09
RogueTrooper26-Jul-08 15:09 
AnswerRe: MCAD to MCSD or MCPD? Pin
Scott Dorman26-Jul-08 17:58
professionalScott Dorman26-Jul-08 17:58 
Questionupper limit on the number of projects for soultion in vs2005 Pin
sivaarc26-Jul-08 4:03
sivaarc26-Jul-08 4:03 
AnswerRe: upper limit on the number of projects for soultion in vs2005 Pin
Paul Conrad26-Jul-08 5:21
professionalPaul Conrad26-Jul-08 5:21 

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.