Sunday, February 01, 2015

Encryption using OpenSSL

OpenSSL is an open source toolkit for implementing secure sockets layer (SSL) and transport layer security (TLS) protocol. It provides various cryptographic functions. Latest version is 1.0.2 released on 22nd January 2015. Visit the official website: https://www.openssl.org/

If you have already installed any VPN or Web server then you will find openssl over there.

VPN: C:\Program Files\CyberGhost 5\Data\OpenVPN\openssl.exe
PHP: C:\xampp\php\extras\openssl\openssl.exe
Apache: C:\xampp\apache\bin\openssl.exe
MinGW: C:\MinGW\msys\1.0\bin\openssl.exe

And if you don't then go to https://www.openssl.org/related/binaries.html to download executable file.

Once you have it installed click on openssl.exe and it will open a command prompt.


The list of commands available are shown in the image.

You can visit https://www.openssl.org/docs/apps/enc.html for detailed information for commands.


Encryption:

To encrypt a file first choose the algorithm. Here I have used des-ede3-cbc (which can also be used by des3). It stands for Data Encryption Standards - Encryption Decryption Encryption - Cipher Block Chaining method.

Then we need to specify whether we want to encrypt or decrypt.

Then the next thing we need to do is to specify the paths for input and output files. If you do not specify the output file then the ciphertext would be displayed in command prompt only.

And at last give the key (password) using which encryption will be performed.

If you do not want to specify password in command itself then you can do it later as well as shown in the image.

OpenSSL> des-ede3-cbc -e -in ReadMe.txt -out 3d3.txt -k your-password

Decryption:

It is simply reverse process of the encryption.

Note that you must use the same password for encryption and decryption.

OpenSSL> des-ede3-cbc -d -out 3d3Me.txt -in 3d3.txt -k your-password


Feel free to contact on com.puter.tips [at] outlook [dot] com for any queries.

No comments:

Post a Comment

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