msnews.microsoft.com <da*********@hotmail.com> wrote:
How can I crypt and decrypt string using System.Security.Cryptography
namespase methods?
Send me any example please.
Cryptography generally works on binary data rather than text data. So,
you need to convert the text data to binary data first (using an
Encoding), encrypt the binary data, and (usually) then convert the
binary data back to text - this time using something like
Convert.ToBase64String.
To decrypt, you reverse the process:
From the base64-encoded string, you get the encrypted binary data using
Convert.FromBase64String. You then decrypt the binary data as
documented in the MSDN (using CryptoStream etc), and then use Encoding
to get back to the original string.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too