新闻建站cms系统、政府cms系统定制开发

广州网站建设公司-阅速公司

asp.net新闻发布系统、报纸数字报系统方案
/
http://www.ysneo.com/
广州网站建设公司
您当前位置:首页>网站技术

网站技术

支付宝RSA接口错误CryptographicException: 系统找不到指定的文件

发布时间:2017/1/3 17:58:36  作者:Admin  阅读:796  

广告:阿里云采购优惠专区

错误2:System.Security.Cryptography.CryptographicException: 系统找不到指定的文件。

在 System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)

在 System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters)

在 Com.Alipay.RSAFromPkcs8.DecodeRSAPrivateKey(Byte[] privkey) 位置 E:\aspnet2.0\nyweb_jia\Com.Alipay\RSA.cs:行号 331

 

未将对象引用设置到对象的实例。

说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。

源错误:

执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。

堆栈跟踪:

 

[NullReferenceException: 未将对象引用设置到对象的实例。]

Com.Alipay.RSAFromPkcs8.RSASignCharSet(String data, String privateKey, String charset) in E:\aspnet2.0\nyweb_jia\Com.Alipay\RSA.cs:48

Com.Alipay.RSAFromPkcs8.sign(String content, String privateKey, String input_charset) in E:\aspnet2.0\nyweb_jia\Com.Alipay\RSA.cs:30

Com.Alipay.Submit.BuildRequestMysign(Dictionary`2 sPara) in E:\aspnet2.0\nyweb_jia\Com.Alipay\AlipaySubmit.cs:56

Com.Alipay.Submit.BuildRequestPara(SortedDictionary`2 sParaTemp) in E:\aspnet2.0\nyweb_jia\Com.Alipay\AlipaySubmit.cs:82

Com.Alipay.Submit.BuildRequest(SortedDictionary`2 sParaTemp, String strMethod, String strButtonValue) in E:\aspnet2.0\nyweb_jia\Com.Alipay\AlipaySubmit.cs:120

Company.payapi.alipay.testpay.BtnAlipay_Click(Object sender, EventArgs e) in E:\aspnet2.0\nyweb_jia\Company\payapi\alipay\testpay.aspx.cs:61

System.Web.UI.WebControls.Button.OnClick(EventArgs e) +114

System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +139

System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +28

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2980

将代码中:

RSACryptoServiceProvider RSA  = new RSACryptoServiceProvider();
改为:
    /*
                 CspParameters RSAParams = new CspParameters();
                 RSAParams.Flags = CspProviderFlags.UseMachineKeyStore;
                 System.Security.Cryptography.RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(1024, RSAParams);
                 *
                 *  估计是权限问题,后来加了一行代码问题解决 RSACryptoServiceProvider.UseMachineKeyStore = true;
                 * */
                RSACryptoServiceProvider.UseMachineKeyStore = true;
                RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();

 

广告:阿里云新人采购专场

相关文章
支付宝
RSA
cms新闻系统购买咨询
扫描关注 广州阅速软件科技有限公司
扫描关注 广州阅速科技