ssh-keygen: a less complex tool for generating a public-private key pair

Tutorial on configuring the SSH client

Z and I Emulator for Web provides the utility program keytool for generating public-private key pairs. This tool is part of the Java 1.8 JRE and is also distributed with Z and I Emulator for Web. You should use keytool to generate keys for configuring a VT Display session for client authentication using a public key.

However, because keytool is a multipurpose utility for managing keys and certificates, you may find it easier to understand generating a public-private key pair by looking first at a less complex tool available on Unix-like platforms, named ssh-keygen. (This description is for illustration purposes only. You cannot use ssh-keygen to generate public-private key pairs for Z and I Emulator for Web.)

Here is an example of invoking ssh-keygen. This example is taken from the console of a system running Red Hat Linux 8.0:



ssh-keygen -t dsa -f johnkey02.id_dsa -N johnpass

The parameters have the following significance:

  • -t dsa specifies the type of key to generate (DSA).
  • -f johnkey02.id_dsa specifies name of the file that ssh-keygen is to create to hold the private key.
  • -N johnpass specifies the password for the private key file.

The invocation above causes the following files to be created in the local directory. This is how the files could appear if you issued an ls -l command from the console of Red Hat Linux 8.0:



-rw-------  1  mytmp  mytmp   736 Sep 21 17:50 johnkey02.id_dsa
-rw-r--r--  1  mytmp  mytmp   625 Sep 21 17:50 johnkey02.id_dsa.pub

The file johnkey02.id_dsa contains the private key.

  • The contents of this file are encrypted.
  • This file is protected with the password johnpass.

The file johnkey02.id_dsa.pub contains the public key. Notice that the name of this file is created by appending .pub to the name of the file containing the private key.

  • The contents of this file are plain text.
  • This file is not protected with a password.