How to create project RSA Cryptography with JAVA in 3 Steps: Step 2 Create Process Logic Algorithm Encrypt Decrypt

Process Encrypt Decrypt

Hi Guys, this article continues the article part1 about summary RSA algorithm and creating UI for testing your project. After creating UI for testing, then next we create how to process encrypt and decrypt with algorithm RSA on a file.

Then what’s a step for creating this algorithm. Let’s do the steps.

Step 1 create Generator Key

  • Make a class with the name generatoyKey, and you must create a method for generating a random key.

Step 2 create Public Key and Private Key

  • After making generate a key, next, you create public key and private key

Step 3 create proses Encrypt generate Key

  • After steps 1 and step 2 have been made. Then next you must encrypt generate key pervious made to ensure safety

Step 4 create proses Decrypt generate Key

  • After step 3 has been made that is for encryption for generate key, you don’t forget to create also decrypt on generate key for reading file the encryption has been previous made.

Step 5 create proses Encrypt on a file

  • After making public and private keys, and then we just make a process algorithm for encrypting with the use of a public key that has been made.

Step 6 create proses Decrypt on a file

  • After that function encryption, you just create function decrypt from result file encrypt the previous made.

So as not to waste time, let’s go for creating code step by step. follow the source code below.

Yey great jobs, finally we have been processed the algorithm RSA for encrypting and decrypting on a file. Note, for now, we tested with the static file. In the next article is the last article, we will test with a file real directory path and combination User Interface testing has been made for Step 1. See you in the next article!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ia Kurnia

I love new technology and follow the advancements in the field. We Can Do It If We Want To Learn and Try.