JAVA JS 中的 modulus exponent 生成 C# 公匙

 C#用的是xml,里面是base64编码的。你上面的就是hex格式,只要把上面hex格式转成byte数组,然后在base64编码就可以了。

 public static byte[] Hex2Byte(string byteStr)
        {
            try
            {
                byteStr = byteStr.ToUpper().Replace(" ", "");
                int len = byteStr.Length / 2;
                byte[] data = new byte[len];
                for (int i = 0; i < len; i++)
                {
                    data[i] = Convert.ToByte(byteStr.Substring(i * 2, 2), 16);

                }
                return data;
            }
            catch (Exception ex)
            {
                // SystemLog.ErrLog("bin2byte失败:" + ex.Message);
                return new byte[] { };
            }
        }

用上面hex转byte[]可以然后再base64,可以得到

然后再根据xml格式组成xml就是C#的公钥

原文地址:https://www.cnblogs.com/coky/p/6727823.html