ASP.NET 5 Creating RSA key,
I'm trying to create WebApi with token-based authentication in my ASP.NET 5 app. I'm following these steps https://stackoverflow.com/a/29698502/2420851 . But I'm stuck already at the first one with creating RSA key.
Line RSACryptoServiceProvider myRSA = new RSACryptoServiceProvider(2048);
produces compilation error The type 'RSACryptoServiceProvider' exists in both 'System.Security.Cryptography.Csp' and 'System.Security.Cryptography.RSA'
when I add "System.Security.Cryptography.RSA": "4.0.0-beta-22819"
to my project.json
error message just changes to The type 'RSACryptoServiceProvider' exists in both 'System.Security.Cryptography.RSA' and 'mscorlib'
Namespaces System.Security.Cryptography.RSA
and System.Security.Cryptography.Csp
are both unavailable.
How can I resolve this?
Updated
Do like this:
System.Security.Cryptography.RSACryptoServiceProvider myRSA = new System.Security.Cryptography.RSACryptoServiceProvider(2048);
or you have to remove the colliding imported namespaces and only have the "using System.Security.Cryptography"
If you are using ASP.NET 5 Core then you need to check this question on how to get Crypt to work:
Which encryption algorithm do we use in Asp.net 5 Core
or remove "dnxcore50" from your project.
链接地址: http://www.djcxy.com/p/22390.html下一篇: ASP.NET 5创建RSA密钥,