File Encryption Question

P

Peter

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.
 
L

Lucas Tam

(e-mail address removed) (Peter) wrote in @posting.google.com:
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.

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

Herfried K. Wagner [MVP]

* (e-mail address removed) (Peter) scripsit:
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.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top