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

Encrypted fields being read as empty strings #27

Closed Thodor12 closed 3 years ago

Thodor12 commented 3 years ago

Hello, I'm having trouble with decrypting my fields. My data gets successfully encrypted and stored in the database but when I attempt to query my data it all returns empty strings. I've attempted to attach a debugger, use console logging and a logger instance but not a single method even says that the method is being called.

I am using the ASP.NET Core data protection system to protect/unprotect the keys by using a dataprotector. I have tried to follow the example code of the AES encryptor to make this example. Here is the source code: https://pastebin.com/Y5MkQSpg. Maybe I've just made a mistake somewhere and I'm missing it.

Thanks in advance

Thodor12 commented 3 years ago

Found the problem after some debugging, noticed that I forgot to reset the stream back to position 0 after writing to it