Re: Encrypt/Decrypt dataset without writing to file.
From: C P (nospam_at_nospam.com)
Date: 03/11/04
- Next message: Shawn Farkas: "Re: CAS in March 04 MSDN Article "Secure and Deploy Business Solutions with Microsoft Visual Studio Tools for Office""
- Previous message: Michael Giagnocavo [MVP]: "Re: Product Key dilemma"
- In reply to: moondaddy: "Encrypt/Decrypt dataset without writing to file."
- Next in thread: Shawn Farkas: "RE: Encrypt/Decrypt dataset without writing to file."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 11 Mar 2004 16:55:39 -0500
I'm not sure if this is exactly what you want, but it may give you some
hints. I wrote a couple of methods to handle encrypting/decrypting
datasets. You pass in a dataset, and it writes it in XML to a memory
stream. This memory stream is then encypted as it is written to a file
stream. I have another function that takes an ecrypted XML dataset file,
reads and decrypts it into a memory stream, then reads it into a dataset.
While I am reading/writing to files eventually, unencypted data is only in
memory, and never in a file.
I'm sure you could fairly easily adapt it so that instead of reading/writing
the encrypted data to/from a file, you could instead read/write bytes
from/to a string. Instead of using XMLTextReader/XMLTextWriter to
read/write from a file, you'd just read/write from/to a string.
I've posted my code here (sorry it's C Sharp, and I'm new to .NET and visual
studio - if anyone sees any problems please let me know).
http://www.sevolution.com/cs/dsEncrypt.cs
Note that my handling of keys is not secure here, but I wanted to see if I
could at least get this much working.
"moondaddy" <moondaddy@nospam.com> wrote in message
news:eP5qFDzBEHA.2628@TK2MSFTNGP11.phx.gbl...
> I'm writing an app in vb.net. All of the code examples I've seen in
> encrypting and decrypting data including datasets involves FileStream
> objects and writing/reading from files. Is there a way I can do this with
> out having to involve files? It seems a better way would be to simply use
a
> string variable. In this case the dataset would have to be serialized
> without writing to a file also.
>
> Can this be done? If so, can you show me some code examples?
>
>
> --
> moondaddy@nospam.com
>
>
- Next message: Shawn Farkas: "Re: CAS in March 04 MSDN Article "Secure and Deploy Business Solutions with Microsoft Visual Studio Tools for Office""
- Previous message: Michael Giagnocavo [MVP]: "Re: Product Key dilemma"
- In reply to: moondaddy: "Encrypt/Decrypt dataset without writing to file."
- Next in thread: Shawn Farkas: "RE: Encrypt/Decrypt dataset without writing to file."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]