Skip to content

Instantly share code, notes, and snippets.

@dideler
Last active April 8, 2024 04:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dideler/5219993 to your computer and use it in GitHub Desktop.
Save dideler/5219993 to your computer and use it in GitHub Desktop.
An easy and quick way to encrypt (and decrypt) sensitive files on your computer. The filename is static, so don't forget to set it (on line 14)!
# Based on http://ejohn.org/blog/keeping-passwords-in-source-control/
#
# John Resig needed a way to keep sensitive data (e.g. config files with
# passwords) out of source control. So he decided to encrypt the sensitive data.
#
# I decided to modify the script so it's purpose is quickly encrypting or
# decrypting any sensitive file you have on your computer.
#
# Usage: make encrypt
# make decrypt
.PHONY: _pwd_prompt decrypt encrypt decrypt_conf encrypt_conf clean_encrypt clean_decrypt
FILE=filename
_pwd_prompt:
@echo "Contact your_email@example.com for the password."
decrypt: decrypt_conf clean_decrypt
encrypt: encrypt_conf clean_encrypt
decrypt_conf: _pwd_prompt
openssl cast5-cbc -d -in ${FILE}.cast5 -out ${FILE}
chmod 600 ${FILE}
encrypt_conf: _pwd_prompt
openssl cast5-cbc -e -in ${FILE} -out ${FILE}.cast5
clean_encrypt:
\rm ${FILE}
clean_decrypt:
\rm ${FILE}.cast5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment