Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File Encryption/Decryption with AES using Linux

I'm using the OpenWrt Linux distribution and I want to encrypt a file using AES.

How can I do that quickly and easily, and how can I—or someone else—decrypt it again?

like image 763
Ahmed202 Avatar asked Dec 14 '16 11:12

Ahmed202


People also ask

How encrypt AES file Linux?

You do not need to be an expert to use AES Crypt for Linux to securely encrypt your data files. To encrypt a file, you simply enter the "aescrypt" command with the appropriate command-line arguments. That's it! The program will create a file with the name "picture.

How do I decrypt encrypted files in Linux?

In order to decrypt an encrypted file on Linux, you have to use the “gpg” command with the “-d” option for “decrypt” and specify the “. gpg” file that you want to decrypt. Again, you will be probably be prompted with a window (or directly in the terminal) for the passphrase.

How encryption and decryption is done in AES?

AES includes three block ciphers: AES-128 uses a 128-bit key length to encrypt and decrypt a block of messages. AES-192 uses a 192-bit key length to encrypt and decrypt a block of messages. AES-256 uses a 256-bit key length to encrypt and decrypt a block of messages.


1 Answers

The quickest and easiest way is to use openssl util (provided by openssl-util package). For example, to encrypt a file, issue the following command:

openssl enc -aes-256-cbc -in file.txt -out file.enc

To decrypt:

openssl enc -d -aes-256-cbc -in file.enc -out file.dec
like image 152
Vasily G Avatar answered Sep 23 '22 04:09

Vasily G