RSACryptoServiceProvider CsharpRs = new RSACryptoServiceProvider(); string publickey = @"<RSAKeyValue><Modulus>5m9m14XH3oqLJ8bNGw9e4rGpXpcktv9MSkHSVFVMjHbfv+SJ5v0ubqQxa5YjLN4vc49z7SVju8s0X4gZ6AzZTn06jzWOgyPRV54Q4I0DCYadWW4Ze3e+BOtwgVU1Og3qHKn8vygoj40J6U85Z/PTJu3hN1m75Zr195ju7g9v4Hk=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; CsharpRs.FromXmlString(publickey); byte[] CRsaB = CsharpRs.Encrypt(System.Text.Encoding.UTF8.GetBytes(RSAText.Text), false); //string CsharpStr = System.Text.Encoding.UTF8.GetString(CRsaB); CSharp_RsA.InnerText = Convert.ToBase64String(CRsaB);