EntityFrameworkCore.DataEncryption icon indicating copy to clipboard operation
EntityFrameworkCore.DataEncryption copied to clipboard

Migration on plaintext database properties error

Open isIulian opened this issue 4 years ago • 1 comments

I have an existing database table that I have decided to encrypt and I have configured an MirgrationEncryptionProvider so it will map the previous data

 var migrationProvider = new MigrationEncryptionProvider(null,  new AesProvider(encryptionKey, encryptionIV));
_encryptionProvider = migrationProvider;

and now I'm calling the migration procedure when needed await _db.MigrateAsync(); so it take all properties decorated with EcryptionAttribute and applies the mapping from previous encryption to the new one. There is a problem for default case, the plaintext columns. The error is caused by the default decoder for string types in my cases. Knowing the it isn't encoded it should return the value that is stored on database, not to try to decode it with FromBase64String decoder that we pass.

FormatException The format of s is invalid. s contains a non-base-64 character, more than two padding characters, or a non-white space-character among the padding characters.

Note: It work very well to pass from and ecrypted version to another one, it only the plaintext case, that is a problem in my opinion.

isIulian avatar Nov 09 '21 15:11 isIulian

Hello, thank you for openning an issue regarding the migrator. I will look into it.

Eastrall avatar Nov 14 '21 11:11 Eastrall

Migrator has been removed from the library since 3.X. Closing issue.

Eastrall avatar Sep 29 '23 07:09 Eastrall