How does one implement column level encryption using Ecto/Phoenix with Postgresql? I understand pgcrypto extension has functions to support encryption/decryption, my questions are
How can I invoke those using Ecto syntax for a particular column?
How and where to supply the decryption key? This is most important. I am assuming decryption key will need to be supplied on the db connection made over TLS
Would like to hear your thoughts on this. Thanks in advance.
In that case encrypt data in application and transfer it encrypted over the wire. However remember that it will use the same key for all entries, so it will protect you only in case if the DB itself is breached (without breaching application). If application is breached, then there is nothing that will prevent reading that data.