Are there any built in command-line tools that I can encrypt and decrypt a text file (and provide it some sort of password).
Solution:
openssl
comes pre-installed on Mac OS X.
You can use the following commands:
# encrypt file.txt to file.enc using 256-bit AES in CBC modeopenssl enc -aes-256-cbc -salt -in file.txt -out file.enc# the same, only the output is base64 encoded for, e.g., e-mailopenssl enc -aes-256-cbc -a -salt -in file.txt -out file.enc# decrypt binary file.encopenssl enc -d -aes-256-cbc -in file.enc -out file.txt# decrypt base64-encoded versionopenssl enc -d -aes-256-cbc -a -in file.enc -out file.txt
(copied from OpenSSL Command-Line HOWTO: How do I simply encrypt a file?)
These commands use 256-bit AES ecryption with Cipher Block Chaining (CBC), which is about as secure as it gets right now.