Use C # + ASP.NET to perform RSA (asymmetric) encryption.

zhaozj2021-02-16  47

encryption:

<% @ Page language = "c #" autoeventwireup = "false"%> <% @ import namespace = "system.semburity.cryptography"%> <% @ Import namespace = "system.io"%> <% @ import namespace = "System.text"%>

<% string word = request.Params ["word"]; if (word == null) {response.write ("No input password !!!"); return;} StreamReader sr = new streamreader (@ "f: /a.txt",UTF8Encoding.UTF8);string readpublickey = sr.ReadToEnd (); sr.Close (); RSACryptoServiceProvider crypt = new RSACryptoServiceProvider (); UTF8Encoding enc = new UTF8Encoding (); byte [] bytes = enc.GetBytes (word); crypt.FromXmlString (readpublickey); bytes = crypt.Encrypt (bytes, false); string encryttext = Convert.ToBase64String (bytes); string abb = Server.UrlEncode (encryttext); Response.Write (abb);

Response.write ("