2

How to encrypt WHOLE an xml file using C#?

Alexandre
  • 13,030
  • 35
  • 114
  • 173
  • Please clarify your question. What do you want to do? Encrypt a file? Encrypt parts of a file? – Oded Oct 12 '10 at 15:26

3 Answers3

2

If I understand you question, you might start by looking at System.Security.Cryptography namespace in .Net, and in particular at the CryptoStream class.

President James K. Polk
  • 40,516
  • 21
  • 95
  • 125
1

Here's a link you might find useful:

Encrypt and decrypt a string

Community
  • 1
  • 1
code4life
  • 15,655
  • 7
  • 50
  • 82
0

If you mean how to encrypt the XML file within code and save it back to disk, you can read the XML file as simple text. In that form it is nothing but a long string. Use the method you are familiar with to encrypt it. Then save it back to disk as a standard binary file. Reverse that to decrypt the file.

If you just want to encrypt the file on the drive, in Windows you can do that from the file properties.

Gil
  • 128
  • 1
  • 1
  • 7