I have a class with one property and one set-method. password is never serialized to the client but if the client sends in the password it will be serialized and hashed. However i don't like the SetPassword property and would like to user SetPassword(string password) method on object and remove the SetPassword property.
[JsonIgnore]
public byte[] Password { get; set; }
[JsonProperty("password")] // Working but not what i want.
public string SetPassword
{
set
{
Password = new SHA512Managed().ComputeHash(Encoding.UTF8.GetBytes(value + Salt));
}
}
[???] // What sould i replace ??? with to serialize password from json object?
public void SetPassword(string password)
{
Password = new SHA512Managed().ComputeHash(Encoding.UTF8.GetBytes(password + Salt));
}