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

File Encryption Question

P: n/a
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.
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
pe***@mclinn.com (Peter) wrote in news:dcde2a5a.0408180718.f9db9f4
@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?

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 21 '05 #2

P: n/a
* pe***@mclinn.com (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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.