System.Security.Cryptography not found.

I am trying to add a reference to System.Security.Cryptography.X509Certificates, but I understand: "Type or namespace" Cryptography "does not exist in the namespace" System.Security ".

I tried to add System.Security to the links, I tried to add System.Security.dll, I tried to add mscorlib.dll, I tried to find how to add Windows.Security.Cryptography.

No luck, so I can't use the X509Certificate2 class that I need.

Does anyone face this incredibly sad situation?

UPDATE:

Looking at this question, RandomNumberGenerator in ASP.NET5 I cannot find what I am looking for in Nuget. In nuget, I only see System.Security.Cryptography.Hashing.Algorithms.Analyzers. I need System.Security.Cryptography.X509Certificates

+5
source share
1 answer

You need to add a reference to the System.Security.Cryptography.X509Certificates NuGet project in your ASP.NET project.

.NET Core (this is what the new ASP.NET uses) is a component architecture, you need to import packages of required functions. When you searched in Visual Studio, you probably didn’t have the Enable Pre-Validation option to verify that the libraries for .NET Core were filtered out.

+5
source

All Articles