First of all, I am working with ASP.NET and C#. I came across this Encryption and Decryption code and I am quite confused on how use it to encrypt the json string content that client is sending and decrypt it on server side.
This is how I send my post request in client side.
public async void updateMobileAppLogin(string id, DateTime lastlogin, int attempt, DeviceBlock block)
{
js_updateMobileAppLogin login = new js_updateMobileAppLogin
{
Id = id,
Lastlogin = lastlogin,
Attempt = attempt,
Block = block
};
var content = new StringContent(JsonConvert.SerializeObject(login), Encoding.UTF8, "application/json");
await client.PostAsync("http://www.myrocketserver.com/api/updlogin", content);
}
This is my code on server side to execute post request.
[HttpPost]
[Route("api/updlogin")]
public void PostMobileAppLogin([FromBody] js_updateMobileAppLogin update)
{
DBConnection db = new DBConnection();
db.updateLoginAttempt(update.Lastlogin, update.Attempt,update.Block,update.Id);
}
How can I modify this code to encrypt the content and decrypt it on server side