Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. WinForms DataSet Read Encrypted XML ???

WinForms DataSet Read Encrypted XML ???

Scheduled Pinned Locked Moved .NET (Core and Framework)
helptutorialcsharpdatabasesql-server
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    E L Golpe
    wrote on last edited by
    #1

    Wondering if anyone can help me. I have the tutorial from CodeProject on loading/writing XML files into a DataSet. Thats no problem. I also have the encryption tutorial (Rindajeal) on how to encrypt and decrypt text files. Can someone help me put it together? Not sure if it possible. What I want is to be able to read/write XML files that will be encryted in a data files directory (hopefully that can be zipped) and use these in a dataset (then a DataView to DataGrid..) I want to do this instead of using SQL Server.. Has anyone done this or give me pointers?? I have tried to pass the stream over but no luck. Any examples?? Practice sesquipedilianism! ;)

    E H 2 Replies Last reply
    0
    • E E L Golpe

      Wondering if anyone can help me. I have the tutorial from CodeProject on loading/writing XML files into a DataSet. Thats no problem. I also have the encryption tutorial (Rindajeal) on how to encrypt and decrypt text files. Can someone help me put it together? Not sure if it possible. What I want is to be able to read/write XML files that will be encryted in a data files directory (hopefully that can be zipped) and use these in a dataset (then a DataView to DataGrid..) I want to do this instead of using SQL Server.. Has anyone done this or give me pointers?? I have tried to pass the stream over but no luck. Any examples?? Practice sesquipedilianism! ;)

      E Offline
      E Offline
      E L Golpe
      wrote on last edited by
      #2

      Heres the code I have thus far. I can get it to encrypt it seems but Im not sure if it is encrypting correctly, or decrypting correctly... I use the Page_Load just to debug by loading a standard authors.xml file... I keep getting a root element missing exception when trying to load the encrypted file. I am using a static key and IV and I know I should use ASCIIEncoding instead of UnicodeEncoding for that but will change it later once I can get it working.... [code] using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using System.Security.Cryptography; using System.Text; namespace ReadingXML { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.DataGrid dataGrid1; private System.Windows.Forms.Button btnReadXML; private System.Windows.Forms.Button btnShowSchema; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; private System.Windows.Forms.Button btnUpdateXML; DataSet dsAuthors = new DataSet("authors"); public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.textBox1 = new System.Windows.Forms.TextBox(); this.dataGrid1 = new System.Windows.Forms.DataGrid(); this.btnReadXML = new System.Windows.Forms.Button(); this.btnShowSchema = new System.Windows.Forms.Button(); this.btnUpdateXML = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit(); this.SuspendLayout(); // // textBox1 // this.textBox1.Location = new System.Drawing.Point(8, 232); this.textBox1.Multiline = true; this.tex

      1 Reply Last reply
      0
      • E E L Golpe

        Wondering if anyone can help me. I have the tutorial from CodeProject on loading/writing XML files into a DataSet. Thats no problem. I also have the encryption tutorial (Rindajeal) on how to encrypt and decrypt text files. Can someone help me put it together? Not sure if it possible. What I want is to be able to read/write XML files that will be encryted in a data files directory (hopefully that can be zipped) and use these in a dataset (then a DataView to DataGrid..) I want to do this instead of using SQL Server.. Has anyone done this or give me pointers?? I have tried to pass the stream over but no luck. Any examples?? Practice sesquipedilianism! ;)

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        I don't see what the problem is. Have a method that reads a file, decrypts it, and reads that in to a DataSet (DataSet.ReadXml). Of course, this requires that the application reading the file can access the private key of the key pair from which the public key was used to encrypt the file. Make sure this is secured well and that it isn't distributed to clients in a haphazard way. Once someone gets a hold of the private key, there's nothing they can't do! Since you are working with XML, you might consider XML Encryption and Signatures. I have an article about XML Digitial Signatures and encryption isn't much different: http://www.codeproject.com/dotnet/xmldsiglic.asp[^] Being a industry standard and all, it is a lot better to use for practically any system that understands XML. This also takes the canonicalization of XML into account, which can be important when submitting text files (for instance, changing the line-endings via encoding changes could invalidate the document and it won't be descrypted correctly).

        -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups