How to use this applet:


The purpose of this applet is to demonstrate the steps that are involved in the RSA encryption algorithm.


Before a message can be encrypted, the keys must first be chosen.  There are six fields located in the upper-right-hand quadrant of the applet that are used to find these keys.


RSA encryption is based on the product of two large prime numbers.  The first two fields p and q allow the user to input two numbers of his/her choice.  It will be verified by the applet that p and q are actually prime.


The next step is to click the “Compute” button.  This will calculate the product p and q, denoted r, and will find the value , where  is equal to the number of positive integers that are relatively prime to (and less than) r.  This is known as the Euler phi function.


Next, a private key must be chosen by the user.  This number must be relatively prime to .  This will be verified by the applet.  In practice, the private key would be just that, private to the person encrypting a message.


Once a private key has been entered, then the user can click the “FindKey” button to have the applet find a public key for his/her private key.


Once the keys have been chosen, the user can then encrypt and decrypt his/her own messages.  Enter text to be encrypted in the upper-left window.  Click the “Encrypt” button to see the encoded format.  Then click the “Decrypt” button to see the message decoded again.  One important point about the selection of numbers p and q is that there are "good" choices and "bad" choices.  The encrypted message will not be able to be decoded with a "bad" choice.  (See “Choosing Primes”.)


The user is supplied with a default set of prime numbers and a default private key.  These numbers are "good" choices in the sense that the encoding and decoding process works properly.




The file menu at the top has an option to clear the screen of all entries as well as an option to restore the default settings.


The user will see one bug.  Squares may appear at the end of a line of text if the text is not of a particular length.  This is a bug in the applet, not a problem with the encryption algorithm.