Posted on: 6/10/2015 7:06:34 PM | Views : 633

Sup people! I really don't know how to google this, so here it goes:
I'm currently encrypting somewhat sensitive data (Some products IDs which are available to all users) and putting it in the HTML (hidden forms) so I can receive them later on and work with them.
The encryption process uses the following code:
public class StringEncrypt : IEncrypt { public Func<string> GetUserID; public StringEncrypt() { GetUserID = () => HttpContext.Current.User.Identity.GetUserId(); } private string Purpose = "The authentication token is"; public string Protect(string unprotectedText) { var unprotectedBytes = Encoding.UTF8.GetBytes(unprotectedText); var protectedBytes = MachineKey.Protect(unprotectedBytes, Purpose + GetUserID); var protectedText = Convert.ToBase64String(protectedBytes); ...

Go to the complete details ...