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?
Asked
Active
Viewed 2,634 times
3
-
Can you please show bit of code? – dotnetstep Jan 12 '15 at 01:36
-
Added a link to examples in the question. – eadam Jan 12 '15 at 08:12
-
Did you tried to add System.Security.Cryptography in project.json for aspnetcore50. – dotnetstep Jan 12 '15 at 10:04
-
Yes it still says "Asp.net 5.0 - Available" and in "Asp.net Core 5.0 - Not Available". – eadam Jan 12 '15 at 12:45
1 Answers
4
You should use the Microsoft.AspNet.Security.DataProtection package. The 2 main interfaces you can use are:
and
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.

davidfowl
- 37,120
- 7
- 93
- 103
-
Your links are all broken... http://sourcebrowser.io/Browse/jchannon/katanaproject/src/Microsoft.Owin.Security/DataProtection/IDataProtector.cs http://sourcebrowser.io/Browse/jchannon/katanaproject/src/Microsoft.Owin.Security/DataProtection/IDataProtectionProvider.cs https://github.com/jchannon/katanaproject/blob/master/src/Microsoft.Owin.Security/DataProtection/IDataProtectionProvider.cs https://github.com/jchannon/katanaproject/blob/master/src/Microsoft.Owin.Security/DataProtection/IDataProtector.cs – Stefan Steiger Oct 01 '16 at 10:32