Here is a quick, simple way to encrypt and decrypt files on any Mac or Linux system using OpenSSL. You only need access to a terminal app and don't need to install anything extra.
Step 1. In this example, both the unencrypted and encrypted files will be in your home folder. If you want to encrypt multiple files, it's easier if you compress everything into a single .zip file first. We'll be using a picture of a kitten.
Step 2. Open the terminal, type the following, then press enter. We'll go over what each section means:openssl aes-256-cbc -in ~/File.jpg -out ~/Encrypted.file
- "openssl". This tells the terminal to start the openssl utility. - "aes-256-cbc". This is the encryption cipher we'll be using for this example. - "-in ~/File.jpg". This tells openssl that the input file (the one you want to encrypt) is File.jpg. If you don't want to type out the full path for the file, you could just type "-in " (with a space it) and drag the file into the terminal. - "-out ~/Encrypted.file". This is the output file you will get. You can name it pretty much anything you like, although it's worth noting that you may run into problems if you name the output file the same as the input.
Step 3. You'll now be asked to choose an encryption password, and after you press enter, you'll be asked to verify.
Step 4. Now if you check your home folder, you should have a new "Encrypted.file" file sitting there. This is an encrypted version of your original File.jpg. You can now delete the original file if you want.
Step 1. In a terminal window, type the following and press enter:openssl aes-256-cbc -d -in ~/Encrypted.file -out ~/File.jpg
You'll notice that this is almost identical to the command for encrypting, except for a few things:
- "-d" is included which tells openssl you want to decrypt the file - The "-in" file is now the Encrypted.File and the "-out" is the original File.jpg.
Step 2. Now enter your decryption password. Press enter and your original file will reappear in your home folder.
These encrypted files are perfect for emailing and uploading to services like dropbox, since they're cocooned and impenetrable to passive snooping.