How to do Symmetric Encryption and Decryption

In cryptography, Encryption is the conversion of data into a form, called a ciphertext, that cannot be easily understood by unauthorized people. Decryption is the process of converting encrypted data back into its original form, so it can be understood. There are many ways for encryption, In following article, I have explained only two methods Symmetric and Asymmetric encryption. 

SYMMETRIC ENCRYPTION AND DECRYPTION

Openssl based Symmetric Encryption and Decryption :

In symmetric Encryption we use shared key (One Key) to encrypt and decrypt file.

# To encrypt a file run following command

[ root @ leolinux ~]#   openssl   enc   -des3  -salt  -a  -in   some.txt  -out  chiphertxt.des3 

( enc=encryption,  des3=algo,  salt='stroe along with password',  a='64 bit processing',   in='Input file',  out='Output file' )

# To decrypt a file

[ root @ leolinux ~]#  openssl  enc  -d  -des3  -salt  -a -in ciphertxt.des3  -out plain.txt

( enc -d=decryption,  des3=algo,  salt='stroe along with password',  a='64 bit processing',   in='Input file',  out='Output file' )

 

GPG based Symmetric Encryption and Decryption :

# To encrypt a file run following command

[ root @ leolinux ~]#  gpg  -c  --cipher-algo 3des  plain.txt

( c=encryption,  cipher-alog 3des=algorithm )

# To decrypt a file

[ root @ leolinux ~]#  gpg  --out  plain.txt  -d plain.txt.gpg

( out='Output file' ,   d=decryption)

 

Cheer!!