Eastrall / EntityFrameworkCore.DataEncryption

A plugin for Microsoft.EntityFrameworkCore to add support of encrypted fields using built-in or custom encryption providers.
MIT License
326 stars 54 forks source link

Seed data is updated every time #22

Closed firedeepan closed 3 years ago

firedeepan commented 3 years ago

I have some seed data for one of my encrypted entities. Basically one of the columns in the entity is encrypted. When I generate migrations, it generates UpdateData commands every time for the seed data even though there is no change in the seed data. It only happens for entities with Encrypted attributes. Highly appreciate your help.

Dumidu commented 3 years ago

I am facing the same issue. Any solution?

Eastrall commented 3 years ago

This is due to the new AesProvider that generate an IV for each encrypted data. This has been made for security and good pratices principles, but I think I am going to revert this or provider the old provider that allows to specify a static IV for the Aes encryption.

firedeepan commented 3 years ago

@Eastrall is there any temporary solution you can suggest till you fix it?

Eastrall commented 3 years ago

The best solution I can come up with right now, is to take the V1.1.0 AesProvider where you can provide a fixed IV that will allow you to use the Entity Framework LINQ features.

Eastrall commented 3 years ago

For a long-term fix, you will have to wait for V3.0 that restores the fixed InitializationVector for the AesProvider. See PR #25

Eastrall commented 3 years ago

Version 3.0.0 is now available on Nuget and should fix this issue if you use the "fixed IV" option: https://www.nuget.org/packages/EntityFrameworkCore.DataEncryption