Saturday, July 13, 2019

OpenSSL instruction: How to encypher and decypher files

Hello everyone~~~

This is IRISnoir from Hackingarise. Coming back with a Termux based tutorial. This time about OpenSSL, the encryption tool.

Hacking A Rise encrypt-file-openssl

Now, a brief description of it’s usage:
In this world, everyone has the right to privacy. But there are some people that just have to go look at your files. This is the reason why OpenSSL exists.

Now, we try it out:
First, you need to install the package via:
$ pkg install openssl-tool

Now, when it’s installed, you now need to type in:
$ openssl
To open the OpenSSL text interface.

Then, to view all cyphers and encryption algorithms, just type:
OpenSSL> help
It prints all avalible commands and algorithms.

As you can see, there are a ton of algorithms. So I’ll only put an example encryption. The cipher we are gonna use is: aes-256-cbc.

Fun fact: the algorithm that I’m showcasing, AES(Advanced Encryption Standard) is also the one used by the U.S. government to protect confidential files. You can read more about it here.

Now, you need to enter this command to see it’s usage and options:
OpenSSL> aes-256-cbc -help
I know, it’s very much to take in. But we are in this together.

Now, the encryption part. I’m gonna make this basic so you understand. Type in:
OpenSSL> aes-256-cbc -salt -iter 2048 -pbkdf2 -in filename.txt -out filename_encrypted.txt

I’m gonna break down the whole thing:

aes-256-cbc: Cypher algorithm: aes-256-cbc.

-salt: Salt the encryption, to make it harder for offenders to decrypt. You can read about what salting means here.

-iter: Specify iteration count

-pbkdf2: Use password-based key derivation function 2, also short for PBKDF2

-in filename.txt: Specify the file which you want to have their contents encrypted. In this case, the file is ‘filename.txt’

-out filename_encrypted.txt: Specify the file which you want to have the encrypted message outputted to. In this case, it’s ‘filename_encrypted.txt’

Now, we go to the decryption. Decryption command goes like this:
OpenSSL> aes-256-cbc -d -in filename_encrypted.txt -out filename_decrypted.txt

This is gonna be broken down too.

-d: Stands for decrypt.

-in filename_encrypted.txt: Specify encrypted file which you want to be decrypted. In this case, it’s name is ‘filename_encrypted.txt’

-out filename.txt: Specify the file which you want the decrypted message to be written to. In this case, it’s ‘filename.txt’

Now, that is the end of this tutorial. I hope you have a great time. I’ll see you later. Remember, these tutorials are meant for good. Hackingarise is not responsible for any of your malicious acts. Thank you.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.