File Encryption Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter

    File Encryption Question

    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

    #2
    Re: File Encryption Question

    peter@mclinn.co m (Peter) wrote in news:dcde2a5a.0 408180718.f9db9 f4
    @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@rog ers.com)
    Please delete "REMOVE" from the e-mail address when replying.

    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: File Encryption Question

      * peter@mclinn.co m (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.Bina ryReader'. 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/>

      Comment

      Working...