Not sure if this is a good solution, but what about encrypting the file before opening the database and encrypting it again after closing it?
In any case, I donβt think there is a way to make the data 100% safe. There will always be a moment when the data is unencrypted (when your application reads it), and someone can get it at that time.
source share