Click here to Skip to main content
15,887,875 members
Home / Discussions / C#
   

C#

 
AnswerRe: Why xml line highlighted yellow in IDE? Pin
Furty18-Feb-03 16:27
Furty18-Feb-03 16:27 
GeneralRe: Why xml line highlighted yellow in IDE? Pin
Member 9618-Feb-03 16:40
Member 9618-Feb-03 16:40 
GeneralRe: Why xml line highlighted yellow in IDE? Pin
Atul Kale19-Feb-03 7:19
Atul Kale19-Feb-03 7:19 
GeneralRe: Why xml line highlighted yellow in IDE? Pin
Member 9619-Feb-03 12:12
Member 9619-Feb-03 12:12 
GeneralRe: Why xml line highlighted yellow in IDE? Pin
David Stone19-Feb-03 12:02
sitebuilderDavid Stone19-Feb-03 12:02 
GeneralRe: Why xml line highlighted yellow in IDE? Pin
Member 9619-Feb-03 12:16
Member 9619-Feb-03 12:16 
Generalcryptography question Pin
jtmtv1818-Feb-03 14:23
jtmtv1818-Feb-03 14:23 
GeneralRe: cryptography question Pin
Furty18-Feb-03 16:09
Furty18-Feb-03 16:09 
The simplest way would be to have a fixed salt byte array of course, however the next easiest option would be to write the salt bytes to your filestream when encrypting, and read them back when decrypting.

Encryption:

FileStream fs = File.Create(filename);<br />
byte[] salt = new byte[16];<br />
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();<br />
rng.GetBytes(salt);<br />
fs.Write(salt, 0, salt.Length)<br />
<br />
// PasswordDeriveBytes and do your encrypting..


Decryption:

FileStream fs = File.OpenRead(filename);<br />
byte[] salt = new byte[16];<br />
fs.Read(salt, 0, salt.Length)<br />
<br />
// PasswordDeriveBytes and do your decrypting..


While this is certainly not the best method of doing it, it will work fine. Ideally your salt bytes would also be encrypted, so as not to weaken the basic thing they're about. But then again, your IV should be unique and encrypted too, and you should be using a keyed checksum, and etc etc.. OK, I'll write an article and put together a wrapper for it all *when* I get a few hours free time.. For now this will get you by Smile | :)
GeneralRe: cryptography question Pin
jtmtv1818-Feb-03 16:57
jtmtv1818-Feb-03 16:57 
GeneralPassing various Controls by ref Pin
draco_iii18-Feb-03 10:56
draco_iii18-Feb-03 10:56 
GeneralRe: Passing various Controls by ref Pin
Nnamdi Onyeyiri18-Feb-03 11:29
Nnamdi Onyeyiri18-Feb-03 11:29 
GeneralRe: Passing various Controls by ref Pin
Kannan Kalyanaraman18-Feb-03 19:00
Kannan Kalyanaraman18-Feb-03 19:00 
GeneralRe: Passing various Controls by ref Pin
leppie18-Feb-03 23:14
leppie18-Feb-03 23:14 
GeneralRe: Passing various Controls by ref Pin
Richard Deeming19-Feb-03 0:49
mveRichard Deeming19-Feb-03 0:49 
GeneralA tough design decision Pin
Chris Austin18-Feb-03 8:28
Chris Austin18-Feb-03 8:28 
GeneralRe: A tough design decision Pin
Philip Fitzsimons19-Feb-03 1:55
Philip Fitzsimons19-Feb-03 1:55 
GeneralRe: A tough design decision Pin
Chris Austin19-Feb-03 3:59
Chris Austin19-Feb-03 3:59 
GeneralRe: A tough design decision Pin
Stephane Rodriguez.19-Feb-03 3:05
Stephane Rodriguez.19-Feb-03 3:05 
GeneralRe: A tough design decision Pin
Chris Austin19-Feb-03 3:48
Chris Austin19-Feb-03 3:48 
QuestionRecommendations for a commercial .NET Grid product? Pin
Zombies with Coffee, LLC18-Feb-03 5:38
professionalZombies with Coffee, LLC18-Feb-03 5:38 
AnswerRe: Recommendations for a commercial .NET Grid product? Pin
Nnamdi Onyeyiri18-Feb-03 6:44
Nnamdi Onyeyiri18-Feb-03 6:44 
AnswerRe: Recommendations for a commercial .NET Grid product? Pin
Kannan Kalyanaraman18-Feb-03 19:05
Kannan Kalyanaraman18-Feb-03 19:05 
AnswerRe: Recommendations for a commercial .NET Grid product? Pin
Alexander Kojevnikov19-Feb-03 6:39
Alexander Kojevnikov19-Feb-03 6:39 
GeneralRe: Recommendations for a commercial .NET Grid product? Pin
Atul Kale20-Feb-03 3:52
Atul Kale20-Feb-03 3:52 
GeneralA little help with MDIParent event process..... Pin
LongRange.Shooter18-Feb-03 5:30
LongRange.Shooter18-Feb-03 5:30 

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.