Q:

how to encrypt xml file for security

I am trying to encrypt the entire xml file for security, including its nodes and values. I have done something but I am not sure if it is correct way to do it. And also I am getting a null exception during the runtime
Encryption scrty = new Encryption("arif");
XmlDocument doc = new XmlDocument();
doc.Load("D:\\PROJELE\\XML\\Language.xml");
string tst = scrty.Encrypt(doc.InnerXml);
doc.InnerText = tst;  // "null exception" is thrown here************
doc.Save("D:\\PROJELER\\XML\\Language2.xml");

After encryption, how can I assign it encrypted text to doc? is there any other way to do this?

A:

doc.InnerText = tst;

it means that your call 
string tst = scrty.Encrypt(doc.InnerXml);

is returning null. Now show us the working of Encryption.Encrypt so that we can tell you why it is returning null, or diagnose it yourself.
and for encryption you can see MSDN

