OpenSSL makes it easy to encrypt/decrypt files using a passphrase. $ openssl aes-256-cbc -d -in -out secret.txt -pass file:key $ openssl rsautl -decrypt -ssl -inkey ~/.ssh/id_rsa -in key.enc -out key $ openssl rsautl -encrypt -pubin -inkey ~/.ssh/id_8 -in key -out key.enc $ openssl aes-256-cbc -in secret.txt -out -pass file:key Too Long, Didn't ReadĪssuming you've already done the setup described later in this document, that id_8 is the public key you want to use, that id_rsa is the private key the recipient will use, and secret.txt is the data you want to transmit… Encrypting $ openssl rand 192 -out key
The working assumption is that by demonstrating how to encrypt a file with your own public key, you'll also be able to encrypt a file you plan to send to somebody else using their private key, though you may wish to use this approach to keep archived data safe from prying eyes. This guide will demonstrate the steps required to encrypt and decrypt files using OpenSSL on Mac OS X. A Guide to Encrypting Files with Mac OS X