How to encrypt file through open SSL (Secure,Socket,Layer)in Linux RedHat part 1
hello guys today we are going to learn how to encrypt file through open ssl method. but before i enplane some knowledge of open SSL method. open ssl is a file encrypt method. this method in several Version of file encrypting its a very strong method . in this tutorial we will discuss some use full and strong version of encrypt method and we will also learn in our linux machine that how can we apply on our file.
(note- in this tutorial all commands use on redhat linux 5 if you have other version of linux like fedora ,Ubuntu ,kubuntu, or other .Open ssl File encryption method is work on all type of linux .you onlly need to install package according to linux Operating system.
Step 1 here we will install openssl package through Yum Server. if you want to know how to configure yum Server in linux redhat then click on this link and look.
[root@localhost exp]# yum install openssl -y
Here before we will learn base64 version open ssl method. in this method we can write encrypted content and also make encrypted file so you just follow me and look with piratical
Step 2 before we will learn how to write encrypt text through base64
[root@dhcppc16 ~]# echo "hello this is encrypt method base64 demo"|openssl enc -base64 aGVsbG8gdGhpcyBpcyBlbmNyeXB0IG1ldGhvZCBiYXNlNjQgZGVtbwo=
now if we want to decriypt content we will just put our encrypt content mid in” “and run command
[root@dhcppc16 ~]# echo "aGVsbG8gdGhpcyBpcyBlbmNyeXB0IG1ldGhvZCBiYXNlNjQgZGVtbwo="|openssl enc -base64 -d
hello this is encrypt method base64 demo
Step 3 we can encrypt any file through this Commands
[root@localhost exp]# openssl enc -base64 -in a.txt -out a.enc [root@localhost exp]# ls a.enc a.txt [root@localhost exp]# rm -rf a.txt [root@localhost exp]# cat a.enc IGhlbGxvIHRoaXMgaXMgbXkgZGVtbyBmaWxlCg==
we can decrypt file through this below Commands
[root@localhost exp]# openssl enc -base64 -d -in a.enc -out a.txt [root@localhost exp]# ls a.enc a.txt [root@localhost exp]# rm -rf a.enc [root@localhost exp]# cat a.txt hello this is my file encryption base64 demo
Step 4 Encrypt and decriypt a File or message using AES-256-cvc method
[root@localhost exp]# echo "hello this is AES-256-CVC demo"|openssl enc -aes-256-cbc >a.bat enter aes-256-cbc encryption password: 12345 Verifying - enter aes-256-cbc encryption password:12345 [root@localhost exp]# ls a.bat [root@localhost exp]# cat a.bat Salted__Y,@o???a?4???tc(t[?c???$F^?$O???|??[root@localhost exp]#
now we will decriypt through below commands
[root@localhost exp]# echo "hello this is AES-256-CVC demo"|openssl enc -aes-256-cbc -d -in a.bat enter aes-256-cbc decryption password:12345 hello this is AES-256-CVC demo
here we will learn if we have already any file we want encrypt then we will use below commands
[root@localhost exp]# openssl enc -aes-256-cbc -in a.txt -out a.bat enter aes-256-cbc encryption password:12345 Verifying - enter aes-256-cbc encryption password:12345 [root@localhost exp]# ls a.bat a.txt [root@localhost exp]# cat a.bat Salted__?cJ??D^??0?7??6?i???+?#??7??+?z +^W?[root@localhost exp]# we can decrepit file through this Commands [root@localhost exp]# openssl enc -d -aes-256-cbc -in a.bat -out a.txt enter aes-256-cbc decryption password: [root@localhost exp]# ls a.bat a.txt [root@localhost exp]# cat a.txt hello this is my file demo
if you have any problem in this process so please Comments here i will solve your problem otherwise like share and follow my blog for Linux Networking and IT Solution
thank you
BY Vishnu Sharma
