Go Generics for Field Level Database Encryption
I have been working on a project that needs a rest API with a SQL database. The API creates, updates and retrieves objects from the database; such as:
- user information
- transactions
- user accounts
- credit card details
- other
This project has some specific data security requirements for storage. We needed to encrypt certain fields on these data tables using a different encryption key per
user
and peraccount
. The biggest challenge was building a Go library to support this sort of complex per field encryption. I wanted to make a nice way of encrypting and decrypting a Go struct without adding verbose code in the API. There needed to be a simple way of managing the many different encryption keys that will be handled in each API request.
Source: Go Generics for Field Level Database Encryption, an article by Josh Wales.