Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

String encrypt/decrypt

What is the easiest and simplest way to encrypt/decrypt strings in c#/asp.net

Sam
Friday, February 18, 2005

Rot13

Easy and simple. Not necessarily secure though <grin>

Sgt.Sausage
Friday, February 18, 2005

I was thinking MyText.SubString(2) + MyText.SubString(0,2) would be easier.

Seriously, either download the Cryptography Application Block at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/crypto1.asp or use the System.Security.Cryptography namespace - see an example of this at http://samples.gotdotnet.com/QuickStart/howto/default.aspx?url=/quickstart/howto/doc/fileencrypt.aspx

moron
Friday, February 18, 2005

I’ve read all those articles, but since I am searching for asymmetric file (or string) encryption, it seams only RSA is available. The only problem here is exporting the key. My system will use encryption, so there is a need for a setup tool to generate private and public keys. Public  keys will be published in the web site, and private keys will be burned down to CD’s and distributed by myself to all nodes in my system.
The point is how to export those keys – the only way to do it seems to use RSACryptoServiceProvider and ToXmlString method switching it’s param to true. But will this xml be enough interoperable, so I can use this xml-key to decrypt files using RSA class written for example in Java? I am not sure if all nodes in my system will use .net written software. So is it any chance to do some “inter platform” key export?

Smok1
Monday, February 28, 2005

*  Recent Topics

*  Fog Creek Home