C#中文RSA加密解密的簡單方式

          

定義rsa,參見相關資料。

中文轉碼爲URL中可見的字符:

        byte[] name = rsa.Encrypt(HttpUtility.UrlEncode("長風吹雪", new UTF8Encoding()));
        byte[] text = rsa.Decrypt(name);
        string value = HttpUtility.UrlDecode(RSAUtils.UTF8BytesToString(text), new UTF8Encoding());

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章