Let's do hands-on exercise of "public-key cryptography"


With this exercise you can experience about the mechanism of public-key cryptography. 'Public-key cryptography' is the cryptographic system using a pair of two different keys: 'public Key' for encryption, and 'private key' for decryption.

  • Abstract
  • Step 1
  • Step 2
  • Step 3
  • Step 4

1. Create a private key ('s task)

In the public-key cryptography, a recipient prepares a pair of public and private keys. Encrypted message by the public key can only be decrypted by the pair private key.
At first you play a role as a 'recipient' and create a private key. Click the following button and a private key will be created.

Notice: The private key file doesn't need to be opened with any appication program on your computer. After downloading the file move to the next step.

(Especially be care for mac users. Safari on Mac may open the downloaded '***.key' file with Keynote app automatically. At that case just close the keynote window soon.)

  • Click "Create a private key" button.
  • Download the file named 'private.key'. Confirm where you saved the file (maybe "Download" folder by default).
    If your machine opened the file associated with the extend '.key' (especially Keynote on MacOS), terminate the app soon. This exercise doesn't need any app installed on your machine.

2.Create a public key (recipient)

When sending a encrypted message, a recipient's public key is needed. Now create the public key which is paired with the private key you just created.

Set the "private key" file you created at Step 1:

  • Click the [Choose file] button.
  • Select private.key file on the dialog.
  • Click [Create a public key] button.
  • Download 'public.key' file.

3.Encrypt with the public key (sender's task)

A sender use a public key opened by a recipient and encrypt a message, and send it to the recipient. Next you play a 'sender' role and encrypt some message strings with the public key the 'recipient' created.

Input statement you want to encrypt



Select the recipient's public key
  
  • Type any string you want to encrypt (too long statement may be failed).
  • Click [Select file] button at the "Select the recipient's public key" row.
  • Select the public key file created in Step 2.
  • Click "Encrypt data by the public key" button
  • Download an "encrypted.data" file.

4.Decrypt by the private key (recipient's task)

The recipient get the encrypted message from the sender. This encrypted message can only be decrypted with the recipient's private key. You play the role 'recipient' again and let's decrypt the message with the recipient's private key.

Select the data you want to decrypt:

Select a private key file:

  • Click "select file" button next to "Select the data you want to decrypt:" message
  • Select the encrypted data you created as a sender in Step 3.
  • Click "select file" button next to "Select a private key:".
  • Select the private key file you created as a recipient in Step 1.
  • After selected above two files, click "Decrypt the data" button.
  • A new window will be opened and the decrypted message will be displayed on it.

[Exercise] 'I' will send you a message.

'I' the computer will send you a message encrypted with your public key. When received the message, you should go back to Step 4 and decrypt it with your private key.
Now first, send me your public key!


Select your public key: