PUBLIC KEY ENCRYPTION demonstration software by D. Canright Use the scroll bar or PgUp, PgDn, and arrow keys to scroll through this information. To resize the window, drag lower right corner. OVERVIEW: This demo illustrates the basic mathematics behind the RSA public- key encryption method. The essence of public-key schemes is that two keys (numbers) are chosen such that information encoded using one key can only be decoded using the other key. (Actually, a third number is also used, called the modulus, the same in both encoding and decoding.) So a person, say Alice, can make public one key (and the modulus), so anybody else can encode a message to Alice that only she can decode with her secret key. Another application is that Alice can write a message and encode it using her secret key, then anybody else can decode it using Alice's public key, and so be sure the message really came from Alice (this is called signature verification). Basic Steps for Alice to send a secret message to Bob: (1) Bob (a) generates a keyset, (b) saves it to a file, and (c) gives the key file to Alice. [Note: Bob only needs to do this ONCE; the same keyset can be used for all the messages addressed to Bob, from anyone.] (2) Then Alice (a) opens Bob's key file, (b) writes a new message, (c) encodes it with BOB's PUBLIC key, (d) saves it to a file, and (e) gives the message file to Bob. (3) So then Bob (a) opens the message file from Alice, and (b) decodes it with his PRIVATE key. [Note: nobody but Bob needs to know his private key.] COMMAND SUMMARY: [Most commands have Alt- or F- key shortcuts] File menu [Alt-F]: New Key [Alt-K] create a new key set Save Key [Alt-S] save the current key set to a .KEY file (NOTE: this does NOT save the private key, so remember it!) Open Key [Alt-O] open a .KEY file New Msg [Alt-M] create a new message Save Msg [Alt-V] save the current message to a .MES file Open Msg [Alt-P] open a .MES file Exit [Alt-X] terminate this program Code menu [Alt-C]: Clip Key [Alt-L] put the current keyset on the key clipboard Encode Msg [Alt-E] encode the text of the current message Decode Msg [Alt-D] decode the secret of the current message Advanced menu [Alt-A]: (see below for more details) Double Encode [Alt-B] encode secret again with outer key (NOTE: do this AFTER encoding text with inner key, see below) Double Decode [Alt-U] decode secret once with outer key (NOTE: do this BEFORE decoding with inner key, see below) Encode File [F7] encode ASCII text file (.TXT), save to .PKE file Decode File [F8] decode secret file (.PKE), save to .TXT file Double Encode File [F9] double encode .TXT file to .PKE file Double Decode File [F10] double decode .PKE file to .TXT file Windows menu [Alt-W]: Move [Ctrl-F5] move current window by arrow keys Next [F6] switch to next window in sequence Previous [Shift-F6] switch to previous window in sequence Close [Alt-F3] close the current window Help menu [Alt-H]: Help Window [F1] show the help window (this window) How PKE Works [F2] show the window about how the program works About PKE [F3] show the window about this program (in general) HOW TO USE THIS PROGRAM: (NOTE: all the files created in this program are plain ASCII text files, and can be sent through e-mail either as attachments or cut and pasted.) First: Choose a secret key (some odd number from 3 to 30001) using the New Key command. This generates a new keyset (private key, public key, and modulus) in a Key Window. REMEMBER the number you chose; this is your private key, so you should not tell it to anyone. Then Save this keyset to a .KEY file (your private key does NOT get saved, so if you forget it, you can't use this keyset any more). Then give copies of your .KEY file to your friends so they can use PKE to encode messages to you (using your public key), and the messages can only be decoded with your private key. To pass a secret message to a friend: Open the .KEY file that your friend gave you; this will show your friend's public key (and modulus) in a Key Window. Use the Clip command to put the key on the Key Clipboard. Then use the New Message command to get a blank Message Window. Type your message in the Message Text line (one line only; you can edit the message if you change your mind). Then Encode the message using your friend's public key from the clipboard, and Save the secret to a .MES message file. Give your friend the .MES file. To read a secret message from a friend: Open the .MES file that your friend gave you (this should have been encoded using your public key, as above). Decode the secret using your private key. (If you still have the new Key Window open from when you created your keyset, then you can Clip it to the clipboard before you decode, and paste your private key. Otherwise, you have to type in your private key. You do remember it, don't you?) ADVANCED APPLICATIONS: Besides sending short secret messages, this program can be used for some other typical applications of public key encryption, such as signature verification and encryption of files. Signature Verification: This is where you encode a message using YOUR PRIVATE key. Then anyone else can decode it using your PUBLIC key. So if your friend decodes it with your public key, he/she knows that the message must have come from you, because nobody else knows your private key. That way, you have used your private key as a digital signature. (This idea is important when doing business over the internet, to make sure people are who they say they are!) But since your public key is public (known to many people), your message is not secret; to keep it secret and digitally signed, use double encoding (see below). Double Encoding: To send a secret message to a friend and digitally sign it (see above), you must encode it twice, once with your private key, once with your friend's public key: First encode the message with your own private key (using the Encode command as usual). Then use the Double Encode command to encode the secret again, and use your friend's public key. Save the message to a file, and give your friend a copy. Then your friend uses the Double Decode command with his/her private key, and then the Decode command with your public key, to read the message. That way, nobody else can read the message, and your friend knows it could only have come from you. File Encoding: PKE can also encode files in ASCII text (.TXT) format (not other word-processor formats). So you can use the NotePad program, for example, to write a long letter, and save it to a .TXT file in the PKE directory. Then in the PKE program, use the Encode File command (with your friend's public key, for example) to encode it into a .PKE file. Give the .PKE file to your friend, who would use the Decode File command (with his/her private key) to get back the original .TXT file to read. (Note: you could also use file encoding to write secret diary files; encode it with your own public key and then only you can decode it with your private key, which you never tell anyone.) You can also double-encode files (to digitally sign secret letters, for example) using the Double Encode File command, and your friend would use the Double Decode File command. DISCLAIMER: This demonstration software was created for educational purposes only, to show how public-key encryption (in particular the RSA algorithm) works, and to be fun. This program is NOT intended for serious encryption of sensitive information. See the About PKE window for information on serious encryption products.