Saturday, April 8, 2017

Encryption and Decryption for Ransomware

The post will be providing an introduction on encryption and decryption techniques used for ransomware. In the end I will guide you on how to create your own software to guard your files with the use of encryption and decryption.


Ransomware 


Ransomware is a harmful malware that infects your computer that secretly encrypts your files denying access , it will then demand payments in-return to release the files. This malware selects its files from their extensions such as JPG, PNG, DOC, XLS and PPT.

Encryption is the process of converting the readable data ( plain text ) into a secret code using an encryption algorithm . Encryption can be done using two methods , that is Symmetric and Asymmetric encryption.
                                           

  • Encryption and decryption Process    



Symmetric Encryption 

Symmetric encryption is also known as the shared secret key.  This is because the same pre-shared key is used in the process of encryption and decryption. Encryption algorithms used in the process such as DES, 3DES, AES, IDEA, RC2/4/5/6 are based on simple mathematical operations. Symmetric encryption uses keys with less key length as both parties guarding the key. This leads to faster execution.



Asymmetric Encryption

Asymmetric encryption doesn't require to have a pre-shared key for communication. In this case the receiver and the sender has two keys assigned for them namely Private key and a Public key. Private key is only know the the owner and the Public key is known to every one.  Any message encrypted by a private key can only be decrypted by its relating public key and vice versa.
Well known asymmetric algorithms used as Deffie-Hellman, DSS, RSA, EIGamal and Elliptical curve techniques. Calculation used in theses algorithms are more complicated than in symmetric , hence it requires higher computational power and lacks speed. This is typically used in low volume cryptographic mechanisms.



In the process of asymmetric encryption Confidentiality and Authenticity can be achieved if the keys are used in the below methods.



Now Lets Get to Learn How to create your own File guard software developed with the concepts of encryption and decryption.

This program is created in Java using NetBeans .

Below is the link to the Git hub account with the coding. Comments are provided on the codes for you to understand.


https://github.com/HarshaniSomarathne/-Ransomware-encryption-and-decryption-



Download the source code and run it in NetBeans.


  1. In the main menu select if you require to encrypt your documents or decrypt your documents .


    2.  If you select Encrypt My Files you will have to select the file you require to encrypt. 

Content of the selected document 





Then click on "Select Files to Encrypt " Then it will show you the selected file in detail along with its file path.



Now click on the encrypt button to continue .Then in the next window you will be requested to enter the key used for the encryption process. 


After you enter the key click on "Proceed " 
Next it will confirm the completion of the process .



Content of the document after encryption 



3. The following process is done if you select to Decrypt your documents. 




Now Please pay attention to the file extension of the previously encrypted file. Did you notice that the file text file extension was " txt " and now the extension is " enc" .  This is because the file is being encrypted. The file cannot be opened in any other way other than using same program with the correct KEY used when encrypting it.



Once you select the file to be decrypted click on "Select files to Decrypt ". Then you will be directed to a window with more further details on the selected file.
Click on "DECRYPT " button to continue .


4. Enter the password ( the KEY) you entered when encrypting this file.

5. A confirmation will be given in the process of decryption.

once completed you will be able to read the document.


Test Images

Below images  are being used for the   Hashtag Generator and Content Authenticator research .