C# - encrypt class structure into file.
Posted on 2013-06-23
Currently, I write an instance of class Setups into a file using XML serialization. And I will read the instance back when my application startup. I use result of the XML serialization as the configuration file of my application.
Now I would like to encrypt the result of the xml serialization and able to read it back into a class instance.
class instance -->XML Serialization --> write XML file
Read XML File --> XML Serialization --> class instance
Now I am hoping to incorporate encrypt/decrypt
class instance -->XML Serialization --> encrypt --> write XML file
Read XML File --> decrypt --> XML Serialization --> class instance
Is this the right way to be expected or what is the right steps? And any good tutorial and examples for this type of operation?
Below is the class I try to do.
[XmlRootAttribute("Setups", IsNullable = false)]
public class Setups
public int TradeType;
public Setup Setup;
public class Setup
[XmlAttribute("entry")] public int _entry;
[XmlAttribute("type")] public string _typeString;
[XmlIgnore] public string _type;
[XmlElement("Name")] public string _name;
[XmlElement("Entry")] public string _entryName;