C# Encrypt serialized file before writing to disk

前端 未结 4 1735
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-05 08:08

Let\'s say my program has a class called "customer" and the customer class is serializable so I can read and write it to disk. The customer class holds sensitive i

4条回答
  •  旧巷少年郎
    2020-12-05 08:34

    Its quite possible,

    Lets say you class looks like

    public class Customer
    {
    public string Name{get;set;}
    public int salary {get;set;}
    }
    

    You could encrypt the data held in properties of the object so customer.Name = 'ABC' could become customer.Name = 'WQW' something like that

    than serialize it.

    On deserialization, when you have to show the data you have to decrypt it before showing the data to the user

    hope this help

提交回复
热议问题