Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,

I have a winform that encrypt and decrypt a file... it's OK,

BUT the problem is it saves the decrypted file to the hard disk, and then i could use it !
Is there any way to reuse the decrypted file without saving it in hard disk ( that the user can see the decrypted file is the problem ! )
for example can i save the file to memory (RAM) and use it as an stream !?
i have searched alot, and i found just memorystream(..).if it's the answer then how should i use it !!?
i'll appreciate any help,
and sorry for my bad english.
Posted
Comments
Sergey Alexandrovich Kryukov 23-Jun-12 19:16pm    
Not clear what's the problem. The memory stream is not worse than any other stream, why not using it? What's the difference from you?
--SA
Mohamad77 24-Jun-12 4:20am    
my code use these lines to save decrypted file to hard disk, then i should use the file, BUT in this way the user can see and access the decrypted file and copy it !
my question is that i want to use the decrypted file without saving it to hard disk !
if Memorystream is the answer, then how should i use it !?


FileStream fsOut = new FileStream("output decrypted file address here", FileMode.Create);

int data;
while ((data = cs.ReadByte()) != -1)
fsOut.WriteByte((byte)data);

thanks alot.

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900