3

Currently almost all of the encryption algorithms start giving me errors when I switch the project type from Asp.net 5.0 to Asp.net 5.0 Core. This is because they all require System.Security.Cryptography namespance, which is not available in Core 5.0. See some code examples here. Any idea which one we could use in Asp.net core 5.0?

4
  • Can you please show bit of code? Commented Jan 12, 2015 at 1:36
  • Added a link to examples in the question. Commented Jan 12, 2015 at 8:12
  • Did you tried to add System.Security.Cryptography in project.json for aspnetcore50. Commented Jan 12, 2015 at 10:04
  • Yes it still says "Asp.net 5.0 - Available" and in "Asp.net Core 5.0 - Not Available". Commented Jan 12, 2015 at 12:45

1 Answer 1

4

You should use the Microsoft.AspNet.Security.DataProtection package. The 2 main interfaces you can use are:

https://github.com/aspnet/DataProtection/blob/dev/src/Microsoft.AspNet.Security.DataProtection/IDataProtectionProvider.cs

and

https://github.com/aspnet/DataProtection/blob/dev/src/Microsoft.AspNet.Security.DataProtection/IDataProtector.cs

In your web application, within the ConfigureServices method, call AddDataProtection on the service collection to make these available.

From there, you should be able to access the IDataProtectionProvider via dependency injection.

Sign up to request clarification or add additional context in comments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.