Password protect a file before emailing it

The project I’m working on grabs some data from an API, creates a CSV, and then emails that CSV out to the appropriate person. These CSVs are generated daily and sent to one person depending on the spreadsheet. The list of CSVs and people are not a fixed number and growing.

The request has been made to have the CSVs password protected. For the life of me I cannot find a good way to do this. I could zip them up with Erlang but those can’t have passwords. There doesn’t seem to be a clear path to getting them on a Google Drive or Google Sheets protected without some manual intervention (which is out of the question).

Is there something I’m missing here that would make this possible? I’ve searched and looked to no avail. I’m hoping there is a solution I haven’t came across or glossed over in my search.

Any ideas would be greatly appreciated. Thanks!

Can’t you just use some implementation of crypto lib? Erlang has one: Erlang -- crypto

I think you can also use some linux util by invoking System.cmd/3 (tar + gpg for instance)

EDIT:
I think you can find something useful here:

Shell out GPG it.

Do not try to reinvent the cryptowheel, just use battleprooven tools.

Do not rely on weak passwords.

Do not rely on synchrnous keys that remain the same every day.

Just rely on those who are known to have solved your problem years ago.

3 Likes