tags:

views:

85

answers:

2
MD5 md5 = MD5.Create();
byte[] Ostring = System.Text.Encoding.UTF8.GetBytes("original string");
byte[] hashMD5 = md5.ComputeHAsh(Ostring);
StringBuilder sb = new StringBuilder();
for (int i=0; i<hashMD5.Length; i++)
{
   sb.Append(hashMD5[i].ToString("X2"));
}
string strMD5 = sb.ToString();

the value of strMD5 I want encrypt it, using the algorithm RSA with a key in DER format "file: aa.key"

How I can do it in c #?

+1  A: 

Your code only hashes a string. Hashes are asymmetrical, one-way only - you cannot "unhash" something.

A good, complete example of symmetrical string encryption is here: http://www.obviex.com/samples/Encryption.aspx.

ebpower
A: 

I show an extended example here

The context in this sample was to encrypt a query string using c#

Toran Billups