用的官方提供的demo,实际上部署后却出现了上图的错误。和技术支持沟通无效后,走上了不归路。

在微软的github dotnet/core开源库提交了issue后,终于获得了解决。附上链接:https://github.com/dotnet/core/issues/3020

有道翻译一下:

附上官方demo代码,被注视掉的部分就是引起问题的原因:    

 // ------- create RSACryptoServiceProvider instance and initialize with public key -----
                //CspParameters CspParameters = new CspParameters();
                //CspParameters.Flags = CspProviderFlags.UseMachineKeyStore;                 //int bitLen = 1024;
                //if ("RSA2".Equals(signType))
                //{
                //    bitLen = 2048;
                //}                 RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();
                RSAParameters RSAparams = new RSAParameters();
                RSAparams.Modulus = MODULUS;
                RSAparams.Exponent = E;
                RSAparams.D = D;
                RSAparams.P = P;
                RSAparams.Q = Q;
                RSAparams.DP = DP;
                RSAparams.DQ = DQ;
                RSAparams.InverseQ = IQ;
                RSA.ImportParameters(RSAparams);
05-28 06:20