What is the equivalent (if there is one) of MachineKey.Protect()
and MachineKey.Unprotect()
in ASP.NET Core
The ASP.NET Core data protection provides a cryptographic API to protect data, including key management and rotation. Web applications often need to store security-sensitive data. Windows provides a data protection API, DPAPI, but Windows DPAPI isn't intended for use in web applications.
Open IIS manager. Double-click the Machine Key icon in ASP.NET settings in the middle pane: Now you can click Generate Keys on the right pane to generate random MachineKeys. When you click Apply, all settings will be saved in the web.
Machine keys help protect Forms authentication cookie data and page-level view state data. They also verify out-of-process session state identification. ASP.NET uses the following types of machine keys: A validation key computes a Message Authentication Code (MAC) to confirm the integrity of the data.
the new dataprotection api is what you are looking for https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/
you can use this nuget package from below url https://www.nuget.org/packages/SFSecurity/1.0.0#
or directly install by command "Install-Package SFSecurity -Version 1.0.0"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With