Openssl Public Key Cryptography Signing and Verification

Create file and add contents to that file. 
Here you can make file in any editor of your choice. I have used vi can use nano,gedit or any of your choice.

Apply digest md5 and sha1 to view the difference of both.
To view the difference between md5 and sha1 on specific file just follow the simple steps using openssl as bellow.It will generate two different hashes.
Generate private key. Here i have used 3des encryption standard.
Generate Private key by using encryption algorithm. Here it is three time DES means its more encrypted from normal encryption DES.  
View the created private key.
You can view the created private key and as it shown bellow its not much more important to normal user or its just the crap as it was encrypted.
This creates a key file called rsapri.pem that uses 1024 bts. It is having private and public keys, now extract the public key from it.
Now extract the public key from the private key as it contains the public and private key by using -pubout.
View the contents of public key.
As we have seen the contents of private key, you can also view the contents of public key which was created in earlier step.
You now have some data in test.txt, lets encrypt it using OpenSSL and the public key.
Now its time to encrypt the data of the text file by using the public key.
Encrypting using "rsautl" gives error if the File size is larger. Use SMIME to perform large file encryption.
View the content that is in encrypted form.
Contents of the encrypted file that is .ssl file.
Now decrypt it using the private key.
Now if you want to decrypt the contents of the file that is .ssl file then you are required private key to decrypt as bellow.
View the original content after decryption.
Now you can see the original content after decryption.
 Signing the contents of the file using rsapri.pem and name the file as .cipher.
 Now lets sign the contents of file so if in any case it modifies by anybody in-between then the receiver should come to know.
View the contents of .cipher file after signing.
View the contents of file after signing.
Verify that content with test.txt. If it was not modified in-between than it displays the message Verified OK.
Now lets verify the contents of the file whether it was modified in-between or not? Here it is not modified.

Important Article on Secure data communication in Linux: PGP and GPG Secure Data Communication on two Linux machine

Thanks for reading this article.
If you have any problem or doubt with this then raise your comments below.
Share this article on any social network if you like.