Encrypt Files Easily with OpenSSL

OpenSSL

If you are like me, you probably wondered at some point, how can you encrypt your computer files. Today I will show you exactly how to encrypt files using “openssl”.

OpenSSL is an open-source software library that provides encryption, decryption, and cryptographic functions. It offers a wide range of cryptographic algorithms and is widely used in many security applications. Encrypting sensitive files is essential to protect confidential data from unauthorized access.

OpenSSL is a powerful tool for achieving this level of security. By following the steps I am about to demonstrate, you can ensure that your personal and professional information remains safe and secure.

For the purpose of this example, I’ve created a file and named it password.txt. Inside this file you will find my super secure password.

If you wish to follow along by copying and pasting the provided commands, I advise you to create a file on your device and name it “password.txt”. If you don’t know how to create a .txt file using the Terminal and would like to learn, check out my previous post. Keep in mind that if you use a different name for your file, you will need to update the command with the correct file name before running it in your terminal.

First, let’s encrypt the sensitive file “password.txt” to ensure its confidentiality and security. We will use a strong encryption algorithm, specifically 256-bit AES in CBC mode, to protect the data. Once encrypted, the output will be saved as “password.enc” for safekeeping. To begin the encryption process, you can use the command provided below.

When you initiate the encryption, the system will prompt you to input a secure encryption password. It is crucial to choose a complex and unique password, as this password will be essential for decrypting the file later.

Only you should have knowledge of this password to maintain the integrity and confidentiality of the encrypted data. Upon successful completion of the encryption process, remember to store the password in a secure and accessible location, ensuring that it is not compromised.

openssl enc -aes-256-cbc -a -in password.txt -out password.enc

Note: You can also drag the file to the terminal and get the absolute path populated.

After running the command, a second file will be created with the .enc extension. In this case, “password.enc”.

In the screenshot below you can see how the plaintext changed into something that is no longer readable. You may now delete the original document and keep the encrypted file.

Now, to decrypt the file, use the previous command with these changes: add “-d” after “enc“, and switch the file extension after “-in” to “password.enc“, and after “-out” to “password.txt“. If this seems too complicated, feel free to copy the command below.

openssl enc -d -aes-256-cbc -a -in password.enc -out password.txt

Note: you can use a new file name for the output file. Syntax will be:
openssl enc -d -aes-256-cbc -a -in password.enc -out “new_file_name”.txt

Congratulations! You can now easily encrypt and decrypt your files with OpenSSL! You now have the power to secure sensitive information and ensure data privacy with just a few simple commands.

By using OpenSSL, you can protect your files from unauthorized access and potential security breaches. If you’re interested in delving deeper into the world of encryption and learning more about OpenSSL, you can explore a comprehensive guide available at the following link. Take the next step in safeguarding your data and discover the full potential of OpenSSL’s capabilities.


Discover more from Cyber-Jot | Learn Cybersecurity & OSINT

Subscribe to get the latest posts sent to your email.

Leave a Reply

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑

Discover more from Cyber-Jot | Learn Cybersecurity & OSINT

Subscribe now to keep reading and get access to the full archive.

Continue reading