CryptoStream question

  • Thread starter Thread starter Fede
  • Start date Start date
F

Fede

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,FileAccess.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?
 
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
 
Back
Top