楼主你好! 我也遇到了这个问题,但是我用你这个方法报错,并且 require 'xml/libxml'这个 gem 包下载不下来你帮我看看吧: 公钥: publickey='y7Ad9XqKsKtpvb/ekTvZH3ZKER12iNdVZ/w11NLXGnLWohzqmVcFA5XBQSqzfCx+NeNa1AC7yLbIzwZpiiG62bzb9/aARQhSpcNxN5c1Xrps8gxbo4pOSJUZlqgLkGXfgz1ZuB3tCI9JEmJUmfXuXVC3lVL7x7b6g+nGaTe+Ob/r3nmsu/h5NGNtYUfMRBlSUsHMUWNoZGa4f6dERYmUgl1duLnZBsJP3hlHhLKuoXnl8cq1V7K7O4WqQ3m7mR1IXuYTZ4K9/tr6yu52Gic3PVRduURzspE+6lI9sUjLIsmIxVgJGFTbu3nRw1mb849RzkLPdidcmyx2C5lya89rBQ==AQAB'
c#加密方法: private static string Encrypt(string originalString, string key) { try {《》 var RSA = new RSACryptoServiceProvider(); RSA.FromXmlString(key); byte[] dataToEncrypt = UnicodeEncoding.ASCII.GetBytes(originalString); byte[] encryptedData = RSA.Encrypt(dataToEncrypt, false); return Convert.ToBase64String(encryptedData); } catch (CryptographicException) { return string.Empty; } }