Connecting Tech Pros Worldwide Forums | Help | Site Map

File Encryption Question

Peter
Guest
 
Posts: n/a
#1: Nov 21 '05
I have a component that encrypts/decrypts files using Rijndael
encryption. The component works flawlessly but I want to try to
extend its capablities and this is my general question:

I have an "in" and a "out" function.

The in function supplys the name of the location of where the file to
be encrypted resides and the "out" function specifies the location of
where to write the outputed encrypted file. Both function require a
string.

Instead of writing this encrypted file back to the drive I would like
to store it in a variable, read information from this file, and then
dump the variable.

IE. Opening a package looking in, but not destroying anything.

What is the best approach to doing this...

I'm trying to avoid, writing decrypted files to the drive and then
having to securely delete them.

Lucas Tam
Guest
 
Posts: n/a
#2: Nov 21 '05

re: File Encryption Question


peter@mclinn.com (Peter) wrote in news:dcde2a5a.0408180718.f9db9f4
@posting.google.com:
[color=blue]
> Instead of writing this encrypted file back to the drive I would like
> to store it in a variable, read information from this file, and then
> dump the variable.
>[/color]

Can you stream the file to a byte array... or an IO stream like
MemoryStream?

--
Lucas Tam (REMOVEnntp@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#3: Nov 21 '05

re: File Encryption Question


* peter@mclinn.com (Peter) scripsit:[color=blue]
> I have a component that encrypts/decrypts files using Rijndael
> encryption. The component works flawlessly but I want to try to
> extend its capablities and this is my general question:
>
> I have an "in" and a "out" function.
>
> The in function supplys the name of the location of where the file to
> be encrypted resides and the "out" function specifies the location of
> where to write the outputed encrypted file. Both function require a
> string.
>
> Instead of writing this encrypted file back to the drive I would like
> to store it in a variable, read information from this file, and then
> dump the variable.[/color]

Take a look at the 'System.IO.BinaryReader'. You can use this class to
read the contents of a file into a byte array. Depending on how your
encryption algorithms work, you may want to specify a 'MemoryStream' as
output stream, and later use a 'BinaryReader' + 'BinaryWriter' to read
data fro0m the memory stream and write it to the output file.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Closed Thread