RSA Public Key Cryptography Demo Applet
The following Java Applet demonstrates the basics of RSA Public Key cryptography. You may wish to read an overview of RSA Public Key Cryptography. To operate the demo:
- Provide values for p and q (where p and q are prime numbers. Try p = 223 and q = 199) and click on the Calculate N button. This will calculate the value of N (called the modulus). It will also provide values for E and D (the public and private exponents) such that:
- E < n
- E is Relatively Prime to (p – 1) * (q – 1)
This means that E and (p – 1) * (q – 1) have no common factors except 1 - E * D – 1 is evenly divisible by (p -1) * (q – 1)
We call (E, N) the Public Key and (D, N) the Private Key.
To start with, you might want to just leave the values of p and q as they are. The reason is that if p and q are too small, then N will be smaller than the values we are
trying to encrypt or decrypt. When this happens, the system does not work properly. This is especially the case if you are trying to encrypt characters with ASCII values
higher than 128 (e.g., most European languages).Just as a check, it seems N should be greater than 40,000. This will allow all of the ASCII characters up to 128 to be encoded without problems.
- Next type a short message into the M field and click on the Encrypt button. This will encrypt your message by combining two letters at a time into a block. Each block will be encrypted using the RSA algorithm:
blockE mod N - The result will be the encrypted message shown in the Ciphertext field.
- Clicking on the Decrypt button will then reverse the process by decrypting each of the encrypted values using the RSA algorithm:
blockD mod N
Note: If you change the values for p and q, be sure to encrypt your message again, otherwise, the Decrypt step will not work.
Your comments and suggestions are welcome: Richard Holowczak rholowczak@gmail.com


Trackbacks/Pingbacks
[...] RSA Publc Key Cryptographydemo applet and have just finished loading it up. You can find it here: http://holowczak.com/rsa-cryptography-demo-applet/ or by looking in the Tutorials section under [...]