dideler
3/22/2013 - 9:27 AM

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

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