I have a column (salary) encrypted in database (MS SQL Server). I am using the entity framework to display/edit the records from the front end. Any idea how to decrypt the column in the front end to show the salary value?
Thanks
Install "EntityFrameworkCore. EncryptColumn" package to your project. Specify your encryption key in the constructor method of your DbContext class and create a instance from the encryption provider. Yout encryption key must be 128 bit!
Generally speaking, Entity Framework uses LINQ-to-Entities parametrized queries, and it is not susceptible to traditional SQL Injection attacks. However, Entity Framework does allow for the use of raw SQL queries when working with a relational database, introducing the risk of writing injectable queries.
The Entity Framework does not directly handle data encryption. If users access data over a public network, your application should establish an encrypted connection to the data source to increase security.
If you are doing encryption on database level you must use database level for decryption - use ObjectContext.ExecuteStoreQuery<YourEntityType>(...)
to load records from database - pass SQL command with correct decryption usage into that method.
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