C# Best way to encrypt & decrypt xmlwriter file

Skythrust

Member
Jul 9, 2019
133
7
Hi Guys,

I was wondering what kind of options I have to encrypt and decrypt xmlwiter files. Like configuration or other stuff which in this file will be saved in encryption and can only be read with the c# application.
in php I was able to encrypt/decrypt a string with md5, but this is not a requirement.

Please advise..
 

BIOS

ಠ‿ಠ
Apr 25, 2012
906
247
You seem to confuse terminology around encryption and hashing. MD5 is not a form of encryption, but an hash function (and a broken one at that) - the key differentiator to note here is an hash is not reversible and as such you cannot "decrypt" data which has been hashed. But you can decrypt an encrypted message, provided you have the key.

It's important to understand whether it is truly what you want to do, what are you trying to achieve by encrypting the XML files? If you are storing the key material on the same system as the files, encryption likely won't be any use here.

Anyhow, if you still want to do this you probably want to use symmetric key encryption. You can encrypt specific fields of an XML file, see examples: . Switch out TripleDESCryptoServiceProvider with though, and I'd recommend using AES256 as the algorithm.
 

Users who are viewing this thread

Top