By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,458 Members | 1,435 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,458 IT Pros & Developers. It's quick & easy.

CryptoStream question

P: n/a
I have a file that contains initialization vector and key crypted with the
key 'passwd'. My problem is that when I execute the code

TripleDESCryptoServiceProvider pk = new TripleDESCryptoServiceProvider();
FileStream fin = new
FileStream("iv_key_cry.txt",FileMode.Open,FileAcce ss.Read);
CryptoStream encStream = new CryptoStream(fin,
passwd.CreateDecryptor(passwd.Key,passwd.IV),
CryptoStreamMode.Read);
encStream.Read(pk.IV,0,pk.IV.Length);
encStream.Read(pk.Key,0,pk.Key.Length);

pk.IV and pk.Key contain random values instead the iv-key I stored. Where is
my mistake?
Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
How did you store the values?

-Rob Teixeira [MVP]

"Fede" <fe***************@as2594.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I have a file that contains initialization vector and key crypted with the
key 'passwd'. My problem is that when I execute the code

TripleDESCryptoServiceProvider pk = new TripleDESCryptoServiceProvider();
FileStream fin = new
FileStream("iv_key_cry.txt",FileMode.Open,FileAcce ss.Read);
CryptoStream encStream = new CryptoStream(fin,
passwd.CreateDecryptor(passwd.Key,passwd.IV),
CryptoStreamMode.Read);
encStream.Read(pk.IV,0,pk.IV.Length);
encStream.Read(pk.Key,0,pk.Key.Length);

pk.IV and pk.Key contain random values instead the iv-key I stored. Where is my mistake?

Nov 15 '05 #2

P: n/a
Your sample code doesn't show you creating any object named passwd. The
only items in your sample that would have a Key and IV property would be pk.
If you're trying to use the string "passwd" you have missed the entire
concept.

Where does the object passwd come from and what type is it?

Dale

"Fede" <fe***************@as2594.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I have a file that contains initialization vector and key crypted with the
key 'passwd'. My problem is that when I execute the code

TripleDESCryptoServiceProvider pk = new TripleDESCryptoServiceProvider();
FileStream fin = new
FileStream("iv_key_cry.txt",FileMode.Open,FileAcce ss.Read);
CryptoStream encStream = new CryptoStream(fin,
passwd.CreateDecryptor(passwd.Key,passwd.IV),
CryptoStreamMode.Read);
encStream.Read(pk.IV,0,pk.IV.Length);
encStream.Read(pk.Key,0,pk.Key.Length);

pk.IV and pk.Key contain random values instead the iv-key I stored. Where is my mistake?

Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.